Swift 1.2b1: Swift can’t misunderstands scope resolution with modules of the same name as stdlb symbols
| Originator: | rix.rob | ||
| Number: | rdar://19774567 | Date Originated: | 09-Feb-2015 07:39 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-Beta (6D520o) |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary:
I have a framework named Set, now partly redundant due to the existence of Set<T> in the stdlib. I’m getting loads of bogus “Cannot specialize a non-generic definition” errors now.
Steps to Reproduce:
1. Make a framework named Set, with a generic type named Set<T> in it.
2. Compile the following code in another module importing Set:
println(Swift.Set<Int>.self)
println(Set.Set<Int>.self)
println(Set<Int>.self)
Expected Results:
I expected it to compile correctly, perhaps griping about the third one because of ambiguity (but ideally not since I’m explicitly importing Set above this).
Actual Results:
/Users/rob/Developer/Projects/Swift/Set/SetTests/SetPrintableTests.swift:11:15: error: cannot specialize a non-generic definition
println(Set.Set<Int>.self)
^
/Users/rob/Developer/Projects/Swift/Set/SetTests/SetPrintableTests.swift:11:18: note: while parsing this '<' as a type parameter bracket
println(Set.Set<Int>.self)
^
/Users/rob/Developer/Projects/Swift/Set/SetTests/SetPrintableTests.swift:12:11: error: cannot specialize a non-generic definition
println(Set<Int>.self)
^
/Users/rob/Developer/Projects/Swift/Set/SetTests/SetPrintableTests.swift:12:14: note: while parsing this '<' as a type parameter bracket
println(Set<Int>.self)
^
Regression:
My Box framework, containing a generic type Box<T>, does not have this problem when used via its tests.
Notes:
I get the same error with:
println(Set.Multiset<Int>.self)
/Users/rob/Developer/Projects/Swift/Set/SetTests/SetPrintableTests.swift:10:15: error: cannot specialize a non-generic definition
println(Set.Multiset<Int>.self)
^
/Users/rob/Developer/Projects/Swift/Set/SetTests/SetPrintableTests.swift:10:23: note: while parsing this '<' as a type parameter bracket
println(Set.Multiset<Int>.self)
^
So it seems to be having trouble resolving Set correctly.
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!