-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SE-0103 Noescape by default #3853
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
Conversation
@swift-ci please test |
There might be some gtest failures, which I didn't see originally but I see locally after rebasing. But, this should be close and I'll try to fix those if they repro on the bots. |
Awesome, thank you for working on this! |
@@ -463,7 +463,8 @@ class TestClassWithThrows : HasThrowing, HasThrowingProtocol { | |||
// HAS_THROWING: Begin completions | |||
// HAS_THROWING-DAG: Decl[InstanceMethod]/Super: func foo() throws {|}; name=foo() throws | |||
// HAS_THROWING-DAG: Decl[InstanceMethod]/Super: override func bar() throws {|}; name=bar() throws | |||
// HAS_THROWING-DAG: Decl[InstanceMethod]/Super: override func baz(x: () throws -> ()) rethrows {|}; name=baz(x: () throws -> ()) rethrows | |||
// FIXME: make the below require to print @escaping |
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.
Issue & radar?
Library changes and changes to library tests LGTM. |
@swift-ci please smoke test |
I fixed up the benchmarks and applied feedback. Unfortunately, I'm not sure about the corelibs-foundation failures. I'll try to fix them up blind in swiftlang/swift-corelibs-foundation#492 |
Another item on the TODO list would be to change |
Linux failures are corelibs-foundtaion, which I'll be fixing soon. |
The isExplicitlyEscaping bit, though useful for printing, unfortunately puts us in a position where we have different bit patterns for the same type, and thus lose much of our type equivalence checking for overriding, protocol conformance, etc., even if we were to take subtyping into account. We need to drop it, relying on the existing noescape bit alone to determine the type's semantics (at least, as long as we continue to encode this information in the type system). This is a partial fix; we will now be excessively printing @escaping, but the subsequent commits will correct this. For printing, we will instead need to be more context-aware.
Adds an explicit @escaping throughout the standard library, validation test suite, and tests. This will be necessary as soon as noescape is the default for closure parameters.
This flips the switch to have @NoEscape be the default semantics for function types in argument positions, for everything except property setters. Property setters are naturally escaping, so they keep their escaping-by-default behavior. Adds contentual printing, and updates the test cases. There is some further (non-source-breaking) work to be done for SE-0103: - We need the withoutActuallyEscaping function - Improve diagnostics and QoI to at least @NoEscape's standards - Deprecate / drop @NoEscape, right now we allow it - Update internal code completion printing to be contextual - Add more tests to explore tricky corner cases - Small regressions in fixits in attr/attr_availability.swift
Adds @escaping to internal benchmark code to fix it. References SR for known limitation. Use stdlib coding style for arguments.
71a911f
to
25ac879
Compare
And XCTest update: swiftlang/swift-corelibs-xctest#146 |
Validation tests pass for me with those PRs on Linux. OS X already passed. I'll have to watch CI carefully. |
What's in this pull request?
Resolved bug number: (SR-1952)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
A smoke test on macOS does the following:
device standard libraries are not built.
version of these tests are not run.
A smoke test on Linux does the following:
tests are not run.
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.