File tree 3 files changed +12
-4
lines changed
compiler/src/dotty/tools/dotc/parsing
3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1280,13 +1280,14 @@ object Parsers {
1280
1280
1281
1281
def argumentStart (): Unit =
1282
1282
colonAtEOLOpt()
1283
- if in.isScala2CompatMode && in.token == NEWLINE && in.next.token == LBRACE then
1283
+ if migrateTo3 && in.token == NEWLINE && in.next.token == LBRACE then
1284
1284
in.nextToken()
1285
1285
if in.indentWidth(in.offset) == in.currentRegion.indentWidth then
1286
- in .errorOrMigrationWarning(
1286
+ ctx .errorOrMigrationWarning(
1287
1287
i """ This opening brace will start a new statement in Scala 3.
1288
1288
|It needs to be indented to the right to keep being treated as
1289
- |an argument to the previous expression. ${rewriteNotice()}""" )
1289
+ |an argument to the previous expression. ${rewriteNotice()}""" ,
1290
+ in.sourcePos())
1290
1291
patch(source, Span (in.offset), " " )
1291
1292
1292
1293
def possibleTemplateStart (isNew : Boolean = false ): Unit =
Original file line number Diff line number Diff line change @@ -438,7 +438,7 @@ object Scanners {
438
438
def isContinuingParens () =
439
439
openParensTokens.contains(token)
440
440
&& ! pastBlankLine
441
- && ! isScala2CompatMode
441
+ && ! migrateTo3
442
442
&& ! noindentSyntax
443
443
444
444
/** The indentation width of the given offset */
Original file line number Diff line number Diff line change @@ -14,3 +14,10 @@ def f: Int => Int =
14
14
{ (x : Int ) =>
15
15
x + 1
16
16
}
17
+
18
+ val x =
19
+ true && // newline inserted here but skipped because of trailing &&
20
+ {
21
+ val xyz = true
22
+ xyz && false
23
+ }
You can’t perform that action at this time.
0 commit comments