-
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
Combine cases of Tuple.Zip
disjoint from (h1 *: t1, h2 *: t2)
#21287
Open
EugeneFlesselle
wants to merge
1
commit into
scala:main
Choose a base branch
from
dotty-staging:tuples/zip
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
dwijnand
reviewed
Jul 29, 2024
Well actually it looks like the doc was just incorrect: scala3/library/src/scala/Tuple.scala Lines 177 to 186 in 7a0230d
-- [E007] Type Mismatch Error: tests/playground/example.scala:10:59 ------------
10 | val z: Tuple.Zip[Int *: Int *: Tuple, String *: Tuple] = (1, "a") *: (??? : Tuple)
| ^^^^^^^^^^^^^^^
|Found: (Int, String) *: Tuple
|Required: (Int, String) *: Tuple.Zip[Int *: Tuple, Tuple]
|
|Note: a match type could not be fully reduced:
|
| trying to reduce Tuple.Zip[Int *: Tuple, Tuple]
| failed since selector (Int *: Tuple, Tuple)
| does not match case (h1 *: t1, h2 *: t2) => (h1, h2) *: Tuple.Zip[t1, t2]
| and cannot be shown to be disjoint from it either.
| Therefore, reduction cannot advance to the remaining cases
|
| case (EmptyTuple, _) => EmptyTuple
| case Any => Tuple even though the doc would suggest the match type reduces to |
EugeneFlesselle
changed the title
Drop
Combine cases of Jul 29, 2024
Tuple.Zip
unreachable match type caseTuple.Zip
disjoint from (h1 *: t1, h2 *: t2)
EugeneFlesselle
force-pushed
the
tuples/zip
branch
from
July 30, 2024 12:28
47a3cbf
to
f8e584d
Compare
EugeneFlesselle
force-pushed
the
tuples/zip
branch
from
November 6, 2024 16:11
f8e584d
to
85420c3
Compare
If we reach the second case of `Zip[T1 <: Tuple, T2 <: Tuple]`, then we know `(T1, T2)` is disjoint from `(NonEmptyTuple, NonEmptyTuple)`, from which we can conclude at least one of the two is an `EmptyTuple`. Addressing scala#19175
EugeneFlesselle
force-pushed
the
tuples/zip
branch
from
November 7, 2024 11:10
85420c3
to
995d63b
Compare
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.
If we reach the second case of
Zip[T1 <: Tuple, T2 <: Tuple]
, then we know(T1, T2)
is disjoint from(NonEmptyTuple, NonEmptyTuple)
, from which we can conclude at least one of the two is anEmptyTuple
.Addressing #19175