Fix cross-package signature mismatches. (#7232)

Fixes link failures when referencing a symbol involving a fingerprint
from a different package.

Previously we included the `Namespace`'s `import_id` as part of its
fingerprint, which caused local and imported namespaces to get different
fingerprints. We now store the `import_id` on the `NameScope` instead of
on the `Namespace` inst to avoid this problem.

Also, when we reach a package-level `NameScopeId`, consistently
fingerprint it as a (package name, library name) pair. Previously the
fingerprinting depended on whether it was imported or not, as an
imported `NameScopeId` had a parent scope (the current package). We need
to include the library name here so that private entities with the same
name in different libraries have different fingerprints.
This commit is contained in:
Richard Smith
2026-05-21 00:02:29 +00:00
committed by GitHub
parent 1231098c14
commit 05cc09daca
662 changed files with 51181 additions and 50920 deletions
+11 -11
View File
@@ -45,20 +45,20 @@ fn G() {
// CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
// CHECK:STDOUT: %F.cpp_overload_set.type: type = cpp_overload_set_type @F.cpp_overload_set [concrete]
// CHECK:STDOUT: %F.cpp_overload_set.value: %F.cpp_overload_set.type = cpp_overload_set_value @F.cpp_overload_set [concrete]
// CHECK:STDOUT: %.4f0: type = class_type @.1 [concrete]
// CHECK:STDOUT: %int_1.81a: %.4f0 = int_value 1 [concrete]
// CHECK:STDOUT: %.dcc: type = class_type @.1 [concrete]
// CHECK:STDOUT: %int_1.0f6: %.dcc = int_value 1 [concrete]
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %C: type = class_type @C [concrete]
// CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
// CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
// CHECK:STDOUT: %ptr.dbb: type = ptr_type %C [concrete]
// CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
// CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
// CHECK:STDOUT: %C.F.cpp_overload_set.type: type = cpp_overload_set_type @C.F.cpp_overload_set [concrete]
// CHECK:STDOUT: %C.F.cpp_overload_set.value: %C.F.cpp_overload_set.type = cpp_overload_set_value @C.F.cpp_overload_set [concrete]
// CHECK:STDOUT: %.bb7: type = class_type @.2 [concrete]
// CHECK:STDOUT: %int_1.1d6: %.bb7 = int_value 1 [concrete]
// CHECK:STDOUT: %.fd8: type = class_type @.2 [concrete]
// CHECK:STDOUT: %int_1.ea9: %.fd8 = int_value 1 [concrete]
// CHECK:STDOUT: %C.F.type: type = fn_type @C.F [concrete]
// CHECK:STDOUT: %C.F: %C.F.type = struct_value () [concrete]
// CHECK:STDOUT: %C.cpp_destructor.type: type = fn_type @C.cpp_destructor [concrete]
@@ -68,12 +68,12 @@ fn G() {
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .F = %F.cpp_overload_set.value
// CHECK:STDOUT: .b = %int_1.81a
// CHECK:STDOUT: .b = %int_1.0f6
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.cpp_overload_set.value: %F.cpp_overload_set.type = cpp_overload_set_value @F.cpp_overload_set [concrete = constants.%F.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.81a: %.4f0 = int_value 1 [concrete = constants.%int_1.81a]
// CHECK:STDOUT: %int_1.0f6: %.dcc = int_value 1 [concrete = constants.%int_1.0f6]
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: } {
@@ -87,7 +87,7 @@ fn G() {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.F.cpp_overload_set.value: %C.F.cpp_overload_set.type = cpp_overload_set_value @C.F.cpp_overload_set [concrete = constants.%C.F.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.1d6: %.bb7 = int_value 1 [concrete = constants.%int_1.1d6]
// CHECK:STDOUT: %int_1.ea9: %.fd8 = int_value 1 [concrete = constants.%int_1.ea9]
// CHECK:STDOUT: %C.F.decl: %C.F.type = fn_decl @C.F [concrete = constants.%C.F] {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: } {
@@ -104,13 +104,13 @@ fn G() {
// CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %F.ref.loc8: %F.cpp_overload_set.type = name_ref F, imports.%F.cpp_overload_set.value [concrete = constants.%F.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc8_9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %b.ref: %.4f0 = name_ref b, imports.%int_1.81a [concrete = constants.%int_1.81a]
// CHECK:STDOUT: %b.ref: %.dcc = name_ref b, imports.%int_1.0f6 [concrete = constants.%int_1.0f6]
// CHECK:STDOUT: %F.call: init %empty_tuple.type = call imports.%F.decl(%b.ref)
// CHECK:STDOUT: %Cpp.ref.loc10_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %C.ref.loc10_6: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %C.ref.loc10_8: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
// CHECK:STDOUT: %.loc10_11.1: ref %C = temporary_storage
// CHECK:STDOUT: %addr: %ptr.d9e = addr_of %.loc10_11.1
// CHECK:STDOUT: %addr: %ptr.dbb = addr_of %.loc10_11.1
// CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr)
// CHECK:STDOUT: %.loc10_11.2: init %C to %.loc10_11.1 = mark_in_place_init %C__carbon_thunk.call
// CHECK:STDOUT: %.loc10_11.3: ref %C = temporary %.loc10_11.1, %.loc10_11.2
@@ -118,7 +118,7 @@ fn G() {
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc10_11.3, %F.ref.loc10
// CHECK:STDOUT: %Cpp.ref.loc10_15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %C.ref.loc10_18: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %e.ref: %.bb7 = name_ref e, imports.%int_1.1d6 [concrete = constants.%int_1.1d6]
// CHECK:STDOUT: %e.ref: %.fd8 = name_ref e, imports.%int_1.ea9 [concrete = constants.%int_1.ea9]
// CHECK:STDOUT: %.loc10_11.4: %C = acquire_value %.loc10_11.3
// CHECK:STDOUT: %C.F.call: init %empty_tuple.type = call imports.%C.F.decl(%.loc10_11.4, %e.ref)
// CHECK:STDOUT: %C.cpp_destructor.bound: <bound method> = bound_method %.loc10_11.3, constants.%C.cpp_destructor
+37 -37
View File
@@ -92,30 +92,30 @@ fn F() {
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
// CHECK:STDOUT: %pattern_type.0cb: type = pattern_type %i16 [concrete]
// CHECK:STDOUT: %Enum: type = class_type @Enum [concrete]
// CHECK:STDOUT: %int_0.420: %Enum = int_value 0 [concrete]
// CHECK:STDOUT: %int_0.320: %i16 = int_value 0 [concrete]
// CHECK:STDOUT: %pattern_type.ebf: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %int_0.779: %Enum = int_value 0 [concrete]
// CHECK:STDOUT: %int_0.713: %i16 = int_value 0 [concrete]
// CHECK:STDOUT: %pattern_type.9f7: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %int_42.20e: Core.IntLiteral = int_value 42 [concrete]
// CHECK:STDOUT: %As.type.359: type = facet_type <@As, @As(%i16)> [concrete]
// CHECK:STDOUT: %As.type.457: type = facet_type <@As, @As(%i16)> [concrete]
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.38c: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.8f0: %Core.IntLiteral.as.As.impl.Convert.type.38c = struct_value () [symbolic]
// CHECK:STDOUT: %As.impl_witness.e74: <witness> = impl_witness imports.%As.impl_witness_table.2cc, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.ae5: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.e16: %Core.IntLiteral.as.As.impl.Convert.type.ae5 = struct_value () [concrete]
// CHECK:STDOUT: %As.facet: %As.type.359 = facet_value Core.IntLiteral, (%As.impl_witness.e74) [concrete]
// CHECK:STDOUT: %As.WithSelf.Convert.type.f92: type = fn_type @As.WithSelf.Convert, @As.WithSelf(%i16, %As.facet) [concrete]
// CHECK:STDOUT: %.a72: type = fn_type_with_self_type %As.WithSelf.Convert.type.f92, %As.facet [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.As.impl.Convert.e16 [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.e16, @Core.IntLiteral.as.As.impl.Convert(%int_16) [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.fc5: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.3a8: %Core.IntLiteral.as.As.impl.Convert.type.fc5 = struct_value () [symbolic]
// CHECK:STDOUT: %As.impl_witness.bca: <witness> = impl_witness imports.%As.impl_witness_table.2e6, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.36d: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.036: %Core.IntLiteral.as.As.impl.Convert.type.36d = struct_value () [concrete]
// CHECK:STDOUT: %As.facet: %As.type.457 = facet_value Core.IntLiteral, (%As.impl_witness.bca) [concrete]
// CHECK:STDOUT: %As.WithSelf.Convert.type.9f1: type = fn_type @As.WithSelf.Convert, @As.WithSelf(%i16, %As.facet) [concrete]
// CHECK:STDOUT: %.3ca: type = fn_type_with_self_type %As.WithSelf.Convert.type.9f1, %As.facet [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.As.impl.Convert.036 [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.036, @Core.IntLiteral.as.As.impl.Convert(%int_16) [concrete]
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_42.a0e: %i16 = int_value 42 [concrete]
// CHECK:STDOUT: %int_42.c3a: %Enum = int_value 42 [concrete]
// CHECK:STDOUT: %int_42.50d: %i16 = int_value 42 [concrete]
// CHECK:STDOUT: %int_42.7b3: %Enum = int_value 42 [concrete]
// CHECK:STDOUT: %Other: type = class_type @Other [concrete]
// CHECK:STDOUT: %pattern_type.c06: type = pattern_type %Other [concrete]
// CHECK:STDOUT: %int_0.fa2: %Other = int_value 0 [concrete]
// CHECK:STDOUT: %pattern_type.da8: type = pattern_type %Other [concrete]
// CHECK:STDOUT: %int_0.9f3: %Other = int_value 0 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -126,9 +126,9 @@ fn F() {
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Enum.decl: type = class_decl @Enum [concrete = constants.%Enum] {} {}
// CHECK:STDOUT: %int_0: %Enum = int_value 0 [concrete = constants.%int_0.420]
// CHECK:STDOUT: %Core.import_ref.d74: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.38c) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.8f0)]
// CHECK:STDOUT: %As.impl_witness_table.2cc = impl_witness_table (%Core.import_ref.d74), @Core.IntLiteral.as.As.impl [concrete]
// CHECK:STDOUT: %int_0: %Enum = int_value 0 [concrete = constants.%int_0.779]
// CHECK:STDOUT: %Core.import_ref.6c4: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.fc5) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.3a8)]
// CHECK:STDOUT: %As.impl_witness_table.2e6 = impl_witness_table (%Core.import_ref.6c4), @Core.IntLiteral.as.As.impl [concrete]
// CHECK:STDOUT: %Other.decl: type = class_decl @Other [concrete = constants.%Other] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -139,46 +139,46 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = value_binding_pattern a [concrete]
// CHECK:STDOUT: %a.patt: %pattern_type.0cb = value_binding_pattern a [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc8: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %a.ref.loc8: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.420]
// CHECK:STDOUT: %a.ref.loc8: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.779]
// CHECK:STDOUT: %i16.loc8_37: type = type_literal constants.%i16 [concrete = constants.%i16]
// CHECK:STDOUT: %.loc8_34.1: %i16 = as_compatible %a.ref.loc8 [concrete = constants.%int_0.320]
// CHECK:STDOUT: %.loc8_34.2: %i16 = converted %a.ref.loc8, %.loc8_34.1 [concrete = constants.%int_0.320]
// CHECK:STDOUT: %.loc8_34.1: %i16 = as_compatible %a.ref.loc8 [concrete = constants.%int_0.713]
// CHECK:STDOUT: %.loc8_34.2: %i16 = converted %a.ref.loc8, %.loc8_34.1 [concrete = constants.%int_0.713]
// CHECK:STDOUT: %i16.loc8_17: type = type_literal constants.%i16 [concrete = constants.%i16]
// CHECK:STDOUT: %a: %i16 = value_binding a, %.loc8_34.2
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %b.patt: %pattern_type.ebf = value_binding_pattern b [concrete]
// CHECK:STDOUT: %b.patt: %pattern_type.9f7 = value_binding_pattern b [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42.20e]
// CHECK:STDOUT: %i16.loc9: type = type_literal constants.%i16 [concrete = constants.%i16]
// CHECK:STDOUT: %impl.elem0: %.a72 = impl_witness_access constants.%As.impl_witness.e74, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.e16]
// CHECK:STDOUT: %impl.elem0: %.3ca = impl_witness_access constants.%As.impl_witness.bca, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.036]
// CHECK:STDOUT: %bound_method.loc9_32.1: <bound method> = bound_method %int_42, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_16) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc9_32.2: <bound method> = bound_method %int_42, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i16 = call %bound_method.loc9_32.2(%int_42) [concrete = constants.%int_42.a0e]
// CHECK:STDOUT: %.loc9_32.1: %i16 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_42.a0e]
// CHECK:STDOUT: %.loc9_32.2: %i16 = converted %int_42, %.loc9_32.1 [concrete = constants.%int_42.a0e]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i16 = call %bound_method.loc9_32.2(%int_42) [concrete = constants.%int_42.50d]
// CHECK:STDOUT: %.loc9_32.1: %i16 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_42.50d]
// CHECK:STDOUT: %.loc9_32.2: %i16 = converted %int_42, %.loc9_32.1 [concrete = constants.%int_42.50d]
// CHECK:STDOUT: %Cpp.ref.loc9_43: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc9_46: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %.loc9_40.1: %Enum = as_compatible %.loc9_32.2 [concrete = constants.%int_42.c3a]
// CHECK:STDOUT: %.loc9_40.2: %Enum = converted %.loc9_32.2, %.loc9_40.1 [concrete = constants.%int_42.c3a]
// CHECK:STDOUT: %.loc9_40.1: %Enum = as_compatible %.loc9_32.2 [concrete = constants.%int_42.7b3]
// CHECK:STDOUT: %.loc9_40.2: %Enum = converted %.loc9_32.2, %.loc9_40.1 [concrete = constants.%int_42.7b3]
// CHECK:STDOUT: %.loc9_20: type = splice_block %Enum.ref.loc9_20 [concrete = constants.%Enum] {
// CHECK:STDOUT: %Cpp.ref.loc9_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc9_20: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: }
// CHECK:STDOUT: %b: %Enum = value_binding b, %.loc9_40.2
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %c.patt: %pattern_type.c06 = value_binding_pattern c [concrete]
// CHECK:STDOUT: %c.patt: %pattern_type.da8 = value_binding_pattern c [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc10_29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %a.ref.loc10: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.420]
// CHECK:STDOUT: %a.ref.loc10: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.779]
// CHECK:STDOUT: %Cpp.ref.loc10_38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Other.ref.loc10_41: type = name_ref Other, imports.%Other.decl [concrete = constants.%Other]
// CHECK:STDOUT: %.loc10_35.1: %Other = as_compatible %a.ref.loc10 [concrete = constants.%int_0.fa2]
// CHECK:STDOUT: %.loc10_35.2: %Other = converted %a.ref.loc10, %.loc10_35.1 [concrete = constants.%int_0.fa2]
// CHECK:STDOUT: %.loc10_35.1: %Other = as_compatible %a.ref.loc10 [concrete = constants.%int_0.9f3]
// CHECK:STDOUT: %.loc10_35.2: %Other = converted %a.ref.loc10, %.loc10_35.1 [concrete = constants.%int_0.9f3]
// CHECK:STDOUT: %.loc10_20: type = splice_block %Other.ref.loc10_20 [concrete = constants.%Other] {
// CHECK:STDOUT: %Cpp.ref.loc10_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Other.ref.loc10_20: type = name_ref Other, imports.%Other.decl [concrete = constants.%Other]
+13 -13
View File
@@ -38,18 +38,18 @@ fn F() {
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %Enum: type = class_type @Enum [concrete]
// CHECK:STDOUT: %pattern_type.ebf: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %pattern_type.9f7: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %int_0: %Enum = int_value 0 [concrete]
// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
// CHECK:STDOUT: %Enum.Op.type: type = fn_type @Enum.Op [concrete]
// CHECK:STDOUT: %Enum.Op: %Enum.Op.type = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.0a8: <witness> = custom_witness (%Enum.Op), @Copy [concrete]
// CHECK:STDOUT: %Copy.facet.897: %Copy.type = facet_value %Enum, (%custom_witness.0a8) [concrete]
// CHECK:STDOUT: %Copy.WithSelf.Op.type.67c: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.897) [concrete]
// CHECK:STDOUT: %.76d: type = fn_type_with_self_type %Copy.WithSelf.Op.type.67c, %Copy.facet.897 [concrete]
// CHECK:STDOUT: %Enum.Op.bound.3a0: <bound method> = bound_method %int_0, %Enum.Op [concrete]
// CHECK:STDOUT: %custom_witness.b8d: <witness> = custom_witness (%Enum.Op), @Copy [concrete]
// CHECK:STDOUT: %Copy.facet.ae7: %Copy.type = facet_value %Enum, (%custom_witness.b8d) [concrete]
// CHECK:STDOUT: %Copy.WithSelf.Op.type.100: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.ae7) [concrete]
// CHECK:STDOUT: %.e06: type = fn_type_with_self_type %Copy.WithSelf.Op.type.100, %Copy.facet.ae7 [concrete]
// CHECK:STDOUT: %Enum.Op.bound.7be: <bound method> = bound_method %int_0, %Enum.Op [concrete]
// CHECK:STDOUT: %int_1: %Enum = int_value 1 [concrete]
// CHECK:STDOUT: %Enum.Op.bound.87b: <bound method> = bound_method %int_1, %Enum.Op [concrete]
// CHECK:STDOUT: %Enum.Op.bound.c35: <bound method> = bound_method %int_1, %Enum.Op [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -69,15 +69,15 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.ebf = ref_binding_pattern a [concrete]
// CHECK:STDOUT: %a.var_patt: %pattern_type.ebf = var_pattern %a.patt [concrete]
// CHECK:STDOUT: %a.patt: %pattern_type.9f7 = ref_binding_pattern a [concrete]
// CHECK:STDOUT: %a.var_patt: %pattern_type.9f7 = var_pattern %a.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a.var: ref %Enum = var %a.var_patt
// CHECK:STDOUT: %Cpp.ref.loc12_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc12_24: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %a.ref.loc12: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0]
// CHECK:STDOUT: %impl.elem0.loc12: %.76d = impl_witness_access constants.%custom_witness.0a8, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %a.ref.loc12, %impl.elem0.loc12 [concrete = constants.%Enum.Op.bound.3a0]
// CHECK:STDOUT: %impl.elem0.loc12: %.e06 = impl_witness_access constants.%custom_witness.b8d, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %a.ref.loc12, %impl.elem0.loc12 [concrete = constants.%Enum.Op.bound.7be]
// CHECK:STDOUT: %Enum.Op.call.loc12: init %Enum = call %bound_method.loc12(%a.ref.loc12) [concrete = constants.%int_0]
// CHECK:STDOUT: assign %a.var, %Enum.Op.call.loc12
// CHECK:STDOUT: %.loc12: type = splice_block %Enum.ref.loc12_13 [concrete = constants.%Enum] {
@@ -89,8 +89,8 @@ fn F() {
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc14: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %b.ref: %Enum = name_ref b, imports.%int_1 [concrete = constants.%int_1]
// CHECK:STDOUT: %impl.elem0.loc14: %.76d = impl_witness_access constants.%custom_witness.0a8, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc14: <bound method> = bound_method %b.ref, %impl.elem0.loc14 [concrete = constants.%Enum.Op.bound.87b]
// CHECK:STDOUT: %impl.elem0.loc14: %.e06 = impl_witness_access constants.%custom_witness.b8d, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc14: <bound method> = bound_method %b.ref, %impl.elem0.loc14 [concrete = constants.%Enum.Op.bound.c35]
// CHECK:STDOUT: %Enum.Op.call.loc14: init %Enum = call %bound_method.loc14(%b.ref) [concrete = constants.%int_1]
// CHECK:STDOUT: assign %a.ref.loc14, %Enum.Op.call.loc14
// CHECK:STDOUT: return
+20 -20
View File
@@ -55,31 +55,31 @@ fn F() {
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %Color: type = class_type @Color [concrete]
// CHECK:STDOUT: %pattern_type.839: type = pattern_type %Color [concrete]
// CHECK:STDOUT: %int_0.40a: %Color = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.a8e: %Color = int_value 1 [concrete]
// CHECK:STDOUT: %pattern_type.625: type = pattern_type %Color [concrete]
// CHECK:STDOUT: %int_0.5a5: %Color = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.a87: %Color = int_value 1 [concrete]
// CHECK:STDOUT: %Zoo: type = class_type @Zoo [concrete]
// CHECK:STDOUT: %Animal: type = class_type @Animal [concrete]
// CHECK:STDOUT: %pattern_type.d9d: type = pattern_type %Animal [concrete]
// CHECK:STDOUT: %int_0.83f: %Animal = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.afa: %Animal = int_value 1 [concrete]
// CHECK:STDOUT: %pattern_type.531: type = pattern_type %Animal [concrete]
// CHECK:STDOUT: %int_0.30a: %Animal = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.292: %Animal = int_value 1 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .Color = %Color.decl
// CHECK:STDOUT: .Blue = %int_1.a8e
// CHECK:STDOUT: .Blue = %int_1.a87
// CHECK:STDOUT: .Zoo = %Zoo.decl
// CHECK:STDOUT: .Dog = %int_1.afa
// CHECK:STDOUT: .Dog = %int_1.292
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Color.decl: type = class_decl @Color [concrete = constants.%Color] {} {}
// CHECK:STDOUT: %int_0.40a: %Color = int_value 0 [concrete = constants.%int_0.40a]
// CHECK:STDOUT: %int_1.a8e: %Color = int_value 1 [concrete = constants.%int_1.a8e]
// CHECK:STDOUT: %int_0.5a5: %Color = int_value 0 [concrete = constants.%int_0.5a5]
// CHECK:STDOUT: %int_1.a87: %Color = int_value 1 [concrete = constants.%int_1.a87]
// CHECK:STDOUT: %Zoo.decl: type = class_decl @Zoo [concrete = constants.%Zoo] {} {}
// CHECK:STDOUT: %Animal.decl: type = class_decl @Animal [concrete = constants.%Animal] {} {}
// CHECK:STDOUT: %int_0.83f: %Animal = int_value 0 [concrete = constants.%int_0.83f]
// CHECK:STDOUT: %int_1.afa: %Animal = int_value 1 [concrete = constants.%int_1.afa]
// CHECK:STDOUT: %int_0.30a: %Animal = int_value 0 [concrete = constants.%int_0.30a]
// CHECK:STDOUT: %int_1.292: %Animal = int_value 1 [concrete = constants.%int_1.292]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -89,33 +89,33 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %col.patt: %pattern_type.839 = value_binding_pattern col [concrete]
// CHECK:STDOUT: %col.patt: %pattern_type.625 = value_binding_pattern col [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc18_32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc18_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: %Red.ref: %Color = name_ref Red, imports.%int_0.40a [concrete = constants.%int_0.40a]
// CHECK:STDOUT: %Red.ref: %Color = name_ref Red, imports.%int_0.5a5 [concrete = constants.%int_0.5a5]
// CHECK:STDOUT: %.loc18: type = splice_block %Color.ref.loc18_23 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc18_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc18_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: }
// CHECK:STDOUT: %col: %Color = value_binding col, %Red.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %colb.patt: %pattern_type.839 = value_binding_pattern colb [concrete]
// CHECK:STDOUT: %colb.patt: %pattern_type.625 = value_binding_pattern colb [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc19_33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Blue.ref: %Color = name_ref Blue, imports.%int_1.a8e [concrete = constants.%int_1.a8e]
// CHECK:STDOUT: %Blue.ref: %Color = name_ref Blue, imports.%int_1.a87 [concrete = constants.%int_1.a87]
// CHECK:STDOUT: %.loc19: type = splice_block %Color.ref.loc19 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc19_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc19: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: }
// CHECK:STDOUT: %colb: %Color = value_binding colb, %Blue.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %pet.patt: %pattern_type.d9d = value_binding_pattern pet [concrete]
// CHECK:STDOUT: %pet.patt: %pattern_type.531 = value_binding_pattern pet [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc20_37: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc20_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc20_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: %Cat.ref: %Animal = name_ref Cat, imports.%int_0.83f [concrete = constants.%int_0.83f]
// CHECK:STDOUT: %Cat.ref: %Animal = name_ref Cat, imports.%int_0.30a [concrete = constants.%int_0.30a]
// CHECK:STDOUT: %.loc20: type = splice_block %Animal.ref.loc20_27 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc20_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc20_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
@@ -123,10 +123,10 @@ fn F() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %pet: %Animal = value_binding pet, %Cat.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %pet2.patt: %pattern_type.d9d = value_binding_pattern pet2 [concrete]
// CHECK:STDOUT: %pet2.patt: %pattern_type.531 = value_binding_pattern pet2 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc21_38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dog.ref: %Animal = name_ref Dog, imports.%int_1.afa [concrete = constants.%int_1.afa]
// CHECK:STDOUT: %Dog.ref: %Animal = name_ref Dog, imports.%int_1.292 [concrete = constants.%int_1.292]
// CHECK:STDOUT: %.loc21: type = splice_block %Animal.ref.loc21 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc21_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc21: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]