-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
SIP-56: Better foundations for match types #18262
Merged
sjrd
merged 17 commits into
scala:main
from
dotty-staging:better-foundations-for-match-types
Dec 18, 2023
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c96d847
Introduce MatchTypeCaseSpec to categorize match type cases.
sjrd 5260c60
Use new specced match types for class type constructors.
sjrd cc41d48
Use new specced match types for `scala.compiletime.int.S[n]`.
sjrd 067b828
Short-circuit match type cases with missing captures in their patterns.
sjrd aa8d348
Use the specced match types for abstract tycons in patterns.
sjrd 97725d7
Handle type member extractors as specced match types.
sjrd 7ab7b0f
Report a compile error on illegal match types.
sjrd ec94ff5
Allow to reduce type member extractors when the member is a class.
sjrd 1b2a16e
New implementation of `provablyDisjoint` to match SIP-56.
sjrd f432d08
Be more specific about higher-kinded types in provablyDisjoint.
sjrd c653793
Do not use provablyEmpty anymore; use S <: T + provablyDisjoint(S, T)…
sjrd 16cf4f2
Add regression tests for old issues fixed with the new match types.
sjrd c8b4da8
Under -source:3.3 and below, always use the legacy match type algorithm.
sjrd 2dd9f45
In type assigner for Apply, carry ErrorType's from the `fn`.
sjrd ec097a9
Fix 1 cause of infinite recursion in the new provablyDisjoint.
sjrd b5a4ca5
Demonstrate more potential unsoundness with a CCE reproducer.
sjrd c3b9d9b
Add comments that link to relevant parts of the spec of SIP-56.
sjrd 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
709 changes: 493 additions & 216 deletions
709
compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- Error: tests/neg/6314-6.scala:26:3 ---------------------------------------------------------------------------------- | ||
26 | (new YY {}).boom // error: object creation impossible | ||
| ^ | ||
|object creation impossible, since def apply(fa: String): Int in trait XX in object Test3 is not defined | ||
|(Note that | ||
| parameter String in def apply(fa: String): Int in trait XX in object Test3 does not match | ||
| parameter Test3.Bar[X & Object with Test3.YY {...}#Foo] in def apply(fa: Test3.Bar[X & YY.this.Foo]): Test3.Bar[Y & YY.this.Foo] in trait YY in object Test3 | ||
| ) | ||
-- Error: tests/neg/6314-6.scala:52:3 ---------------------------------------------------------------------------------- | ||
52 | (new YY {}).boom // error: object creation impossible | ||
| ^ | ||
|object creation impossible, since def apply(fa: String): Int in trait XX in object Test4 is not defined | ||
|(Note that | ||
| parameter String in def apply(fa: String): Int in trait XX in object Test4 does not match | ||
| parameter Test4.Bar[X & Object with Test4.YY {...}#FooAlias] in def apply(fa: Test4.Bar[X & YY.this.FooAlias]): Test4.Bar[Y & YY.this.FooAlias] in trait YY in object Test4 | ||
| ) |
Oops, something went wrong.
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 should have a doc comment explaining which patterns can be converted to spec patterns.
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.
I added a commit with comments linking to the spec on this method, on
matchSpeccedPatMat
and onprovablyDisjoint
. They are the 3 core methods that directly map to a specified algorithm of SIP-56.