-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport "Detail "not a constant type" message" to LTS (#18964)
Backports #17626 to the LTS branch. PR submitted by the release tooling.
- Loading branch information
Showing
6 changed files
with
40 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- [E182] Type Error: tests/neg/17211.scala:14:12 ---------------------------------------------------------------------- | ||
14 | constValue[IsInt[Foo.Foo]] // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| IsInt[Foo.Foo] is not a constant type; cannot take constValue | ||
| | ||
| 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 | ||
| | ||
| 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import scala.compiletime.constValue | ||
|
||
type IsInt[A] = A match | ||
case Int => true | ||
case _ => false | ||
|
||
def test = | ||
val x = constValue[IsInt[Int]] // val res2: Boolean = true; works | ||
val y = constValue[IsInt[String]] // val res3: Boolean = false; works | ||
|
||
object Foo: | ||
opaque type Foo = Int | ||
|
||
constValue[IsInt[Foo.Foo]] // error |