diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-04 15:44:04 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-17 18:34:27 +0100 |
commit | aecfb37919291f3d191aa3c04f753cc2df4d962a (patch) | |
tree | 298ae1cb5aa19f11b808d49a057c035084ccea70 /compiler/src/dotty/tools/dotc/parsing/Parsers.scala | |
parent | ee59c23e9033ed775c64583c849bd47cc3f195af (diff) | |
download | dotty-aecfb37919291f3d191aa3c04f753cc2df4d962a.tar.gz dotty-aecfb37919291f3d191aa3c04f753cc2df4d962a.tar.bz2 dotty-aecfb37919291f3d191aa3c04f753cc2df4d962a.zip |
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.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/parsing/Parsers.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 12 |
1 files changed, 11 insertions, 1 deletions
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 |