Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-2078] Conformance to an @objc protocol by a generic type in an extension crashes the compiler #44686

Open
jadengeller mannequin opened this issue Jul 14, 2016 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@jadengeller
Copy link
Mannequin

jadengeller mannequin commented Jul 14, 2016

Previous ID SR-2078
Radar rdar://problem/21216149
Original Reporter @JadenGeller
Type Bug
Environment

Swift 2.2 and Swift 3 b2; other versions untested, but presumably fail also

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 11c43ab459a5ddfe3d39d960cac1fdd2

is duplicated by:

  • SR-4130 Extensions of generic subclasses of NSObject defined in Swift crash in IRGen

Issue Description:

The following will crash the Swift compiler.

@objc protocol Fooable {}
class Foo<T> {}
extension Foo: Fooable {}
@jadengeller
Copy link
Mannequin Author

jadengeller mannequin commented Jul 22, 2016

I believe this bug may be related to SR-2146.

The following will crash the compiler.

@objc protocol Fooable {}
protocol Barable: Foible {}
class Foo<T> {}
extension Foo: Barable {}

The following modification, where a redundant conformance to `Fooable` is stated at the declaration of `Foo`, serves as a workaround.

@objc protocol Fooable {}
protocol Barable: Fooable {}
class Foo<T>: Fooable {}
extension Foo: Barable {}

@belkadan
Copy link
Contributor

Wrong related bug number?

The problem is that generic types can't get Objective-C categories at the moment, which means extensions can't add protocols or @objc members. These should definitely have proper errors, though.

@jadengeller
Copy link
Mannequin Author

jadengeller mannequin commented Jul 25, 2016

Oh good catch. I meant SR-2146, though I'm not sure that it's related anymore.

@Dante-Broggi
Copy link
Contributor

I believe this has been resolved, as the given code produces an error in the Xcode 10 toolchain.
@objc protocol Fooable {}class Foo<T> {}
extension Foo: Fooable {} // Conformance of generic class 'Foo<T>' to @objc protocol 'Fooable' cannot be in an extension

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

3 participants