-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaregood first issueGood for newcomersGood for newcomers
Description
| Previous ID | SR-1894 |
| Radar | None |
| Original Reporter | @belkadan |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, CompilerCrash, StarterBug |
| Assignee | gal (JIRA) |
| Priority | Medium |
md5: 7c3c3d2da857e9ccac5a0aca9b6a8702
Issue Description:
import Foundation
class Test: NSObject {
@objc func foo() -> NSCoding.Protocol { return NSCoding.self }
}
Compiling this with Swift 3 (preview 1) leads to a crash in SILGen trying to emit an ObjC thunk for foo. We should probably just not consider this to be Objective-C-compatible; it doesn't buy us much over just returning Protocol (which works fine, though despite the name it's limited to Objective-C protocols).
Banning this means altering the logic in lib/AST/Type.cpp. There's actually an explicit check marked "@objc protocol metatypes"; that entire block can be removed to make the whole function return false.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaregood first issueGood for newcomersGood for newcomers