Xcode 6.3 (6D520o): [Swift] Dictionary/Array initialization using bracket syntax confuses Swift if member type is specified using module name
Originator: | janoschhildebrand | ||
Number: | rdar://19812302 | Date Originated: | 12-Feb-2015 |
Status: | Duplicate of 16849958 (Open) | Resolved: | |
Product: | Developer Tools | Product Version: | Xcode 6.3 (6D520o) |
Classification: | Serious Bug | Reproducible: | Always |
Summary: Specifying a type with the module name (as in Swift.Int) produces compiler errors if used in an Array or Dictionary initializer using the [T] syntax shorthand. For example: let a = [Swift.Int]() error: invalid use of '()' to call a value of non-function type '[Int.Type]' let b = [Swift.Int : Int]() let c = [Int : Swift.Int]() error: unable to infer closure type in the current context error: expected member name or constructor call after type name note: add arguments after the type to construct a value of the type note: use '.self' to reference the type object Steps to Reproduce: Compile the attached swift file Expected Results: The attached swift code should compile successfully Actual Results: Compilation fails Version: Xcode 6.3 (6D520o) Apple Swift version 1.2 (swiftlang-602.0.37.3 clang-602.0.37) OSX 10.10.2 (14C109)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Also a problem with nested types
class ClassA { class ClassB { } } let doesNotCompile = ClassA.ClassB // Fails with the error: error: "invalid use of '()' to call a value of non-function type '[ClassA.ClassB.Type]'"