Skip to content

Commit

Permalink
Add a full structure test for intermittent failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Sep 14, 2023
1 parent 2e3b5a6 commit 29f039d
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.scalafmt

import munit.FunSuite

import scala.meta._
import scala.meta.internal.parsers.ScalametaParser

class CustomStructureTest extends FunSuite {

private def check(
original: String,
expected: Tree,
dialect: Dialect = dialects.Scala213
)(implicit loc: munit.Location): Unit = {
val parser = new ScalametaParser(Input.String(original))(dialect)
assertNoDiff(parser.parseStat().structure, expected.structure)
}

// #3634
check(
"""
|def foo(a: Foo[_]): Unit = ???
""".stripMargin,
Defn.Def(
Nil,
Term.Name("foo"),
List(
Member.ParamClauseGroup(
Type.ParamClause(Nil),
List(
Term.ParamClause(
List(
Term.Param(
Nil,
Term.Name("a"),
Some(
Type.Apply(
Type.Name("Foo"),
Type.ArgClause(
List(Type.Wildcard(Type.Bounds(None, None)))
)
)
),
None
)
),
None
)
)
)
),
Some(Type.Name("Unit")),
Term.Name("???")
),
dialects.Scala3
)

}

0 comments on commit 29f039d

Please sign in to comment.