Skip to content

Commit a69c010

Browse files
committed
Drop NewLineSignificantRegion
1 parent ef0e7e0 commit a69c010

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,11 @@ object Parsers {
650650

651651
/** Check that this is not the start of a statement that's indented relative to the current region.
652652
*/
653-
def checkNextNotIndented(): Unit = in.currentRegion match
654-
case r: NewLineSignificantRegion if in.isNewLine =>
653+
def checkNextNotIndented(): Unit =
654+
if in.isNewLine then
655655
val nextIndentWidth = in.indentWidth(in.next.offset)
656-
if r.indentWidth < nextIndentWidth then
656+
if in.currentRegion.indentWidth < nextIndentWidth then
657657
warning(i"Line is indented too far to the right, or a `{` or `:` is missing", in.next.offset)
658-
case _ =>
659658

660659
/* -------- REWRITES ----------------------------------------------------------- */
661660

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,19 +1399,16 @@ object Scanners {
13991399
if knownWidth == null then IndentWidth.Zero else knownWidth
14001400
end Region
14011401

1402-
trait NewLineSignificantRegion extends Region
1403-
14041402
case class InString(multiLine: Boolean, outer: Region) extends Region
14051403
case class InParens(prefix: Token, outer: Region) extends Region
1406-
case class InBraces(outer: Region) extends NewLineSignificantRegion
1404+
case class InBraces(outer: Region) extends Region
14071405

14081406
/** A class describing an indentation region.
14091407
* @param width The principal indendation width
14101408
* @param others Other indendation widths > width of lines in the same region
14111409
* @param prefix The token before the initial <indent> of the region
14121410
*/
1413-
case class Indented(width: IndentWidth, others: Set[IndentWidth], prefix: Token, outer: Region | Null)
1414-
extends NewLineSignificantRegion:
1411+
case class Indented(width: IndentWidth, others: Set[IndentWidth], prefix: Token, outer: Region | Null) extends Region:
14151412
knownWidth = width
14161413

14171414
enum IndentWidth {

0 commit comments

Comments
 (0)