@@ -301,9 +301,6 @@ object Parsers {
301
301
def deprecationWarning (msg : => Message , offset : Int = in.offset): Unit =
302
302
ctx.deprecationWarning(msg, source.atSpan(Span (offset)))
303
303
304
- def errorOrMigrationWarning (msg : => Message , offset : Int = in.offset): Unit =
305
- ctx.errorOrMigrationWarning(msg, source.atSpan(Span (offset)))
306
-
307
304
/** Issue an error at current offset that input is incomplete */
308
305
def incompleteInputError (msg : => Message ): Unit =
309
306
ctx.incompleteInputError(msg, source.atSpan(Span (in.offset)))
@@ -392,12 +389,6 @@ object Parsers {
392
389
finally staged = saved
393
390
}
394
391
395
- def migrationWarningOrError (msg : String , offset : Int = in.offset): Unit =
396
- if (in.isScala2Mode)
397
- ctx.migrationWarning(msg, source.atSpan(Span (offset)))
398
- else
399
- syntaxError(msg, offset)
400
-
401
392
/* ---------- TREE CONSTRUCTION ------------------------------------------- */
402
393
403
394
/** Convert tree to formal parameter list
@@ -780,9 +771,9 @@ object Parsers {
780
771
Quote (t)
781
772
}
782
773
else {
783
- migrationWarningOrError (em """ symbol literal ' ${in.name} is no longer supported,
784
- |use a string literal " ${in.name}" or an application Symbol(" ${in.name}") instead,
785
- |or enclose in braces '{ ${in.name}} if you want a quoted expression. """ )
774
+ in.errorOrMigrationWarning (em """ symbol literal ' ${in.name} is no longer supported,
775
+ |use a string literal " ${in.name}" or an application Symbol(" ${in.name}") instead,
776
+ |or enclose in braces '{ ${in.name}} if you want a quoted expression. """ )
786
777
if (in.isScala2Mode) {
787
778
patch(source, Span (in.offset, in.offset + 1 ), " Symbol(\" " )
788
779
patch(source, Span (in.charOffset - 1 ), " \" )" )
@@ -1216,7 +1207,7 @@ object Parsers {
1216
1207
AppliedTypeTree (toplevelTyp(), Ident (pname))
1217
1208
} :: contextBounds(pname)
1218
1209
case VIEWBOUND =>
1219
- errorOrMigrationWarning(" view bounds `<%' are deprecated, use a context bound `:' instead" )
1210
+ in. errorOrMigrationWarning(" view bounds `<%' are deprecated, use a context bound `:' instead" )
1220
1211
atSpan(in.skipToken()) {
1221
1212
Function (Ident (pname) :: Nil , toplevelTyp())
1222
1213
} :: contextBounds(pname)
@@ -1525,7 +1516,7 @@ object Parsers {
1525
1516
if (ctx.settings.strict.value)
1526
1517
// Don't error in non-strict mode, as the alternative syntax "implicit (x: T) => ... "
1527
1518
// is not supported by Scala2.x
1528
- migrationWarningOrError (s " This syntax is no longer supported; parameter needs to be enclosed in (...) " )
1519
+ in.errorOrMigrationWarning (s " This syntax is no longer supported; parameter needs to be enclosed in (...) " )
1529
1520
in.nextToken()
1530
1521
val t = infixType()
1531
1522
if (false && in.isScala2Mode) {
@@ -1933,15 +1924,15 @@ object Parsers {
1933
1924
infixPattern() match {
1934
1925
case pt @ Ident (tpnme.WILDCARD_STAR ) =>
1935
1926
if (ctx.settings.strict.value)
1936
- migrationWarningOrError (" The syntax `x @ _*' is no longer supported; use `x : _*' instead" , startOffset(p))
1927
+ in.errorOrMigrationWarning (" The syntax `x @ _*' is no longer supported; use `x : _*' instead" , Span ( startOffset(p) ))
1937
1928
atSpan(startOffset(p), offset) { Typed (p, pt) }
1938
1929
case pt =>
1939
1930
atSpan(startOffset(p), 0 ) { Bind (name, pt) }
1940
1931
}
1941
1932
case p @ Ident (tpnme.WILDCARD_STAR ) =>
1942
1933
// compatibility for Scala2 `_*` syntax
1943
1934
if (ctx.settings.strict.value)
1944
- migrationWarningOrError (" The syntax `_*' is no longer supported; use `x : _*' instead" , startOffset(p))
1935
+ in.errorOrMigrationWarning (" The syntax `_*' is no longer supported; use `x : _*' instead" , Span ( startOffset(p) ))
1945
1936
atSpan(startOffset(p)) { Typed (Ident (nme.WILDCARD ), p) }
1946
1937
case p =>
1947
1938
p
0 commit comments