@@ -3,6 +3,8 @@ package typer
3
3
4
4
import dotty .tools .dotc .ast ._
5
5
import dotty .tools .dotc .ast .Trees ._
6
+ import dotty .tools .dotc .config .Feature ._
7
+ import dotty .tools .dotc .config .SourceVersion ._
6
8
import dotty .tools .dotc .core ._
7
9
import dotty .tools .dotc .core .Annotations ._
8
10
import dotty .tools .dotc .core .Constants ._
@@ -58,7 +60,9 @@ trait QuotesAndSplices {
58
60
if ctx.mode.is(Mode .Pattern ) then
59
61
typedQuotePattern(tree, pt, qctx)
60
62
else if tree.quoted.isType then
61
- report.warning(em " Consider using canonical type constructor scala.quoted.Type[ ${tree.quoted}] instead " , tree.srcPos)
63
+ val msg = em " Consider using canonical type constructor scala.quoted.Type[ ${tree.quoted}] instead "
64
+ if sourceVersion.isAtLeast(`3.1-migration`) then report.error(msg, tree.srcPos)
65
+ else report.warning(msg, tree.srcPos)
62
66
typedTypeApply(untpd.TypeApply (untpd.ref(defn.QuotedTypeModule_apply .termRef), tree.quoted :: Nil ), pt)(using quoteContext).select(nme.apply).appliedTo(qctx)
63
67
else
64
68
typedApply(untpd.Apply (untpd.ref(defn.InternalQuoted_exprQuote .termRef), tree.quoted), pt)(using pushQuoteContext(qctx)).select(nme.apply).appliedTo(qctx)
@@ -175,7 +179,9 @@ trait QuotesAndSplices {
175
179
pat.select(tpnme.spliceType)
176
180
else
177
181
val tree1 = typedSelect(untpd.Select (tree.expr, tpnme.spliceType), pt)(using spliceContext).withSpan(tree.span)
178
- report.warning(em " Consider using canonical type reference ${tree1.tpe.show} instead " , tree.srcPos)
182
+ val msg = em " Consider using canonical type reference ${tree1.tpe} instead "
183
+ if sourceVersion.isAtLeast(`3.1-migration`) then report.error(msg, tree.srcPos)
184
+ else report.warning(msg, tree.srcPos)
179
185
tree1
180
186
}
181
187
0 commit comments