| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- // 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
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/local.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/local.carbon
- fn F() {
- interface I {
- fn G();
- }
- impl () as I {
- fn G() {}
- }
- ().(I.G)();
- }
- // CHECK:STDOUT: --- local.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: %G.type.bff: type = fn_type @G.1 [template]
- // CHECK:STDOUT: %G.f0a: %G.type.bff = struct_value () [template]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%G.decl [template]
- // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%G.decl) [template]
- // CHECK:STDOUT: %G.type.c84: type = fn_type @G.2 [template]
- // CHECK:STDOUT: %G.5a2: %G.type.c84 = struct_value () [template]
- // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_tuple.type, %impl_witness [template]
- // CHECK:STDOUT: %.fbf: type = fn_type_with_self_type %G.type.bff, %I.facet [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
- // CHECK:STDOUT: %G.decl: %G.type.bff = fn_decl @G.1 [template = constants.%G.f0a] {} {}
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %G.decl [template = constants.%assoc0]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .G = %assoc0
- // CHECK:STDOUT: witness = (%G.decl)
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl: %.loc15_9.2 as %I.ref {
- // CHECK:STDOUT: %G.decl: %G.type.c84 = fn_decl @G.2 [template = constants.%G.5a2] {} {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: witness = @F.%impl_witness
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
- // CHECK:STDOUT: impl_decl @impl [template] {} {
- // CHECK:STDOUT: %.loc15_9.1: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: %I.ref: type = name_ref I, @F.%I.decl [template = constants.%I.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%G.decl) [template = constants.%impl_witness]
- // CHECK:STDOUT: %.loc18: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%I.type]
- // CHECK:STDOUT: %G.ref: %I.assoc_type = name_ref G, @I.%assoc0 [template = constants.%assoc0]
- // CHECK:STDOUT: %impl.elem0: %.fbf = impl_witness_access constants.%impl_witness, element0 [template = constants.%G.5a2]
- // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %impl.elem0()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @G.1(@I.%Self: %I.type) {
- // CHECK:STDOUT: fn();
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G.2() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @G.1(constants.%Self) {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @G.1(constants.%I.facet) {}
- // CHECK:STDOUT:
|