| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
- // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
- // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon
- interface I {
- fn F();
- }
- class C {
- alias F = I.F;
- }
- fn F(c: C) {
- // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess]
- // CHECK:STDERR: C.F();
- // CHECK:STDERR: ^~~
- // CHECK:STDERR:
- C.F();
- // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess]
- // CHECK:STDERR: c.F();
- // CHECK:STDERR: ^~~
- // CHECK:STDERR:
- c.F();
- }
- // CHECK:STDOUT: --- fail_alias_impl_not_found.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
- // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
- // CHECK:STDOUT: %I.WithSelf.F.type: type = fn_type @I.WithSelf.F, @I.WithSelf(%Self) [symbolic]
- // CHECK:STDOUT: %I.WithSelf.F: %I.WithSelf.F.type = struct_value () [symbolic]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.F.decl [concrete]
- // CHECK:STDOUT: %C: type = class_type @C [concrete]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
- // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
- // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
- // CHECK:STDOUT: %c.param_patt: %pattern_type = value_param_pattern [concrete]
- // CHECK:STDOUT: %c.patt: %pattern_type = at_binding_pattern c, %c.param_patt [concrete]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %c.param: %C = value_param call_param0
- // CHECK:STDOUT: %C.ref.loc23: type = name_ref C, file.%C.decl [concrete = constants.%C]
- // CHECK:STDOUT: %c: %C = value_binding c, %c.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I {
- // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
- // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !with Self:
- // CHECK:STDOUT: %I.WithSelf.F.decl: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type) = fn_decl @I.WithSelf.F [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F)] {} {}
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.WithSelf.F.decl [concrete = constants.%assoc0]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .F = @I.WithSelf.%assoc0
- // CHECK:STDOUT: witness = (@I.WithSelf.%I.WithSelf.F.decl)
- // CHECK:STDOUT:
- // CHECK:STDOUT: !requires:
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
- // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
- // CHECK:STDOUT: %F: %I.assoc_type = alias_binding F, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: .I = <poisoned>
- // CHECK:STDOUT: .F = %F
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @I.WithSelf.F(@I.%Self: %I.type) {
- // CHECK:STDOUT: fn();
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F(%c.param: %C) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %C.ref.loc28: type = name_ref C, file.%C.decl [concrete = constants.%C]
- // CHECK:STDOUT: %F.ref.loc28: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0]
- // CHECK:STDOUT: %c.ref: %C = name_ref c, %c
- // CHECK:STDOUT: %F.ref.loc33: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0]
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %Self => constants.%Self
- // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type
- // CHECK:STDOUT: %I.WithSelf.F => constants.%I.WithSelf.F
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self) {}
- // CHECK:STDOUT:
|