Skip to content

Commit

Permalink
fix(scala#11202): explicitly handle TypeTree in syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
ckipp01 committed Feb 19, 2022
1 parent 29f9d33 commit 82ae5cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 _ =>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -41,6 +43,8 @@ class SyntaxHighlightingTests extends DottyTest {
test("type Foo = Int", "<K|type> <T|Foo> = <T|Int>")
test("type A = String | Int", "<K|type> <T|A> = <T|String> <T||> <T|Int>")
test("type B = String & Int", "<K|type> <T|B> = <T|String> <T|&> <T|Int>")
test("type Id[A] = A", "<K|type> <T|Id>[<T|A>] = <T|A>")
test("type Foo = [X] =>> List[X]", "<K|type> <T|Foo> = [<T|X>] =>> <T|List>[<T|X>]")
}

@Test
Expand Down Expand Up @@ -111,7 +115,7 @@ class SyntaxHighlightingTests extends DottyTest {
test("def f1(x: Int) = 123", "<K|def> <V|f1>(<V|x>: <T|Int>) = <L|123>")
test("def f2[T](x: T) = { 123 }", "<K|def> <V|f2>[<T|T>](<V|x>: <T|T>) = { <L|123> }")

test("def f3[T[_", "<K|def> <V|f3>[<T|T>[<T|_>")
test("def f3[T[_", "<K|def> <V|f3>[<T|T>[_")
}

@Test
Expand Down

0 comments on commit 82ae5cc

Please sign in to comment.