Skip to content

Commit 6a2ef9f

Browse files
committed
Add indent rewrite tests
1 parent a420945 commit 6a2ef9f

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,6 @@ object Scanners:
744744
if endMarkerTokens.contains(lookahead.token)
745745
&& source.offsetToLine(lookahead.offset) == endLine
746746
then
747-
if rewriteToIndent && lookahead.token == MATCH then
748-
patch(Span(offset, offset + 3), "`end`")
749747
lookahead.nextToken()
750748
if lookahead.token == EOF
751749
|| source.offsetToLine(lookahead.offset) > endLine

tests/rewrites/indent-rewrite.check

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,14 @@ do not indent in a multiline string"""
221221
m18
222222
}
223223

224+
// back-quote end indent before match
225+
def m20 =
226+
val end = "Foo"
227+
`end` match
228+
case "Foo" =>
229+
case _ =>
230+
end take 3
231+
224232
// indent template after self type
225233
class C2 { self =>
226234
val x = ""

tests/rewrites/indent-rewrite.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@ m10 { 5 } {
249249
m18
250250
}
251251
}
252+
253+
// back-quote end indent before match
254+
def m20 =
255+
val end = "Foo"
256+
end match {
257+
case "Foo" =>
258+
case _ =>
259+
}
260+
end take 3
252261
}
253262

254263
// indent template after self type

0 commit comments

Comments
 (0)