Skip to content

Commit 8a6e24f

Browse files
Merge pull request #10852 from dotty-staging/fix-#8865
Fix #8865: Add regression test
2 parents 2a58cc4 + d3f50c2 commit 8a6e24f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/neg-macros/i8865.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import scala.quoted._
2+
object Macro {
3+
4+
def impl[A : Type](using Quotes): Expr[A] = {
5+
import quotes.reflect._
6+
val tpe = TypeRepr.of[A].asType
7+
'{ (a: ${tpe}) => ???} // error: tpe.Underlying cannot be used as a value type
8+
'{???}
9+
}
10+
}

tests/pos-macros/i8865.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import scala.quoted._
2+
object Macro {
3+
4+
def impl[A : Type](using Quotes): Expr[A] = {
5+
import quotes.reflect._
6+
TypeRepr.of[A].asType match
7+
case '[tpe] => '{ (a: tpe) => ???}
8+
'{???}
9+
}
10+
}

0 commit comments

Comments
 (0)