Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add -pending.txt tests #463

Merged
merged 1 commit into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Then adjust as necessary. Note that depending on your change you may also have
to touch the `/src/scanner.c` file if you need more advanced features like
look-ahead.

## Pending Tests

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.

## Syntax highlighting

Right now the most common use-case for syntax highlight using tree-sitter is
Expand Down
17 changes: 17 additions & 0 deletions test/corpus/definitions-pending.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
================================================================================
Function without parens
:skip
================================================================================

// https://github.com/scala/scala3/blob/main/tests/pos/multiLineOps.scala#L15
send_! "!"

--------------------------------------------------------------------------------

================================================================================
Types of lambda parameters without parenthesis
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/361
xs.map { x: Int => x }
43 changes: 43 additions & 0 deletions test/corpus/expressions-pending.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
================================================================================
Trailing coma after for comprehension in lambda parameter of a function
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/449
object Foo:
def foo(f: Option[Int] => Option[Int]): Option[Int] = f(None)

foo(o =>
for {
a <- o
} yield a,
)

--------------------------------------------------------------------------------

================================================================================
Lambda expression with semicolon
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/389
TypeTreeWithDeferredRefCheck() { () => val tp = qual.tpe; val sym = tp.typeSymbolDirect
1
}

val l1 = { () => val x = 1; 2 }

--------------------------------------------------------------------------------

================================================================================
infix_expression across multiple lines
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/141
def foo: Boolean =
x
|| a.b(c)

--------------------------------------------------------------------------------

12 changes: 12 additions & 0 deletions test/corpus/patterns-pending.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
================================================================================
Infix types in match type cases
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/360
type F[T] = T match {
case t *: EmptyTuple => t
case t *: rest => t
}

--------------------------------------------------------------------------------
40 changes: 40 additions & 0 deletions test/corpus/types-pending.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

================================================================================
Subclass with multiline params and unnamed after named param
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/465
// https://github.com/scala/scala3/blob/main/tests/run/i14164.scala#L5-L9
class Child extends Base(
param =
for x <- Seq("a") yield x
"param"
)

--------------------------------------------------------------------------------

================================================================================
case class nested in an object definition
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/329
object Merge:

case class Location(runIndex: Int, locationInRun: String):
end Location

end Merge

--------------------------------------------------------------------------------

================================================================================
More than two argument lists in `extends`
:skip
================================================================================

// https://github.com/tree-sitter/tree-sitter-scala/issues/259
class A extends B(c)(d)(e)

--------------------------------------------------------------------------------
Loading