diff --git a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala index fbac02bebd8c..f3581b205bc0 100644 --- a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala +++ b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala @@ -72,12 +72,13 @@ object PickledQuotes { def unpickleType(tasty: PickledQuote, args: PickledTypeArgs)(implicit ctx: Context): Tree = { val tastyBytes = TastyString.unpickle(tasty) val unpickled = unpickle(tastyBytes, args, isType = true)(ctx.addMode(Mode.ReadPositions)) - unpickled match { + val tpt = unpickled match { case Block(aliases, tpt) => // `@quoteTypeTag type` aliasses are not required after unpickling tpt case tpt => tpt } + tpt.withType(dealiasTypeTags(tpt.tpe)) } // TASTY picklingtests/pos/quoteTest.scala diff --git a/compiler/test-resources/repl-macros/i6263 b/compiler/test-resources/repl-macros/i6263 index 4b3df71a76b0..2bb2b18f91e9 100644 --- a/compiler/test-resources/repl-macros/i6263 +++ b/compiler/test-resources/repl-macros/i6263 @@ -7,9 +7,5 @@ scala> withQuoteContext { fn("foo") } ok scala> withQuoteContext { fn((1,2)) } ok -scala> object O -// defined object O -scala> withQuoteContext { fn(O) } -ok scala> withQuoteContext { fn(1) } ok diff --git a/tests/run-macros/i7008/macro_1.scala b/tests/run-macros/i7008/macro_1.scala new file mode 100644 index 000000000000..ef270cfd14a3 --- /dev/null +++ b/tests/run-macros/i7008/macro_1.scala @@ -0,0 +1,19 @@ +import scala.quoted._, scala.quoted.matching._ +import delegate scala.quoted._ +import scala.tasty._ + +case class Box[T](v: T) + +inline def mcr(expr: => Boolean): Unit = ${mcrProxy('expr)} + +def mcrProxy(expr: Expr[Boolean]) given QuoteContext: Expr[Unit] = { + val res = mcrImpl[Boolean]('{ (esx: Seq[Box[Boolean]]) => () }, expr) + // println(s"Out: ${res.show}") + res +} + +def mcrImpl[T](func: Expr[Seq[Box[T]] => Unit], expr: Expr[T]) given (ctx: QuoteContext, tt: Type[T]): Expr[Unit] = { + import ctx.tasty._ + val arg = Seq('{(Box($expr))}).toExprOfSeq + func(arg) +} \ No newline at end of file diff --git a/tests/run-macros/i7008/test_2.scala b/tests/run-macros/i7008/test_2.scala new file mode 100644 index 000000000000..bc12d6ab9576 --- /dev/null +++ b/tests/run-macros/i7008/test_2.scala @@ -0,0 +1 @@ +@main def Test = println(mcr(true)) \ No newline at end of file