diff --git a/community-build/community-projects/shapeless b/community-build/community-projects/shapeless index b4c2d61ac785..62157bc8c67c 160000 --- a/community-build/community-projects/shapeless +++ b/community-build/community-projects/shapeless @@ -1 +1 @@ -Subproject commit b4c2d61ac785720c8ea33eda51104af15fb007d8 +Subproject commit 62157bc8c67c887d0f38ca2af3e06c9dbd99dd1e diff --git a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala index 6649722ac09b..11fb10863cda 100644 --- a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala +++ b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala @@ -57,7 +57,8 @@ trait QuotesAndSplices { val tree1 = if ctx.mode.is(Mode.Pattern) then typedQuotePattern(tree, pt, qctx) - else if (tree.quoted.isType) + else if tree.quoted.isType then + report.warning(em"Consider using canonical type constructor scala.quoted.Type[${tree.quoted}] instead", tree.srcPos) typedTypeApply(untpd.TypeApply(untpd.ref(defn.QuotedTypeModule_apply.termRef), tree.quoted :: Nil), pt)(using quoteContext).select(nme.apply).appliedTo(qctx) else typedApply(untpd.Apply(untpd.ref(defn.InternalQuoted_exprQuote.termRef), tree.quoted), pt)(using pushQuoteContext(qctx)).select(nme.apply).appliedTo(qctx) @@ -171,7 +172,9 @@ trait QuotesAndSplices { using spliceContext.retractMode(Mode.QuotedPattern).withOwner(spliceOwner(ctx))) pat.select(tpnme.spliceType) else - typedSelect(untpd.Select(tree.expr, tpnme.spliceType), pt)(using spliceContext).withSpan(tree.span) + val tree1 = typedSelect(untpd.Select(tree.expr, tpnme.spliceType), pt)(using spliceContext).withSpan(tree.span) + report.warning(em"Consider using canonical type reference ${tree1.tpe.show} instead", tree.srcPos) + tree1 } private def checkSpliceOutsideQuote(tree: untpd.Tree)(using Context): Unit = diff --git a/tests/patmat/i9489.scala b/tests/patmat/i9489.scala index 30ae98e72f64..1a1f305d9dbc 100644 --- a/tests/patmat/i9489.scala +++ b/tests/patmat/i9489.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def summonTypedType[T : Type](using QuoteContext): String = '[T] match { +def summonTypedType[T : Type](using QuoteContext): String = Type[T] match { case '[Boolean] => "Boolean" case '[Byte] => "Byte" case _ => "Other" diff --git a/tests/patmat/i9489b.scala b/tests/patmat/i9489b.scala new file mode 100644 index 000000000000..832e01d1b184 --- /dev/null +++ b/tests/patmat/i9489b.scala @@ -0,0 +1,7 @@ +import scala.quoted._ + +def summonTypedType[T : Type](using QuoteContext): String = '{ ??? : T } match { + case '{ $_ : Boolean } => "Boolean" + case '{ $_ : Byte } => "Byte" + case _ => "Other" +}