mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Avoid symbolic witnesses for .Self in an impl decl (#7564)
Point symbolic witnesses into `.Self` written inside an impl decl at the impl that is being declared. This is tricky because the impl does not yet exist. So we use a new instruction `ImplSelfWitness` which _will_ be replaced by the `ImplWitness` once it becomes available. The `ImplSelfWitness` acts like a symbolic witness, except it does not perform lookup, since we know which impl we will get a witness from. This prevents us from finding other impls when performing lookups into `.Self` in an impl decl, which produces incorrect/incoherent results.
This commit is contained in:
+6
-6
@@ -44,13 +44,13 @@ fn H() {
|
||||
// CHECK:STDOUT: ; Function Attrs: nounwind
|
||||
// CHECK:STDOUT: define void @_CH.Main() #0 !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: call void @_CG.Main.c7b5696da1f8b34f(), !dbg !7
|
||||
// CHECK:STDOUT: call void @_CG.Main.726001587f235b1b(), !dbg !8
|
||||
// CHECK:STDOUT: call void @_CG.Main.20ca60fb00b19f60(), !dbg !7
|
||||
// CHECK:STDOUT: call void @_CG.Main.af98d350d462566f(), !dbg !8
|
||||
// CHECK:STDOUT: ret void, !dbg !9
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; Function Attrs: nounwind
|
||||
// CHECK:STDOUT: define linkonce_odr void @_CG.Main.c7b5696da1f8b34f() #0 !dbg !10 {
|
||||
// CHECK:STDOUT: define linkonce_odr void @_CG.Main.20ca60fb00b19f60() #0 !dbg !10 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %_.var = alloca ptr, align 8, !dbg !11
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !11
|
||||
@@ -59,7 +59,7 @@ fn H() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; Function Attrs: nounwind
|
||||
// CHECK:STDOUT: define linkonce_odr void @_CG.Main.726001587f235b1b() #0 !dbg !13 {
|
||||
// CHECK:STDOUT: define linkonce_odr void @_CG.Main.af98d350d462566f() #0 !dbg !13 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %_.var = alloca ptr, align 8, !dbg !14
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !14
|
||||
@@ -89,10 +89,10 @@ fn H() {
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 36, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 37, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 35, column: 1, scope: !4)
|
||||
// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.c7b5696da1f8b34f", scope: null, file: !1, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !0)
|
||||
// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.20ca60fb00b19f60", scope: null, file: !1, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !0)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 23, column: 3, scope: !10)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 22, column: 1, scope: !10)
|
||||
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.726001587f235b1b", scope: null, file: !1, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !0)
|
||||
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.af98d350d462566f", scope: null, file: !1, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !0)
|
||||
// CHECK:STDOUT: !14 = !DILocation(line: 23, column: 3, scope: !13)
|
||||
// CHECK:STDOUT: !15 = !DILocation(line: 22, column: 1, scope: !13)
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user