-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SE-0102: Remove @noreturn attribute and introduce an empty Never type #3658
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
SE-0102: Remove @noreturn attribute and introduce an empty Never type #3658
Conversation
@swift-ci Please test |
@@ -115,9 +115,6 @@ protocol ProtocolA { | |||
func protoAFunc() | |||
@objc optional func protoAFuncOptional() | |||
|
|||
@noreturn | |||
func protoAFuncWithAttr() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was testing how functions with attributes show up in code completion; we need a replacement testcase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other attributes show up in code completion though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. @akyrtzi @benlangmuir @nkcsgexi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@noreturn
was the only one we added into override completions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: you should change CodeCompletion.cpp. There are two places that set:
Options.ExclusiveAttrList.push_back(DAK_NoReturn);
After this change it should be
Options.SkipAttributes = true;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Ben. This change is coming up in the next patch. I need to land the preliminary stuff first so I can update the other repos.
6ef3ef5
to
e0a8b81
Compare
New version here is an intermediate state -- both Never and @NoReturn are supported. This is needed to make this PR pass CI, so I can then update swift-corelibs-foundation, swift-corelibs-xctest and swiftpm. |
@swift-ci Please test |
e0a8b81
to
1bf3913
Compare
@swift-ci Please test |
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
1bf3913
to
393dd83
Compare
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
Mostly NFC, this is just plumbing for the next patch. Note that isNever() returns true for any uninhabited enum. It should be generalized so that stuff like (Never, Int) is also known to be uninhabited, or even to support generic substitutions that yield uninhabited types, but for now I really see no reason to go that far, and the current check for an enum with no cases seems perfectly adequate.
…r, NFC This addresses a FIXME.
393dd83
to
ddc51c5
Compare
Migration support is not ready yet.
The original plan was to handle Never in SIL type lowering, but we really need the uninhabited type check in the AST as well, as returning Never has to imply @discardableResult. For this reason, I'm going with a simpler uninhabited check than the general one described in the evolution proposal.