Skip to content

Commit 516c48d

Browse files
committed
Fix scala#4400 Allow keyword start after numbers
1 parent d14c89b commit 516c48d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ object SyntaxHighlighting {
7979
} else {
8080
if (n.isUpper && (keywordStart || prev == '.')) {
8181
appendWhile(n, !typeEnders.contains(_), typeDef)
82-
} else if (keywordStart) {
82+
} else if (keywordStart || prev.isDigit) {
8383
append(n, keywords.contains(_), { kw =>
8484
if (kw == "new") typeDef(kw) else keyword(kw)
8585
})

compiler/test/dotty/tools/dotc/printing/SyntaxHighlightingTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class SyntaxHighlightingTests {
6060
@Test
6161
def expressions = {
6262
test("val x = 1 + 2 + 3", "<K|val> <V|x> = <L|1> + <L|2> + <L|3>")
63+
test("if(true) 3 else 1", "<K|if>(<K|true>) <L|3> <K|else> <L|1>")
6364
}
6465

6566
@Test

0 commit comments

Comments
 (0)