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
Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
Target: x86_64-apple-darwin19.6.0
macOS Catalina 10.15.7 (19H2)
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Sub-task, Parser
Assignee
None
Priority
Medium
md5: cf3d19a6bf0d324edf805a84dc3b622c
Parent-Task:
SR-14407 ☂️ Inconsistent behavior between sugared types and desugared types
Issue Description:
Within functions, the Optional "?" sugar for nested types (for example, Optional<String>.Publisher is the same as String?.Publisher) compiles and runs as intended within functions, but not outside them:
import Combine
func foo(){print(type(of:String?.Publisher.self))// Compiles, runs, prints `Publisher.Type``}foo()typealiasBar=Optional<String>.Publisher// CompilestypealiasBaz=String?.Publisher // Error: Consecutive statements on a line must be separated by ,func hoge()->String?.Publisher {// Error: Consecutive statements on a line must be separated by ,String?.none.publisher
}
The text was updated successfully, but these errors were encountered:
extensionOptional {
typealiasCake = ()
}
typealiasT = Int?.Cake// error: reference to member 'Cake' cannot be resolved without a contextual typetypealiasS = Optional<Int>.Cake
Seems like a common theme with type resolution and sugar
extensionArray {
typealiasCake = String
}
extensionDictionary {
typealiasCake = String
}
typealiasAT = [Int].Cake// error: reference to member 'Cake' cannot be resolved without a contextual typetypealiasAC = Array<Int>.CaketypealiasDT = [Int: Int].Cake// error: reference to member 'Cake' cannot be resolved without a contextual typetypealiasDC = Dictionary<Int, Int>.Cake
I'm not sure that fixing this requires language evolution process, but at least, the document should be updated.
Also, for implementing it we need to introduce something like `MemberTypeRepr` and obsolete `CompoundIdentTypeRepr`
Environment
Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
Target: x86_64-apple-darwin19.6.0
macOS Catalina 10.15.7 (19H2)
Additional Detail from JIRA
md5: cf3d19a6bf0d324edf805a84dc3b622c
Parent-Task:
Issue Description:
Within functions, the Optional "?" sugar for nested types (for example,
Optional<String>.Publisher
is the same asString?.Publisher
) compiles and runs as intended within functions, but not outside them:The text was updated successfully, but these errors were encountered: