Skip to content

Commit 8dce9cc

Browse files
committed
Make use of old type syntax an error in 3.1
1 parent 57dd672 commit 8dce9cc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package typer
33

44
import dotty.tools.dotc.ast._
55
import dotty.tools.dotc.ast.Trees._
6+
import dotty.tools.dotc.config.Feature._
7+
import dotty.tools.dotc.config.SourceVersion._
68
import dotty.tools.dotc.core._
79
import dotty.tools.dotc.core.Annotations._
810
import dotty.tools.dotc.core.Constants._
@@ -58,7 +60,9 @@ trait QuotesAndSplices {
5860
if ctx.mode.is(Mode.Pattern) then
5961
typedQuotePattern(tree, pt, qctx)
6062
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)
6266
typedTypeApply(untpd.TypeApply(untpd.ref(defn.QuotedTypeModule_apply.termRef), tree.quoted :: Nil), pt)(using quoteContext).select(nme.apply).appliedTo(qctx)
6367
else
6468
typedApply(untpd.Apply(untpd.ref(defn.InternalQuoted_exprQuote.termRef), tree.quoted), pt)(using pushQuoteContext(qctx)).select(nme.apply).appliedTo(qctx)
@@ -173,7 +177,9 @@ trait QuotesAndSplices {
173177
pat.select(tpnme.spliceType)
174178
else
175179
val tree1 = typedSelect(untpd.Select(tree.expr, tpnme.spliceType), pt)(using spliceContext).withSpan(tree.span)
176-
report.warning(em"Consider using canonical type reference ${tree1.tpe.show} instead", tree.srcPos)
180+
val msg = em"Consider using canonical type reference ${tree1.tpe} instead"
181+
if sourceVersion.isAtLeast(`3.1-migration`) then report.error(msg, tree.srcPos)
182+
else report.warning(msg, tree.srcPos)
177183
tree1
178184
}
179185

0 commit comments

Comments
 (0)