-
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.
Insert top level type variables before typing quote pattern
```scala case '{ type u; ($x: t, $y: t, $z: u) } ``` is desugared to ```scala case '{ type t; type u; ($x: `t`, $y: `t`, $z: `u`) } ``` Fixes #14708
- Loading branch information
1 parent
0ab89e6
commit 41a4277
Showing
6 changed files
with
100 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import scala.quoted.* | ||
|
||
object Main { | ||
def foo(a: Expr[Any])(using Quotes) = { | ||
a match { | ||
case '{ ($x: Set[t]).toSet } => | ||
case '{ ($x: Set[t]).toSet[t] } => | ||
case '{ val a = 1; a; ($x: Set[t]).toSet } => | ||
case '{ type u; ($x: Set[`u`]).toSet } => | ||
case '{ type t; ($x: Set[t]).toSet } => | ||
case '{ varargs(${_}*) } => | ||
case '{ type u; ($x: t, $y: t, $z: u) } => | ||
case _ => | ||
} | ||
} | ||
} | ||
|
||
def varargs(x: Any*): Unit = () |
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,7 +1,7 @@ | ||
import scala.quoted.* | ||
class Foo { | ||
def f[T2: Type](e: Expr[T2])(using Quotes) = e match { | ||
case '{ $x: *:[Int, t] } => | ||
case '{ type t <: Tuple; $x: *:[Int, t] } => // FIXME infer bounds of tail | ||
Type.of[ *:[Int, t] ] | ||
} | ||
} |