From 688ed1b61d681e82c6f9fc6e6c7c743784f58a1a Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 22 May 2019 16:07:03 +0200 Subject: [PATCH] Move `@ _*` to `: _*` error under -strict Projects that cross-compile with Scala 2 cannot use the new syntax, and are therefore forced to set `-language:Scala2` currently even if they don't need any of the other changes enabled by this flag to compile. --- compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 6 ++++-- tests/{neg => neg-strict}/i1059.scala | 0 2 files changed, 4 insertions(+), 2 deletions(-) rename tests/{neg => neg-strict}/i1059.scala (100%) diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 1be923d6d778..481de5476db3 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1858,14 +1858,16 @@ object Parsers { // compatibility for Scala2 `x @ _*` syntax infixPattern() match { case pt @ Ident(tpnme.WILDCARD_STAR) => - migrationWarningOrError("The syntax `x @ _*' is no longer supported; use `x : _*' instead", startOffset(p)) + if (ctx.settings.strict.value) + migrationWarningOrError("The syntax `x @ _*' is no longer supported; use `x : _*' instead", startOffset(p)) atSpan(startOffset(p), offset) { Typed(p, pt) } case pt => atSpan(startOffset(p), 0) { Bind(name, pt) } } case p @ Ident(tpnme.WILDCARD_STAR) => // compatibility for Scala2 `_*` syntax - migrationWarningOrError("The syntax `_*' is no longer supported; use `x : _*' instead", startOffset(p)) + if (ctx.settings.strict.value) + migrationWarningOrError("The syntax `_*' is no longer supported; use `x : _*' instead", startOffset(p)) atSpan(startOffset(p)) { Typed(Ident(nme.WILDCARD), p) } case p => p diff --git a/tests/neg/i1059.scala b/tests/neg-strict/i1059.scala similarity index 100% rename from tests/neg/i1059.scala rename to tests/neg-strict/i1059.scala