Skip to content

Commit 5e924ef

Browse files
committed
Add -pending.txt tests
* `-pending.txt` test files, containing tests labeled with `:skip` that highlight known parsing issues in Scala syntax. * Updated `CONTRIBUTING.md` with a brief explanation of the `-pending.txt` test files.
1 parent 041dea1 commit 5e924ef

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed

CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Then adjust as necessary. Note that depending on your change you may also have
4343
to touch the `/src/scanner.c` file if you need more advanced features like
4444
look-ahead.
4545

46+
## Pending Tests
47+
48+
In `./test/corpus`, there are several files named `*-pending.txt`. These contain tests labeled with `:skip`, meaning they are not currently run. Each test includes examples of valid Scala syntax that `tree-sitter-scala` is known to fail to parse. If you’d like to contribute to `tree-sitter-scala`, a good place to start is by trying to fix one of these tests.
49+
4650
## Syntax highlighting
4751

4852
Right now the most common use-case for syntax highlight using tree-sitter is

test/corpus/definitions-pending.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
================================================================================
2+
Function without parens
3+
:skip
4+
================================================================================
5+
6+
// https://github.com/scala/scala3/blob/main/tests/pos/multiLineOps.scala#L15
7+
send_! "!"
8+
9+
--------------------------------------------------------------------------------
10+
11+
================================================================================
12+
Types of lambda parameters without parenthesis
13+
:skip
14+
================================================================================
15+
16+
// https://github.com/tree-sitter/tree-sitter-scala/issues/361
17+
xs.map { x: Int => x }

test/corpus/expressions-pending.txt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
================================================================================
2+
Trailing coma after for comprehension in lambda parameter of a function
3+
:skip
4+
================================================================================
5+
6+
// https://github.com/tree-sitter/tree-sitter-scala/issues/449
7+
object Foo:
8+
def foo(f: Option[Int] => Option[Int]): Option[Int] = f(None)
9+
10+
foo(o =>
11+
for {
12+
a <- o
13+
} yield a,
14+
)
15+
16+
--------------------------------------------------------------------------------
17+
18+
================================================================================
19+
Lambda expression with semicolon
20+
:skip
21+
================================================================================
22+
23+
// https://github.com/tree-sitter/tree-sitter-scala/issues/389
24+
TypeTreeWithDeferredRefCheck() { () => val tp = qual.tpe; val sym = tp.typeSymbolDirect
25+
1
26+
}
27+
28+
val l1 = { () => val x = 1; 2 }
29+
30+
--------------------------------------------------------------------------------
31+
32+
================================================================================
33+
infix_expression across multiple lines
34+
:skip
35+
================================================================================
36+
37+
// https://github.com/tree-sitter/tree-sitter-scala/issues/141
38+
def foo: Boolean =
39+
x
40+
|| a.b(c)
41+
42+
--------------------------------------------------------------------------------
43+

test/corpus/patterns-pending.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
================================================================================
2+
Infix types in match type cases
3+
:skip
4+
================================================================================
5+
6+
// https://github.com/tree-sitter/tree-sitter-scala/issues/360
7+
type F[T] = T match {
8+
case t *: EmptyTuple => t
9+
case t *: rest => t
10+
}
11+
12+
--------------------------------------------------------------------------------

test/corpus/types-pending.txt

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
================================================================================
3+
Subclass with multiline params and unnamed after named param
4+
:skip
5+
================================================================================
6+
7+
// https://github.com/tree-sitter/tree-sitter-scala/issues/465
8+
// https://github.com/scala/scala3/blob/main/tests/run/i14164.scala#L5-L9
9+
class Child extends Base(
10+
param =
11+
for x <- Seq("a") yield x
12+
"param"
13+
)
14+
15+
--------------------------------------------------------------------------------
16+
17+
================================================================================
18+
case class nested in an object definition
19+
:skip
20+
================================================================================
21+
22+
// https://github.com/tree-sitter/tree-sitter-scala/issues/329
23+
object Merge:
24+
25+
case class Location(runIndex: Int, locationInRun: String):
26+
end Location
27+
28+
end Merge
29+
30+
--------------------------------------------------------------------------------
31+
32+
================================================================================
33+
More than two argument lists in `extends`
34+
:skip
35+
================================================================================
36+
37+
// https://github.com/tree-sitter/tree-sitter-scala/issues/259
38+
class A extends B(c)(d)(e)
39+
40+
--------------------------------------------------------------------------------

0 commit comments

Comments
 (0)