You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested with: Xcode 11.2.1 (11B53) with the bundled toolchain as well as Swift Development Snapshot 2019-12-04 (a)
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Improvement
Assignee
None
Priority
Medium
md5: 3b4092b1ebd6c8dc3b42aca6f939c4c5
Issue Description:
If a static method of a nested type references an instance member of the outer type, that’s an error. But the error message is somewhat incorrect in that it states that the member “cannot be used on instance of nested type”, even though the use is not in an instance method, but a static method.
The first and second error messages here are correct, but the third one is incorrect:
structOuter {
varx: Intstaticfuncfoo() {
print(x) // Correct error: Instance member 'x' cannot be used on type 'Outer'
}
structInner {
funcbar() {
print(x) // Correct error: Instance member 'x' of type 'Outer' cannot be used on instance of nested type 'Outer.Inner'
}
staticfuncfoo() {
print(x) // Incorrect error: Instance member 'x' of type 'Outer' cannot be used on instance of nested type 'Outer.Inner'
}
}
}
Note: This is not the same issue as SR-5324, but I’m referencing it here because it probably touches the same places in the compiler.
The text was updated successfully, but these errors were encountered:
Environment
Tested with: Xcode 11.2.1 (11B53) with the bundled toolchain as well as Swift Development Snapshot 2019-12-04 (a)
Additional Detail from JIRA
md5: 3b4092b1ebd6c8dc3b42aca6f939c4c5
Issue Description:
If a static method of a nested type references an instance member of the outer type, that’s an error. But the error message is somewhat incorrect in that it states that the member “cannot be used on instance of nested type”, even though the use is not in an instance method, but a static method.
The first and second error messages here are correct, but the third one is incorrect:
Note: This is not the same issue as SR-5324, but I’m referencing it here because it probably touches the same places in the compiler.
The text was updated successfully, but these errors were encountered: