forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#7005 from dotty-staging/fix-#6997
Fix scala#6997: Adapt quote type direct aliase to type splice
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
import scala.quoted._ | ||
class Foo { | ||
def mcrImpl(body: Expr[Any]) given (t: Type[_ <: Any]) given (ctx: QuoteContext): Expr[Any] = '{ | ||
val tmp = ???.asInstanceOf[$t] | ||
tmp | ||
} | ||
} |
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,15 @@ | ||
package playground | ||
|
||
import scala.quoted._, scala.quoted.matching._ | ||
import delegate scala.quoted._ | ||
|
||
inline def mcr(x: => Any): Any = ${mcrImpl('x)} | ||
|
||
def mcrImpl(body: Expr[Any]) given (ctx: QuoteContext): Expr[Any] = { | ||
val '{$x: $t} = body | ||
'{ | ||
val tmp: $t = $x.asInstanceOf[$t] | ||
println(tmp) | ||
tmp | ||
} | ||
} |