mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:44:55 +01:00
Track the instruction used to name the type and constraint in an impl. (#4368)
This is necessary in order to have access to the specific versions of their constant values in a generic impl. Stub out impl deduction.
This commit is contained in:
@@ -61,7 +61,7 @@ class C {
|
||||
// CHECK:STDOUT: witness = (%F.decl)
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl: %C as %.1 {
|
||||
// CHECK:STDOUT: impl @impl: %C.ref as %I.ref {
|
||||
// CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {}
|
||||
// CHECK:STDOUT: %.loc21: <witness> = interface_witness (%F.decl) [template = constants.%.5]
|
||||
// CHECK:STDOUT:
|
||||
@@ -98,7 +98,7 @@ class C {
|
||||
// CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c
|
||||
// CHECK:STDOUT: %I.ref: type = name_ref I, @C.%I.decl [template = constants.%.1]
|
||||
// CHECK:STDOUT: %F.ref: %.3 = name_ref F, @I.%.loc14 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc17: %F.type.1 = interface_witness_access @impl.%.loc21, element0 [template = constants.%F.2]
|
||||
// CHECK:STDOUT: %.loc17: %F.type.1 = interface_witness_access constants.%.5, element0 [template = constants.%F.2]
|
||||
// CHECK:STDOUT: %F.call: init %.2 = call %.loc17()
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -204,14 +204,14 @@ fn G(T:! Generic(B)) {
|
||||
// CHECK:STDOUT: interface;
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.1: %C as %.8 {
|
||||
// CHECK:STDOUT: impl @impl.1: %Self.ref as %.loc14_17 {
|
||||
// CHECK:STDOUT: %.loc14_21: <witness> = interface_witness () [template = constants.%.9]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = %.loc14_21
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.2: %C as %.10 {
|
||||
// CHECK:STDOUT: impl @impl.2: %Self.ref as %.loc15_22 {
|
||||
// CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {
|
||||
// CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
|
||||
// CHECK:STDOUT: %return: ref %X = var <return slot>
|
||||
@@ -232,11 +232,13 @@ fn G(T:! Generic(B)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @C {
|
||||
// CHECK:STDOUT: impl_decl @impl.1 [template] {} {
|
||||
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
|
||||
// CHECK:STDOUT: %Simple.ref: %Simple.type = name_ref Simple, file.%Simple.decl [template = constants.%Simple]
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %.loc14_17: type = interface_type @Simple, @Simple(constants.%C) [template = constants.%.8]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: impl_decl @impl.2 [template] {} {
|
||||
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
|
||||
// CHECK:STDOUT: %WithAssocFn.ref: %WithAssocFn.type = name_ref WithAssocFn, file.%WithAssocFn.decl [template = constants.%WithAssocFn]
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %.loc15_22: type = interface_type @WithAssocFn, @WithAssocFn(constants.%C) [template = constants.%.10]
|
||||
|
||||
@@ -161,7 +161,7 @@ impl C as AddWith(C) {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl: %C as %.7 {
|
||||
// CHECK:STDOUT: impl @impl: %C.ref.loc7_6 as %.loc7_18 {
|
||||
// CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {}
|
||||
// CHECK:STDOUT: %.loc7_22: <witness> = interface_witness (%F.decl) [template = constants.%.10]
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -206,35 +206,35 @@ interface A(T: type) {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.1: %X as %.1 {
|
||||
// CHECK:STDOUT: impl @impl.1: %X.ref as %NotGenericNoParams.ref {
|
||||
// CHECK:STDOUT: %.loc14: <witness> = interface_witness () [template = constants.%.10]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = %.loc14
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.2: %X as %.3 {
|
||||
// CHECK:STDOUT: impl @impl.2: %X.ref as %.loc15_30 {
|
||||
// CHECK:STDOUT: %.loc15_33: <witness> = interface_witness () [template = constants.%.10]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = %.loc15_33
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.3: %X as %.11 {
|
||||
// CHECK:STDOUT: impl @impl.3: %X.ref.loc16_6 as %.loc16_27 {
|
||||
// CHECK:STDOUT: %.loc16_31: <witness> = interface_witness () [template = constants.%.10]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = %.loc16_31
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.4: %X as %.5 {
|
||||
// CHECK:STDOUT: impl @impl.4: %X.ref.loc17_6 as %GenericNoParams.ref {
|
||||
// CHECK:STDOUT: %.loc17: <witness> = interface_witness () [template = constants.%.10]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = %.loc17
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.5: %X as %.13 {
|
||||
// CHECK:STDOUT: impl @impl.5: %X.ref.loc18_6 as %.loc18_32 {
|
||||
// CHECK:STDOUT: %.loc18_36: <witness> = interface_witness () [template = constants.%.10]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
|
||||
@@ -38,7 +38,7 @@ impl library "[[@TEST_NAME]]";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @A;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl: %.2 as %.1;
|
||||
// CHECK:STDOUT: impl @impl: %.loc3_7.2 as %A.ref;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- a.impl.carbon
|
||||
// CHECK:STDOUT:
|
||||
@@ -48,12 +48,14 @@ impl library "[[@TEST_NAME]]";
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %import_ref = import_ref Main//a, inst+1, unloaded
|
||||
// CHECK:STDOUT: %import_ref.1 = import_ref Main//a, inst+1, unloaded
|
||||
// CHECK:STDOUT: %import_ref.2: type = import_ref Main//a, inst+5, loaded [template = constants.%.2]
|
||||
// CHECK:STDOUT: %import_ref.3: type = import_ref Main//a, inst+6, loaded [template = constants.%.1]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .A = imports.%import_ref
|
||||
// CHECK:STDOUT: .A = imports.%import_ref.1
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %default.import.loc1_6.1 = import <invalid>
|
||||
// CHECK:STDOUT: %default.import.loc1_6.2 = import <invalid>
|
||||
@@ -61,5 +63,5 @@ impl library "[[@TEST_NAME]]";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @A;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl: %.2 as %.1;
|
||||
// CHECK:STDOUT: impl @impl: imports.%import_ref.2 as imports.%import_ref.3;
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user