New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-4706] Name lookup in nested scopes is too restrictive #47283
Comments
@swift-ci create |
Should all members of X be visible inside the extension as well, or only Y? |
All non-instance members should be visible. What could make Here's another example, just to show how regressive it is: extension Unicode.DefaultScalarView.Index : Comparable {
static func < (lhs: Index, rhs: Index) -> Bool { return lhs < rhs } // error: use of undeclared type 'Index'
static func == (lhs: Index, rhs: Index) -> Bool { return lhs == rhs }
} The smallest version I could get it to eat was: extension Unicode.DefaultScalarView.Index : Comparable {
static func < (
lhs: Unicode.DefaultScalarView<CodeUnits,Encoding>.Index,
rhs: Unicode.DefaultScalarView<CodeUnits,Encoding>.Index
) -> Bool { return lhs < rhs }
static func == (
lhs: Unicode.DefaultScalarView<CodeUnits,Encoding>.Index,
rhs: Unicode.DefaultScalarView<CodeUnits,Encoding>.Index
) -> Bool { return lhs == rhs }
} |
If you use master, then you should be able to write Unicode.DefaultScalarView.Index |
I agree it's verbose though. I'll see if we can change the name lookup rules. |
— If you use master, then you should be able to write Unicode.DefaultScalarView.Index That must be a recent change, because I'm very close to master |
Yes, it's pretty recent. |
Additional Detail from JIRA
md5: 145ae74568a9818327c3395ef2066493
is duplicated by:
relates to:
Issue Description:
This is annoying, and makes nesting less useful than it should be:
we ought to make Y visible without qualification in X.
Not sure if this is formally a defect, but I consider it to be at least a usability bug.
The text was updated successfully, but these errors were encountered: