-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[TypeChecker] Re-land fixes/improvements related to SE-0326 #40397
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
xedin
merged 14 commits into
swiftlang:main
from
xedin:reland-se-0326-related-changes-without-reenabling
Dec 6, 2021
Merged
[TypeChecker] Re-land fixes/improvements related to SE-0326 #40397
xedin
merged 14 commits into
swiftlang:main
from
xedin:reland-se-0326-related-changes-without-reenabling
Dec 6, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ambiguous If there are multiple overloads and all of them require closure to have a parameter, let's diagnose that as such instead of ambiguity.
…d code While building a closure to inject `checkExpect` code, clone member references associated with assignment. Re-using AST nodes is generally invalid. This is visible with multi-statement closure inference enabled, because the body is type-checked together with enclosing context and both elements end up sharing `DeclRefExpr` and `MemberRefExpr`s.
This preserves previous behavior where multi-statement closures where always type-checked without context.
…es when inference is enabled When multi-statement closure inference is enabled it's body is type-checked together with enclosing context, so they could be walked directly just like single-expressions ones.
… closures Extract diagnostic into a method and use it while type-checking `for-in` in top-level code and in closures.
…t inference is enabled Scope down previous check to avoid walking into patterns that appear in multi-statement closures if the inference is enabled.
Preserve pre SE-0326 for code completion, so it could be ported gradually.
Put some common logic related to local declaration to the base class and refactor other walkers to use it instead of `ASTWalker`.
…ic parameter holes Closure result type or generic parameter associated with such a location could bw inferred from a body of a multi-statement closure (when inference is enabled), so we need to give closure a chance to run before attemtping a hole for such positions in diagnostic mode.
…Unchecked` flag Propagate `LeaveClosureBodyUnchecked` flag from `typeCheckASTNodeAtLoc` down to declaration checker to skip checking closures associated with pattern binding entry initializers. This is no-op until multi-statement inference becomes enabled by default.
Each of the elements in the result builder has to be fully pre-checked now that multi-statement inference has been enabled.
@swift-ci please smoke test |
ahoppen
added a commit
to ahoppen/swift-source-compat-suite
that referenced
this pull request
Dec 9, 2021
Add SR-15495 again (probably caused by swiftlang/swift#40397)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This re-lands almost everything from #39989 expect to test-case adjustments and
enabling inference by default.