Skip to content

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

Merged
merged 5 commits into from
Jul 22, 2016

Conversation

slavapestov
Copy link
Contributor

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.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@@ -115,9 +115,6 @@ protocol ProtocolA {
func protoAFunc()
@objc optional func protoAFuncOptional()

@noreturn
func protoAFuncWithAttr()

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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.

Copy link
Contributor

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;

Copy link
Contributor Author

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.

@slavapestov slavapestov force-pushed the replace-noreturn-with-never branch from 6ef3ef5 to e0a8b81 Compare July 21, 2016 20:14
@slavapestov
Copy link
Contributor Author

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.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov force-pushed the replace-noreturn-with-never branch from e0a8b81 to 1bf3913 Compare July 21, 2016 20:17
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov force-pushed the replace-noreturn-with-never branch from 1bf3913 to 393dd83 Compare July 21, 2016 22:56
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@slavapestov
Copy link
Contributor Author

@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.
…NoReturn

No migrator support yet, and the code for @NoReturn is still in
place.
@slavapestov slavapestov force-pushed the replace-noreturn-with-never branch from 393dd83 to ddc51c5 Compare July 22, 2016 21:57
@slavapestov slavapestov merged commit c6e828f into swiftlang:master Jul 22, 2016
@slavapestov slavapestov deleted the replace-noreturn-with-never branch August 19, 2016 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants