From aecfb37919291f3d191aa3c04f753cc2df4d962a Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 4 Dec 2016 15:44:04 +0100 Subject: Add code to disable old implicit closure syntax in blocks This will no longer be supported. On the other hand, as long as the alternative is not yet legal in Scala2.x we cannot flag this as an error. So the migration warning/error and patch code is currently disabled. --- compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'compiler/src/dotty/tools/dotc/parsing/Parsers.scala') diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 6fb10fd39..26656aae8 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1132,8 +1132,18 @@ object Parsers { val name = bindingName() val t = if (in.token == COLON && location == Location.InBlock) { + if (false) // Don't error yet, as the alternative syntax "implicit (x: T) => ... " + // is not supported by Scala2.x + migrationWarningOrError(s"This syntax is no longer supported; parameter needs to be enclosed in (...)") + in.nextToken() - infixType() + val t = infixType() + + if (false && in.isScala2Mode) { + patch(source, Position(start), "(") + patch(source, Position(in.lastOffset), ")") + } + t } else TypeTree() (atPos(start) { makeParameter(name, t, mods) }) :: Nil -- cgit v1.2.3