-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[ConstraintSystem][SE-0249] Key Path Expressions as Functions #26054
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5e98f3e
Implicit conversion of KeyPath<Root,Value> to (Root) -> Value.
gregomni 6f4b0e5
[ConstraintSolver] Favor keypaths over functions
beccadax ffe1684
Add typechecking tests
beccadax 2a885a0
Add runtime tests for key path literal closures
beccadax 66f914d
Make keypath literal in closure only once
beccadax 1a9be78
Allow optional-chaining key paths to match function types
beccadax 33c68e0
Distinguish subscript member type from result type
beccadax a2cd53d
Handle simplification of optional-chaining key path literals, disting…
gregomni 521605c
Didn't regress on this diagnosis after all!
gregomni 3419e5d
These two diagnoses changed for the better, not sure why.
gregomni bf3a786
Add tests with no contextual type info.
gregomni 9ab22cf
Combine internal tryMatchRootAndValue funcs for cleaner code.
gregomni 469e06a
Update to HEAD, fix Param type changes, merging.
gregomni 9c0aad3
Handle conversions of keypath tyvars to function type specifically in…
gregomni 9107626
Added comment explaining additional use of AutoClosureExpr.
gregomni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Why not just a regular implicit closure? I believe that by conversion autoclosure is not supposed to have any arguments.
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.
The problem is the
discriminator
.ClosureExpr
s get numbered during parsing, andAutoClosureExpr
s get numbered during a walk after type checking. The parsing context is already gone by the time this code is running, so the only way to correctly set thediscriminator
is via anAutoClosureExpr
.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.
Interesting, and there is no way to change that behavior to allow implicit closures? It seems a bit like a hack to use autoclosure here, because autoclosure is not supposed to have any parameters and used only in
@autoclosure
marked positions, so we are kind of stretching its design here...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.
Well, the superclass
AbstractClosureExpr
is what handles parameters, not either of the subclasses. The main difference betweenClosureExpr
andAutoClosureExpr
is thatClosureExpr
is supposed to be for explicit closures parsed from the source code, andAutoClosureExpr
is supposed to be for implicitly created closures around an expression.So, it's true, this is the only place where
AutoClosureExpr
will currently have parameters. But the design of the classes is such that I think we'd be stretching the design much more to try to useClosureExpr
here.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.
Maybe it would make sense to add a separate sub-class of
AbstractClosureExpr
which deals with general cases of implicit closures? I'm just trying to think through ideas here sinceAutoClosureExpr
just seems like a specialized use-case to me. Maybe it doesn't really matter that much anyway since the only code which has to deal with that in in SILGen... I can't think of any special cases in CSDiag which deal with expressions like that.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.
At the very least comment associated with
AutoClosureExpr
has to be updated to cover new use-case.