diff --git a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala index a4c7058f3e66..62080c41719a 100644 --- a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala @@ -1911,6 +1911,8 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler def typeArgs: List[TypeRepr] = self match case AppliedType(_, args) => args + case AnnotatedType(parent, _) => parent.typeArgs + case FlexibleType(underlying) => underlying.typeArgs case _ => List.empty end extension end TypeReprMethods diff --git a/tests/neg-macros/i23008.check b/tests/neg-macros/i23008.check index 8138956d8653..4eb4fee7e7b3 100644 --- a/tests/neg-macros/i23008.check +++ b/tests/neg-macros/i23008.check @@ -5,8 +5,8 @@ | Exception occurred while executing macro expansion. | java.lang.IllegalArgumentException: requirement failed: value of StringConstant cannot be `null` | at scala.Predef$.require(Predef.scala:393) - | at scala.quoted.runtime.impl.QuotesImpl$reflect$StringConstant$.apply(QuotesImpl.scala:2540) - | at scala.quoted.runtime.impl.QuotesImpl$reflect$StringConstant$.apply(QuotesImpl.scala:2539) + | at scala.quoted.runtime.impl.QuotesImpl$reflect$StringConstant$.apply(QuotesImpl.scala:2542) + | at scala.quoted.runtime.impl.QuotesImpl$reflect$StringConstant$.apply(QuotesImpl.scala:2541) | at scala.quoted.ToExpr$StringToExpr.apply(ToExpr.scala:82) | at scala.quoted.ToExpr$StringToExpr.apply(ToExpr.scala:80) | at scala.quoted.Expr$.apply(Expr.scala:72) diff --git a/tests/new/test.scala b/tests/new/test.scala index 23ac0de47b6f..632ef3493662 100644 --- a/tests/new/test.scala +++ b/tests/new/test.scala @@ -1,5 +1,9 @@ -class Cap extends caps.ExclusiveCapability +object e: + def foldRL(f: Int => Int)(g: String => Int) = ??? + + +val xs = e.foldRL + : i => i + 1 + : s => s.length -def test(consume x: Cap) = ??? -def impl(using consume x: Cap) = ??? diff --git a/tests/run-macros/i24006/Eval.scala b/tests/run-macros/i24006/Eval.scala new file mode 100644 index 000000000000..f32a066e4c40 --- /dev/null +++ b/tests/run-macros/i24006/Eval.scala @@ -0,0 +1,11 @@ + +import scala.quoted._ + +object Eval: + + inline def eval[T](x: List[T]) = ${ evalImpl[T]('x) } + def evalImpl[A](x: Expr[List[A]])(using Quotes): Expr[Unit] = + import quotes.reflect.* + println(x.asTerm.tpe.widen) + x.asTerm.tpe.widen.typeArgs.head + '{()} diff --git a/tests/run-macros/i24006/Test.scala b/tests/run-macros/i24006/Test.scala new file mode 100644 index 000000000000..f9d3223b9811 --- /dev/null +++ b/tests/run-macros/i24006/Test.scala @@ -0,0 +1,3 @@ +import Eval.eval + +@main def Test() = eval(List(1) :+ 4)