// 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/interface/local.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/local.carbon fn F() { interface I { fn G[self: Self](); } impl () as I { fn G[unused 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 = symbolic_binding Self, 0 [symbolic] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %pattern_type.dc8: type = pattern_type %Self.as_type [symbolic] // CHECK:STDOUT: %I.WithSelf.G.type.488: type = fn_type @I.WithSelf.G, @I.WithSelf(%Self) [symbolic] // CHECK:STDOUT: %I.WithSelf.G.6c4: %I.WithSelf.G.type.488 = 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.G.decl [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @empty_tuple.type.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple.type.as.I.impl.G.type: type = fn_type @empty_tuple.type.as.I.impl.G [concrete] // CHECK:STDOUT: %empty_tuple.type.as.I.impl.G: %empty_tuple.type.as.I.impl.G.type = struct_value () [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_tuple.type, (%I.impl_witness) [concrete] // CHECK:STDOUT: %I.WithSelf.G.type.4f5: type = fn_type @I.WithSelf.G, @I.WithSelf(%I.facet) [concrete] // CHECK:STDOUT: %I.WithSelf.G.5a3: %I.WithSelf.G.type.4f5 = struct_value () [concrete] // CHECK:STDOUT: %.0ea: type = fn_type_with_self_type %I.WithSelf.G.type.4f5, %I.facet [concrete] // CHECK:STDOUT: %empty_tuple.type.as.I.impl.G.bound: = bound_method %empty_tuple, %empty_tuple.type.as.I.impl.G [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 = 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.G.decl: @I.WithSelf.%I.WithSelf.G.type (%I.WithSelf.G.type.488) = fn_decl @I.WithSelf.G [symbolic = @I.WithSelf.%I.WithSelf.G (constants.%I.WithSelf.G.6c4)] { // CHECK:STDOUT: %self.param_patt: @I.WithSelf.G.%pattern_type (%pattern_type.dc8) = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt: @I.WithSelf.G.%pattern_type (%pattern_type.dc8) = at_binding_pattern self, %self.param_patt [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: @I.WithSelf.G.%Self.as_type.loc17_16.1 (%Self.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc17_16.1: type = splice_block %.loc17_16.2 [symbolic = %Self.as_type.loc17_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.loc17_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc17_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: %.loc17_16.2: type = converted %Self.ref, %Self.as_type.loc17_16.2 [symbolic = %Self.as_type.loc17_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %self: @I.WithSelf.G.%Self.as_type.loc17_16.1 (%Self.as_type) = value_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.WithSelf.G.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .G = @I.WithSelf.%assoc0 // CHECK:STDOUT: witness = (@I.WithSelf.%I.WithSelf.G.decl) // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc19_9.2 as %I.ref { // CHECK:STDOUT: %empty_tuple.type.as.I.impl.G.decl: %empty_tuple.type.as.I.impl.G.type = fn_decl @empty_tuple.type.as.I.impl.G [concrete = constants.%empty_tuple.type.as.I.impl.G] { // CHECK:STDOUT: %self.param_patt: %pattern_type.cb1 = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt: %pattern_type.cb1 = at_binding_pattern self, %self.param_patt [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: %empty_tuple.type = value_param call_param0 // CHECK:STDOUT: %Self.ref: type = name_ref Self, @empty_tuple.type.as.I.impl.%.loc19_9.2 [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %self: %empty_tuple.type = value_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%empty_tuple.type.as.I.impl.G.decl), @empty_tuple.type.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .G = %empty_tuple.type.as.I.impl.G.decl // CHECK:STDOUT: witness = %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 @empty_tuple.type.as.I.impl [concrete] {} { // CHECK:STDOUT: %.loc19_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc19_9.2: type = converted %.loc19_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: %.loc22_4.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // 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.WithSelf.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.0ea = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%empty_tuple.type.as.I.impl.G] // CHECK:STDOUT: %bound_method: = bound_method %.loc22_4.1, %impl.elem0 [concrete = constants.%empty_tuple.type.as.I.impl.G.bound] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc22_4.2: %empty_tuple.type = converted %.loc22_4.1, %empty_tuple [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple.type.as.I.impl.G.call: init %empty_tuple.type = call %bound_method(%.loc22_4.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @I.WithSelf.G(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %Self.as_type.loc17_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc17_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc17_16.1 [symbolic = %pattern_type (constants.%pattern_type.dc8)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%self.param: @I.WithSelf.G.%Self.as_type.loc17_16.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @empty_tuple.type.as.I.impl.G(%self.param: %empty_tuple.type) { // CHECK:STDOUT: !entry: // 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.G.type => constants.%I.WithSelf.G.type.488 // CHECK:STDOUT: %I.WithSelf.G => constants.%I.WithSelf.G.6c4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf.G(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %Self.as_type.loc17_16.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.dc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%I.facet) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Self => constants.%I.facet // CHECK:STDOUT: %I.WithSelf.G.type => constants.%I.WithSelf.G.type.4f5 // CHECK:STDOUT: %I.WithSelf.G => constants.%I.WithSelf.G.5a3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf.G(constants.%I.facet) { // CHECK:STDOUT: %Self => constants.%I.facet // CHECK:STDOUT: %Self.as_type.loc17_16.1 => constants.%empty_tuple.type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.cb1 // CHECK:STDOUT: } // CHECK:STDOUT: