Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,7 @@ 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 _ => List.empty
end extension
end TypeReprMethods
Expand Down
2 changes: 1 addition & 1 deletion tests/neg-macros/i23008.check
Original file line number Diff line number Diff line change
Expand Up @@ -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:2541)
| 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.ToExpr$StringToExpr.apply(ToExpr.scala:82)
| at scala.quoted.ToExpr$StringToExpr.apply(ToExpr.scala:80)
| at scala.quoted.Expr$.apply(Expr.scala:72)
Expand Down
11 changes: 11 additions & 0 deletions tests/run-macros/i24006/Eval.scala
Original file line number Diff line number Diff line change
@@ -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
'{()}
3 changes: 3 additions & 0 deletions tests/run-macros/i24006/Test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Eval.eval

@main def Test() = eval(List(1) :+ 4)
Loading