-
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 1 commit
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
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,4 @@ | ||
class Test { | ||
def isTraversableAgain(from: Iterator[Int]): Boolean = | ||
from.isInstanceOf[Iterable[?]] | ||
} |
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,10 @@ | ||
type Tupled[A] <: Tuple = A match | ||
case Tuple => A & Tuple | ||
case _ => A *: EmptyTuple | ||
|
||
enum Day: | ||
case Saturday, Sunday | ||
|
||
type Foo = Tupled[Day] | ||
|
||
def foo(): Foo = Day.Saturday *: EmptyTuple |
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.
@sjrd Is it supposed to be possible for the
targs
to beLazyRef
s? If they are, thepending
set would also fail sinceLazyRef
s compare using reference equality. We could callstripLazyRef
here.I have
LazyRef
s showing up in a modified version of the compiler in an example with F-bounds, but I don't have a self-contained test case that would make them show up in the unmodified compiler. If it is indeed possible for them to show up, would you have any hints on constructing a test case? In general I have difficulty constructing test cases that even triggerprovablyDisjoint
to be called on a desired pair of types.