-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Check generic requirements when type checking calls to variadic generic functions #61657
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
slavapestov
merged 10 commits into
swiftlang:main
from
slavapestov:variadic-generic-function-check-requirements
Oct 22, 2022
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
74a6350
Sema: Split up test/Constraints/type_sequences.swift
slavapestov c41341d
Sema: Fix matchCallArguments() to allow empty pack type bindings
slavapestov 72c157e
AST: Fix Type::walk() to visit the count type of a PackExpansionType
slavapestov 46d5fa6
Sema: Introduce ConstraintKind::SubclassOf
slavapestov 7d0de80
Sema: Check requirements when calling a variadic generic function
slavapestov cbce4a5
Sema: Support PackExpansionTypes in matchPackTypes()
slavapestov 87c0b2d
AST: Implement support for projecting member types from PackType via …
slavapestov afbf844
Sema: Implement support for projecting member types from PackType in …
slavapestov f3fcc44
Sema: Handle PackElement locator in repairFailures()
slavapestov c34f8d3
Sema: Check AnyObject requirements of variadic generic functions
slavapestov 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 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
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
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
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
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
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
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
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.
This is actually interesting, I wonder if we do want
subclass
to participate in inference because it could mean inferring a superclass too eagerly.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.
Probably! You'll notice we only generate SubclassOf when the left hand side is a pack for now, because a few tests regressed. Let's figure out how to do it all the time soon, because it will clean up diagnostics too (I saw some hacks to deal with the fact that Superclass requirements become Subtype + ConformsTo AnyObject right now)
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.
Hm, I was looking at
matchTypes
for cases where "subtype" is used between class types and it should already handle the case where both types are the same (via DeepEquality restriction) and otherwise it would addSuperclass
restriction that would callmatchSuperclassTypes
internally. Besides handlingPackType
s specifically what are other reasons to add this constraint?