File tree 3 files changed +26
-3
lines changed
compiler/src/dotty/tools/dotc/transform
3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -358,9 +358,13 @@ object Erasure {
358
358
/** This override is only needed to semi-erase type ascriptions */
359
359
override def typedTyped (tree : untpd.Typed , pt : Type )(implicit ctx : Context ): Tree = {
360
360
val Typed (expr, tpt) = tree
361
- val tpt1 = promote(tpt)
362
- val expr1 = typed(expr, tpt1.tpe)
363
- assignType(untpd.cpy.Typed (tree)(expr1, tpt1), tpt1)
361
+ val tpt1 = tpt match {
362
+ case Block (_, tpt) => tpt // erase type aliases (statements) from type block
363
+ case tpt => tpt
364
+ }
365
+ val tpt2 = promote(tpt1)
366
+ val expr1 = typed(expr, tpt2.tpe)
367
+ assignType(untpd.cpy.Typed (tree)(expr1, tpt2), tpt2)
364
368
}
365
369
366
370
override def typedLiteral (tree : untpd.Literal )(implicit ctx : Context ): Tree =
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro {
4
+ inline def test [A , B ]: Any =
5
+ $ { impl[A , B ] }
6
+
7
+ def impl [A : Type , B : Type ]: Expr [Any ] = {
8
+ val t = ' [Map [A , B ]]
9
+ ' {
10
+ new Object ().asInstanceOf [$t]
11
+ ??? .asInstanceOf [$t]
12
+ }
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ type T
3
+ def t1 = Macro .test[Int , String ]
4
+ def t2 = Macro .test[Test .type , T ]
5
+ }
You can’t perform that action at this time.
0 commit comments