diff --git a/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala b/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala index 623f540bd721..787caf81cd07 100644 --- a/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala +++ b/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala @@ -112,7 +112,7 @@ object SyntaxHighlighting { highlightPosition(tree.nameSpan, TypeColor) case tree: Ident if tree.isType => highlightPosition(tree.span, TypeColor) - case _: TypTree => + case _: TypeTree => highlightPosition(tree.span, TypeColor) case _ => } diff --git a/compiler/test/dotty/tools/dotc/printing/SyntaxHighlightingTests.scala b/compiler/test/dotty/tools/dotc/printing/SyntaxHighlightingTests.scala index 53a66f1d24fb..35355fd20828 100644 --- a/compiler/test/dotty/tools/dotc/printing/SyntaxHighlightingTests.scala +++ b/compiler/test/dotty/tools/dotc/printing/SyntaxHighlightingTests.scala @@ -23,7 +23,9 @@ class SyntaxHighlightingTests extends DottyTest { if (expected != highlighted) { // assertEquals produces weird expected/found message - fail(s"expected: $expected but was: $highlighted") + fail(s"""| + |expected: $expected + |highlighted: $highlighted""".stripMargin) } } @@ -41,6 +43,8 @@ class SyntaxHighlightingTests extends DottyTest { test("type Foo = Int", " = ") test("type A = String | Int", " = ") test("type B = String & Int", " = ") + test("type Id[A] = A", " [] = ") + test("type Foo = [X] =>> List[X]", " = [] =>> []") } @Test @@ -88,6 +92,10 @@ class SyntaxHighlightingTests extends DottyTest { test("val foo", " ") test("val foo =", " =") test("val foo = 123", " = ") + test( + "val foo: List[List[Int]] = List(List(1))", + " : [[]] = List(List())" + ) test("var", "") test("var foo", " ") @@ -111,7 +119,7 @@ class SyntaxHighlightingTests extends DottyTest { test("def f1(x: Int) = 123", " (: ) = ") test("def f2[T](x: T) = { 123 }", " [](: ) = { }") - test("def f3[T[_", " [[") + test("def f3[T[_", " [[_") } @Test