swift icon indicating copy to clipboard operation
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

Open jadengeller opened this issue 10 years ago • 4 comments

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`.

jadengeller avatar Sep 08 '16 02:09 jadengeller

I think @DougGregor just fixed this.

belkadan avatar Sep 08 '16 02:09 belkadan

What's the reason it crashes for those specific types, but not others (`Int` for example)?

jadengeller avatar Sep 08 '16 02:09 jadengeller

I believe it crashes for native Swift types that are @objc-compatible but not bridged to a reference type. (Int is bridged to NSNumber.)

belkadan avatar Sep 08 '16 04:09 belkadan