Skip to content

Commit 0afce7e

Browse files
committed
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.
1 parent f9e0918 commit 0afce7e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,18 @@ object Parsers {
11281128
val name = bindingName()
11291129
val t =
11301130
if (in.token == COLON && location == Location.InBlock) {
1131+
if (false) // Don't error yet, as the alternative syntax "implicit (x: T) => ... "
1132+
// is not supported by Scala2.x
1133+
migrationWarningOrError(s"This syntax is no longer supported; parameter needs to be enclosed in (...)")
1134+
11311135
in.nextToken()
1132-
infixType()
1136+
val t = infixType()
1137+
1138+
if (false && in.isScala2Mode) {
1139+
patch(source, Position(start), "(")
1140+
patch(source, Position(in.lastOffset), ")")
1141+
}
1142+
t
11331143
}
11341144
else TypeTree()
11351145
(atPos(start) { makeParameter(name, t, mods) }) :: Nil

0 commit comments

Comments
 (0)