mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 10:31:04 +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:
@@ -95,12 +95,7 @@ alias N.F2 = F1;
|
||||
// CHECK:STDERR:
|
||||
fn N.F1();
|
||||
|
||||
// Failure: `N.F1` used after declaration failed.
|
||||
// TODO: #4622 - Allow defining a poisoned name so it would be found if used after it's declared.
|
||||
// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+4]]:14: error: member name `F1` not found in `N` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: alias N.F3 = N.F1;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
// Don't produce an additional diagnostic here.
|
||||
alias N.F3 = N.F1;
|
||||
|
||||
// --- fail_poison_multiple_scopes.carbon
|
||||
|
||||
Reference in New Issue
Block a user