Skip to content

Commit

Permalink
feature: Allow fewer braces for Scala 3.3.x
Browse files Browse the repository at this point in the history
Follow up from scala/scala3#16297
  • Loading branch information
tgodzik committed Nov 8, 2022
1 parent e65b4c9 commit 4cf2564
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ object Dialect extends InternalDialect {
Scala30,
Scala31,
Scala32,
Scala33,
Paradise211,
Paradise212,
ParadiseTypelevel211,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ package object dialects {

implicit val Scala32 = Scala31

implicit val Scala3 = Scala32
implicit val Scala33 = Scala32.withAllowFewerBraces(true)

implicit val Scala3 = Scala33

implicit val Scala3Future = Scala3
.withAllowUnderscoreAsTypePlaceholder(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class SurfaceSuite extends FunSuite {
|scala.meta.dialects.Scala30 *
|scala.meta.dialects.Scala31 *
|scala.meta.dialects.Scala32 *
|scala.meta.dialects.Scala33 *
|scala.meta.dialects.Scala3Future *
|scala.meta.dialects.Typelevel211 *
|scala.meta.dialects.Typelevel212 *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import scala.meta._

class FewerBracesSuite extends BaseDottySuite {

protected override implicit val dialect = dialects.Scala3.withAllowFewerBraces(true)

test("simple") {
runTestAssert[Stat](
"""|val firstLine = files.get(fileName).fold:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class PublicSuite extends TreeSuiteBase {
}

test("scala.meta.dialects.Scala3.toString") {
assertNoDiff(scala.meta.dialects.Scala3.toString, "Scala32")
assertNoDiff(scala.meta.dialects.Scala3.toString, "Scala33")
}

test("scala.meta.dialects.Scala30.toString") {
Expand All @@ -109,6 +109,10 @@ class PublicSuite extends TreeSuiteBase {
assertNoDiff(scala.meta.dialects.Scala32.toString, "Scala32")
}

test("scala.meta.dialects.Scala33.toString") {
assertNoDiff(scala.meta.dialects.Scala33.toString, "Scala33")
}

test("scala.meta.dialects.Scala3Future.toString") {
assertNoDiff(scala.meta.dialects.Scala3Future.toString.substring(0, 6), "Scala3")
}
Expand Down

0 comments on commit 4cf2564

Please sign in to comment.