forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Intrinsify
constValueTuple
and summonAll
The new implementation instantiates the TupleN/TupleXXL classes directly. This avoids the expensive construction of tuples using `*:`. Fixes scala#15988
- Loading branch information
1 parent
a37dac6
commit d71ca06
Showing
9 changed files
with
119 additions
and
47 deletions.
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
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
-- [E182] Type Error: tests/neg/17211.scala:14:12 ---------------------------------------------------------------------- | ||
-- [E182] Type Error: tests/neg/17211.scala:14:13 ---------------------------------------------------------------------- | ||
14 | constValue[IsInt[Foo.Foo]] // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| IsInt[Foo.Foo] is not a constant type; cannot take constValue | ||
| ^^^^^^^^^^^^^^ | ||
| IsInt[Foo.Foo] is not a constant type; cannot take constValue | ||
| | ||
| Note: a match type could not be fully reduced: | ||
| Note: a match type could not be fully reduced: | ||
| | ||
| trying to reduce IsInt[Foo.Foo] | ||
| failed since selector Foo.Foo | ||
| does not match case Int => (true : Boolean) | ||
| and cannot be shown to be disjoint from it either. | ||
| Therefore, reduction cannot advance to the remaining case | ||
| trying to reduce IsInt[Foo.Foo] | ||
| failed since selector Foo.Foo | ||
| does not match case Int => (true : Boolean) | ||
| and cannot be shown to be disjoint from it either. | ||
| Therefore, reduction cannot advance to the remaining case | ||
| | ||
| case _ => (false : Boolean) | ||
| case _ => (false : Boolean) |
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,6 @@ | ||
import scala.compiletime.constValueTuple | ||
|
||
@main def Test: Unit = | ||
assert(constValueTuple[EmptyTuple] == EmptyTuple) | ||
assert(constValueTuple[("foo", 5, 3.14, "bar", false)] == ("foo", 5, 3.14, "bar", false)) | ||
assert(constValueTuple[(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)] == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)) |
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,21 @@ | ||
import scala.compiletime.summonAll | ||
|
||
@main def Test: Unit = | ||
assert(summonAll[EmptyTuple] == EmptyTuple) | ||
assert(summonAll[(5, 5, 5)] == (5, 5, 5)) | ||
assert( | ||
summonAll[( | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
)] == ( | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
5, 5, 5, 5, 5, | ||
)) | ||
|
||
given 5 = 5 |