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
The following code compiles in Swift 5.1 but fails in 5.2. I'm not sure if the compiler was supposed to allow this before, so I'm filing a bug to make sure.
classParent{enumInner{staticletconstantP="P"}}classChild:Parent{enumInner{staticletconstantC="C"}staticfunc foo(){print(Inner.constantC)// OKprint(Inner.constantP)// Type 'Child.Inner' has no member 'constantP'print(Parent.Inner.constantP)// OK}}
The text was updated successfully, but these errors were encountered:
The original behavior would look in every superclass for a nested type of that name, but it would also diagnose an ambiguity if multiple such nested types defined the same member. See https://bugs.swift.org/browse/SR-3492.
My fix for that problem was perhaps too heavy-handed; we still search the superclass chain for the nested type, but a nested type in a subclass now shadows a nested type with the same name defined in a superclass.
I'm not sure if its worth tweaking this behavior further at this point; in any case, I'm going to dupe the bug to https://bugs.swift.org/browse/SR-12137 and ping some core team members there to decide what the best course of action is.
Environment
Swift 5.2 (both Xcode 11.4 beta 2 and 2020-02-23 dev toolchains)
Additional Detail from JIRA
md5: ac3fbd3ed2f30ea89ec7a06e83f06d6f
duplicates:
Issue Description:
The following code compiles in Swift 5.1 but fails in 5.2. I'm not sure if the compiler was supposed to allow this before, so I'm filing a bug to make sure.
The text was updated successfully, but these errors were encountered: