-
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.
Compute correct argument type in ExprMap
Fixes #15228
- Loading branch information
1 parent
0181ef9
commit c08026f
Showing
3 changed files
with
19 additions
and
1 deletion.
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,13 @@ | ||
import scala.quoted.* | ||
|
||
inline def mac[T](inline expr: T): T = | ||
${ impl('expr) } | ||
|
||
class MyMap() extends ExprMap { | ||
override def transform[T](e: Expr[T])(using Type[T])(using q: Quotes): Expr[T] = | ||
transformChildren(e) | ||
} | ||
|
||
def impl[T: Type](expr: Expr[T])(using quotes: Quotes): Expr[T] = { | ||
MyMap().transform(expr) | ||
} |
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 @@ | ||
def test = mac(None.getOrElse(3)) |