@@ -301,9 +301,6 @@ object Parsers {
301301 def deprecationWarning (msg : => Message , offset : Int = in.offset): Unit =
302302 ctx.deprecationWarning(msg, source.atSpan(Span (offset)))
303303
304- def errorOrMigrationWarning (msg : => Message , offset : Int = in.offset): Unit =
305- ctx.errorOrMigrationWarning(msg, source.atSpan(Span (offset)))
306-
307304 /** Issue an error at current offset that input is incomplete */
308305 def incompleteInputError (msg : => Message ): Unit =
309306 ctx.incompleteInputError(msg, source.atSpan(Span (in.offset)))
@@ -392,12 +389,6 @@ object Parsers {
392389 finally staged = saved
393390 }
394391
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-
401392/* ---------- TREE CONSTRUCTION ------------------------------------------- */
402393
403394 /** Convert tree to formal parameter list
@@ -780,9 +771,9 @@ object Parsers {
780771 Quote (t)
781772 }
782773 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. """ )
786777 if (in.isScala2Mode) {
787778 patch(source, Span (in.offset, in.offset + 1 ), " Symbol(\" " )
788779 patch(source, Span (in.charOffset - 1 ), " \" )" )
@@ -1216,7 +1207,7 @@ object Parsers {
12161207 AppliedTypeTree (toplevelTyp(), Ident (pname))
12171208 } :: contextBounds(pname)
12181209 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" )
12201211 atSpan(in.skipToken()) {
12211212 Function (Ident (pname) :: Nil , toplevelTyp())
12221213 } :: contextBounds(pname)
@@ -1525,7 +1516,7 @@ object Parsers {
15251516 if (ctx.settings.strict.value)
15261517 // Don't error in non-strict mode, as the alternative syntax "implicit (x: T) => ... "
15271518 // 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 (...) " )
15291520 in.nextToken()
15301521 val t = infixType()
15311522 if (false && in.isScala2Mode) {
@@ -1933,15 +1924,15 @@ object Parsers {
19331924 infixPattern() match {
19341925 case pt @ Ident (tpnme.WILDCARD_STAR ) =>
19351926 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) ))
19371928 atSpan(startOffset(p), offset) { Typed (p, pt) }
19381929 case pt =>
19391930 atSpan(startOffset(p), 0 ) { Bind (name, pt) }
19401931 }
19411932 case p @ Ident (tpnme.WILDCARD_STAR ) =>
19421933 // compatibility for Scala2 `_*` syntax
19431934 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) ))
19451936 atSpan(startOffset(p)) { Typed (Ident (nme.WILDCARD ), p) }
19461937 case p =>
19471938 p
0 commit comments