Skip to content

Commit 1629f99

Browse files
committed
Fix keywordStart instead
1 parent 110dc33 commit 1629f99

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object SyntaxHighlighting {
5454
@forceInline def keywordStart =
5555
prev == 0 || prev == ' ' || prev == '{' || prev == '(' ||
5656
prev == '\n' || prev == '[' || prev == ',' || prev == ':' ||
57-
prev == '|' || prev == '&'
57+
prev == '|' || prev == '&' || prev.isDigit
5858

5959
@forceInline def numberStart(c: Char) =
6060
c.isDigit && (!prev.isLetter || prev == '.' || prev == ' ' || prev == '(' || prev == '\u0000')
@@ -79,7 +79,7 @@ object SyntaxHighlighting {
7979
} else {
8080
if (n.isUpper && (keywordStart || prev == '.')) {
8181
appendWhile(n, !typeEnders.contains(_), typeDef)
82-
} else if (keywordStart || prev.isDigit) {
82+
} else if (keywordStart) {
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class SyntaxHighlightingTests {
6464
@Test
6565
def expressions = {
6666
test("val x = 1 + 2 + 3", "<K|val> <V|x> = <L|1> + <L|2> + <L|3>")
67-
test("if(true) 3 else 1", "<K|if>(<K|true>) <L|3> <K|else> <L|1>")
67+
test("if (true) 3 else 1", "<K|if> (<K|true>) <L|3> <K|else> <L|1>")
6868
}
6969

7070
@Test

0 commit comments

Comments
 (0)