Swift 2b4: Infinite enums should probably be rejected
| Originator: | rix.rob | ||
| Number: | rdar://21926802 | Date Originated: | 21-Jul-2015 04:34 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A165t) |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
Indirect enums are great but still allow construction of infinite types. IMO these should be rejected.
Steps to Reproduce:
1. Compiling this:
indirect enum E { case C(E) }
Expected Results:
should error out because the type is infinite and cannot be constructed
Actual Results:
but it compiles just fine.
Regression:
N/A
Notes:
Technically you can compile a program which constructs an instance of it but since the instance is also infinite it doesn’t work too well:
indirect enum E {
case C(E)
}
func fix<T, U>(f: (T -> U) -> T -> U) -> T -> U {
return { f(fix(f))($0) }
}
let f = fix { e in { E.C(e()) } }
f()
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!