mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Support unqualified lookup into extended interfaces from classes and impls (#7217)
When a class extends an interface, referring to a member name of the interface as an unqualified name should refer to the class's corresponding associated entity value, not to the associated entity itself. Similarly, in an `impl`, unqualified names of associated entities should refer to the `impl`'s corresponding value for that entity. To support this, we treat `impl`s as `extend`ing their implemented facet type, and we make lookups into an extended facet type use the `Self` type of the extending `impl` or `class` if lookup finds an associated entity. We already did the latter if the extending entity was an interface; this extends the existing support for these other cases.
This commit is contained in:
@@ -359,6 +359,8 @@ fn CallIndirect() {
|
||||
// CHECK:STDOUT: .T = <poisoned>
|
||||
// CHECK:STDOUT: .T = <poisoned>
|
||||
// CHECK:STDOUT: .F = @A.WithSelf.%assoc0.loc6_41.1
|
||||
// CHECK:STDOUT: .X = <poisoned>
|
||||
// CHECK:STDOUT: .Y = <poisoned>
|
||||
// CHECK:STDOUT: witness = (@A.WithSelf.%A.WithSelf.F.decl)
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !requires:
|
||||
@@ -401,6 +403,7 @@ fn CallIndirect() {
|
||||
// CHECK:STDOUT: .X = <poisoned>
|
||||
// CHECK:STDOUT: .Y = <poisoned>
|
||||
// CHECK:STDOUT: .F = %Y.as.A.impl.F.decl
|
||||
// CHECK:STDOUT: extend %A.type
|
||||
// CHECK:STDOUT: witness = %A.impl_witness
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -1085,6 +1088,9 @@ fn CallIndirect() {
|
||||
// CHECK:STDOUT: .T = <poisoned>
|
||||
// CHECK:STDOUT: .T = <poisoned>
|
||||
// CHECK:STDOUT: .F = @A.WithSelf.%assoc0.loc6_39.1
|
||||
// CHECK:STDOUT: .W = <poisoned>
|
||||
// CHECK:STDOUT: .V1 = <poisoned>
|
||||
// CHECK:STDOUT: .V2 = <poisoned>
|
||||
// CHECK:STDOUT: witness = (@A.WithSelf.%A.WithSelf.F.decl)
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !requires:
|
||||
@@ -1141,6 +1147,7 @@ fn CallIndirect() {
|
||||
// CHECK:STDOUT: .V1 = <poisoned>
|
||||
// CHECK:STDOUT: .V2 = <poisoned>
|
||||
// CHECK:STDOUT: .F = %tuple.type.as.A.impl.F.decl
|
||||
// CHECK:STDOUT: extend %A.type.loc14_61.2
|
||||
// CHECK:STDOUT: witness = %A.impl_witness.loc14_63.1
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user