// 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 // // 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/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[self: Self](); } impl () as I { fn G[self: Self]() {} } ().(I.G)(); } // CHECK:STDOUT: --- local.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %pattern_type.744: type = pattern_type %Self.as_type [symbolic] // CHECK:STDOUT: %G.type.bff: type = fn_type @G.1 [concrete] // CHECK:STDOUT: %G.f0a: %G.type.bff = struct_value () [concrete] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete] // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%G.decl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @F.%I.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %G.type.c84: type = fn_type @G.2 [concrete] // CHECK:STDOUT: %G.5a2: %G.type.c84 = struct_value () [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_tuple.type, (%I.impl_witness) [concrete] // CHECK:STDOUT: %.ba5: type = fn_type_with_self_type %G.type.bff, %I.facet [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = 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 [concrete = constants.%G.f0a] { // CHECK:STDOUT: %self.patt: @G.1.%pattern_type (%pattern_type.744) = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: @G.1.%pattern_type (%pattern_type.744) = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: @G.1.%Self.as_type.loc16_16.1 (%Self.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc16_16.1: type = splice_block %.loc16_16.2 [symbolic = %Self.as_type.loc16_16.1 (constants.%Self.as_type)] { // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %Self.as_type.loc16_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc16_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: %.loc16_16.2: type = converted %Self.ref, %Self.as_type.loc16_16.2 [symbolic = %Self.as_type.loc16_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %self: @G.1.%Self.as_type.loc16_16.1 (%Self.as_type) = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %G.decl [concrete = 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: %.loc18_9.2 as %I.ref { // CHECK:STDOUT: %G.decl: %G.type.c84 = fn_decl @G.2 [concrete = constants.%G.5a2] { // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: %empty_tuple.type = value_param call_param0 // CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%.loc18_9.2 [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %self: %empty_tuple.type = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: witness = @F.%I.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @impl [concrete] {} { // CHECK:STDOUT: %.loc18_9.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc18_9.2: type = converted %.loc18_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.ref: type = name_ref I, @F.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%G.decl), @impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] // CHECK:STDOUT: %.loc21_4.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %G.ref: %I.assoc_type = name_ref G, @I.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.ba5 = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%G.5a2] // CHECK:STDOUT: %bound_method: = bound_method %.loc21_4.1, %impl.elem0 // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc21_4.2: %empty_tuple.type = converted %.loc21_4.1, %empty_tuple [concrete = constants.%empty_tuple] // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%.loc21_4.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G.1(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %Self.as_type.loc16_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc16_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc16_16.1 [symbolic = %pattern_type (constants.%pattern_type.744)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%self.param: @G.1.%Self.as_type.loc16_16.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G.2(%self.param: %empty_tuple.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G.1(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %Self.as_type.loc16_16.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.744 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G.1(constants.%I.facet) { // CHECK:STDOUT: %Self => constants.%I.facet // CHECK:STDOUT: %Self.as_type.loc16_16.1 => constants.%empty_tuple.type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.cb1 // CHECK:STDOUT: } // CHECK:STDOUT: