forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scala#17187 The no-indent rewrite sometimes needs to add several `}` at the same position, to close nested constructs. For example, it rewrites: ```scala object A: object B: def foo = 42 ``` Into: ```scala object A { object B { def foo = 42 } } ``` We deal with end marker in the `indentedToBraces` method by checking the next token of the region. This also fixes the following error: ```scala class A: def foo = 42 end A ``` Rewritten to ```scala class A { def foo = 42 } end A ``` Instead Of: ```scala class A { def foo = 42 } // end A ```
- Loading branch information
Showing
8 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
object A { | ||
object B { | ||
def a = 2 | ||
} | ||
} | ||
|
||
def m1 = { | ||
def b = { | ||
def c = 2 | ||
} | ||
} | ||
|
||
def m2 = | ||
if true then { | ||
val x = 3 | ||
if (false) | ||
x | ||
else { | ||
val y = 4 | ||
y | ||
} | ||
} | ||
|
||
def m3 = | ||
try { | ||
val n2 = 21 | ||
val n1 = 4 | ||
n2 / n1 | ||
} | ||
catch { | ||
case _ => 4 | ||
} | ||
|
||
def m4 = { | ||
val n2 = 21 | ||
try { | ||
val n1 = 4 | ||
n2 / n1 | ||
} | ||
catch { | ||
case _ => 4 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
object A: | ||
object B: | ||
def a = 2 | ||
|
||
def m1 = | ||
def b = | ||
def c = 2 | ||
|
||
def m2 = | ||
if true then | ||
val x = 3 | ||
if (false) | ||
x | ||
else | ||
val y = 4 | ||
y | ||
|
||
def m3 = | ||
try | ||
val n2 = 21 | ||
val n1 = 4 | ||
n2 / n1 | ||
catch | ||
case _ => 4 | ||
|
||
def m4 = | ||
val n2 = 21 | ||
try | ||
val n1 = 4 | ||
n2 / n1 | ||
catch | ||
case _ => 4 |