swift
swift copied to clipboard
[SR-2577] Extension of [non-generic] Objective-C class that defines throwing function returning `Int8`/`Int16`/`Int32`/`Int64` crashes the compiler
| Previous ID | SR-2577 |
| Radar | None |
| Original Reporter | @jadengeller |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Attachment: Download
Environment
Xcode 8 GM Swift 3
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, CompilerCrash |
| Assignee | None |
| Priority | Medium |
md5: 1670cede88e0e6d827bda8acf9c8f26b
Issue Description:
extension NSFoo {
func bar() throws -> Int8 {
return 0
}
}
Workaround: Mark `@nonobjc`.
I think @DougGregor just fixed this.
What's the reason it crashes for those specific types, but not others (`Int` for example)?
I believe it crashes for native Swift types that are @objc-compatible but not bridged to a reference type. (Int is bridged to NSNumber.)
Yes, just fixed here:
https://github.com/apple/swift/commit/8358d3ce80254af1366b9d622cadf6e0f6af0361