We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86b4db3 commit f67882dCopy full SHA for f67882d
tests/neg-macros/i14001/Macro_1.scala
@@ -0,0 +1,16 @@
1
+package test
2
+import scala.quoted.*
3
+object Y {
4
+ inline def testStuff[T]: T =
5
+ ${testStuffImpl} // problem: T inferred to Nothing
6
+ // solution add T explicitly
7
+
8
+ def testStuffImpl[T: Type](using Quotes): Expr[T] = {
9
+ import quotes.reflect.*
10
11
+ Apply(
12
+ Ref(Symbol.requiredMethod("test.A.C.apply")),
13
+ List(Literal(IntConstant(1)))
14
+ ).asExprOf[T]
15
+ }
16
+}
tests/neg-macros/i14001/Test_2.scala
@@ -0,0 +1,10 @@
+trait B {
+ case class C(i: Int)
+object A extends B
+object X {
+ val z = Y.testStuff[A.C] // error: Expr cast exception
0 commit comments