Skip to content

Commit

Permalink
Test vararg pattern match rewrite in scala3
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 7, 2024
1 parent 0cd788a commit 4368e04
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions scalafmt-tests/shared/src/test/resources/scala3/Vararg.stat
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,41 @@ a match {
val a = List(0, 1, 1*2)
>>>
val a = List(0, 1, 1 * 2)
<<< #4133 intellij-scala tasty-reader TreePrinter.scala
rewrite.scala3.convertToNewSyntax = true
===
node match {
case Node3(PACKAGE, _, Seq(Node3(TERMREFpkg, Seq("scala.annotation.internal"), zxc), children: _*)) =>
children.filterNot(_.tag == IMPORT).exists {
case Node3(TYPEDEF, Seq("SourceFile"), _) => true
case _ => false
}
case _ =>
false
}
>>>
test does not parse: [dialect scala3] illegal start of simple pattern
Node3(TERMREFpkg, Seq("scala.annotation.internal"), zxc),
children:*
)
^
) =>
children.filterNot(_.tag == IMPORT).exists {
case Node3(TYPEDEF, Seq("SourceFile"), _) => true
====== full result: ======
node match {
case Node3(
PACKAGE,
_,
Seq(
Node3(TERMREFpkg, Seq("scala.annotation.internal"), zxc),
children:*
)
) =>
children.filterNot(_.tag == IMPORT).exists {
case Node3(TYPEDEF, Seq("SourceFile"), _) => true
case _ => false
}
case _ =>
false
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
override def afterAll(): Unit = {
logger.debug(s"Total explored: ${Debug.explored}")
if (!onlyUnit && !onlyManual)
assertEquals(Debug.explored, 1785448, "total explored")
assertEquals(Debug.explored, 1785581, "total explored")
val results = debugResults.result()
// TODO(olafur) don't block printing out test results.
// I don't want to deal with scalaz's Tasks :'(
Expand Down

0 comments on commit 4368e04

Please sign in to comment.