Skip to content

Commit c3ebebe

Browse files
authored
Merge pull request #14066 from dotty-staging/fix-14061
Don't insert INDENT/UNINDENT without anything in between
2 parents fc7e8c3 + e315891 commit c3ebebe

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ object Scanners {
539539
|| nextWidth == lastWidth && (indentPrefix == MATCH || indentPrefix == CATCH) && token != CASE then
540540
if currentRegion.isOutermost then
541541
if nextWidth < lastWidth then currentRegion = topLevelRegion(nextWidth)
542-
else if !isLeadingInfixOperator(nextWidth) && !statCtdTokens.contains(lastToken) then
542+
else if !isLeadingInfixOperator(nextWidth) && !statCtdTokens.contains(lastToken) && lastToken != INDENT then
543543
currentRegion match
544544
case r: Indented =>
545545
currentRegion = r.enclosing

tests/pos/i14061.scala

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def main(args: Array[String]): Unit =
2+
val bar: PartialFunction[Throwable, Unit] =
3+
case e: IllegalArgumentException => e.printStackTrace
4+
case e: Throwable => e.printStackTrace
5+
try
6+
println("a")
7+
catch
8+
bar
9+
finally
10+
println("a")

0 commit comments

Comments
 (0)