From 6fe560cf33bdb86d93cf2269406451b09ec84eba Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 25 Aug 2024 20:28:21 +0900 Subject: [PATCH] Update scalafmt config --- .scalafmt.conf | 4 ++++ .../scala-2/scalaprops/ScalapropsShapeless.scala | 2 +- .../scala-2/scalaprops/derive/Instances.scala | 2 +- .../main/scala-2/scalaprops/derive/MkCogen.scala | 2 +- .../main/scala-2/scalaprops/derive/MkGen.scala | 2 +- .../scala-2/scalaprops/derive/MkShrink.scala | 2 +- .../scala-2/scalaprops/derive/Singletons.scala | 4 ++-- .../scala-3/scalaprops/ScalapropsShapeless.scala | 8 ++++---- .../scala-2/scalaprops/TestsDefinitions.scala | 6 +++--- .../src/test/scala-2/scalaprops/CogenTests.scala | 10 +++++----- .../src/test/scala-2/scalaprops/GenTests.scala | 16 ++++++++-------- .../test/scala-2/scalaprops/PropertyTests.scala | 2 +- .../test/scala-2/scalaprops/ShrinkTests.scala | 12 ++++++------ .../scala-2/scalaprops/SingletonsTests.scala | 4 ++-- .../src/test/scala-2/scalaprops/SizeTests.scala | 6 +++--- 15 files changed, 43 insertions(+), 39 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index d807566..2b3f2c5 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -8,3 +8,7 @@ includeCurlyBraceInSelectChains = false optIn.breakChainOnFirstMethodDot = false version = "3.8.3" runner.dialect = Scala3 +rewrite.scala3.convertToNewSyntax = true +rewrite.scala3.newSyntax.control = false +runner.dialectOverride.allowUnderscoreAsTypePlaceholder = false +runner.dialectOverride.allowSignificantIndentation = false diff --git a/core/shared/src/main/scala-2/scalaprops/ScalapropsShapeless.scala b/core/shared/src/main/scala-2/scalaprops/ScalapropsShapeless.scala index 6e49722..65cbf89 100644 --- a/core/shared/src/main/scala-2/scalaprops/ScalapropsShapeless.scala +++ b/core/shared/src/main/scala-2/scalaprops/ScalapropsShapeless.scala @@ -1,6 +1,6 @@ package scalaprops -import derive._ +import derive.* sealed abstract class ScalapropsShapeless extends SingletonInstances diff --git a/core/shared/src/main/scala-2/scalaprops/derive/Instances.scala b/core/shared/src/main/scala-2/scalaprops/derive/Instances.scala index f57f2c2..5502b3d 100644 --- a/core/shared/src/main/scala-2/scalaprops/derive/Instances.scala +++ b/core/shared/src/main/scala-2/scalaprops/derive/Instances.scala @@ -2,7 +2,7 @@ package scalaprops.derive import scalaprops.{Cogen, Gen, Shrink} import shapeless.{Coproduct, HList, LowPriority, Strict, Witness} -import shapeless.labelled._ +import shapeless.labelled.* trait SingletonInstances { implicit def genSingletonType[S](implicit w: Witness.Aux[S]): Gen[S] = diff --git a/core/shared/src/main/scala-2/scalaprops/derive/MkCogen.scala b/core/shared/src/main/scala-2/scalaprops/derive/MkCogen.scala index 8536080..d9ade0c 100644 --- a/core/shared/src/main/scala-2/scalaprops/derive/MkCogen.scala +++ b/core/shared/src/main/scala-2/scalaprops/derive/MkCogen.scala @@ -1,7 +1,7 @@ package scalaprops package derive -import shapeless._ +import shapeless.* /** * Derives `Cogen[T]` instances for `T` an `HList`, a `Coproduct`, diff --git a/core/shared/src/main/scala-2/scalaprops/derive/MkGen.scala b/core/shared/src/main/scala-2/scalaprops/derive/MkGen.scala index e3de55e..3194902 100644 --- a/core/shared/src/main/scala-2/scalaprops/derive/MkGen.scala +++ b/core/shared/src/main/scala-2/scalaprops/derive/MkGen.scala @@ -1,7 +1,7 @@ package scalaprops package derive -import shapeless._ +import shapeless.* /** * Derives `Gen[T]` instances for `T` an `HList`, a `Coproduct`, diff --git a/core/shared/src/main/scala-2/scalaprops/derive/MkShrink.scala b/core/shared/src/main/scala-2/scalaprops/derive/MkShrink.scala index fcee0ca..37a7421 100644 --- a/core/shared/src/main/scala-2/scalaprops/derive/MkShrink.scala +++ b/core/shared/src/main/scala-2/scalaprops/derive/MkShrink.scala @@ -1,7 +1,7 @@ package scalaprops package derive -import shapeless._ +import shapeless.* /** * Derives `Shrink[T]` instances for `T` an `HList`, a `Coproduct`, diff --git a/core/shared/src/main/scala-2/scalaprops/derive/Singletons.scala b/core/shared/src/main/scala-2/scalaprops/derive/Singletons.scala index 54a71af..9e39026 100644 --- a/core/shared/src/main/scala-2/scalaprops/derive/Singletons.scala +++ b/core/shared/src/main/scala-2/scalaprops/derive/Singletons.scala @@ -1,7 +1,7 @@ package scalaprops.derive -import shapeless._ -import shapeless.labelled._ +import shapeless.* +import shapeless.labelled.* /** * Type class providing the instances of `T` that can be built out of diff --git a/core/shared/src/main/scala-3/scalaprops/ScalapropsShapeless.scala b/core/shared/src/main/scala-3/scalaprops/ScalapropsShapeless.scala index 8531728..d6dd4ff 100644 --- a/core/shared/src/main/scala-3/scalaprops/ScalapropsShapeless.scala +++ b/core/shared/src/main/scala-3/scalaprops/ScalapropsShapeless.scala @@ -22,7 +22,7 @@ sealed abstract class ScalapropsShapelessInstances { } inline implicit def genProduct[A](using inst: => K0.ProductInstances[Gen, A]): Gen[A] = - Gen.gen[A]((size, rand) => + Gen.gen[A] { (size, rand) => val (x, y) = inst.unfold[Rand](rand) { [t] => (r: Rand, g: Gen[t]) => { @@ -31,10 +31,10 @@ sealed abstract class ScalapropsShapelessInstances { } } (x, y.get) - ) + } inline implicit def genCoproduct[A](using inst: => K0.CoproductInstances[Gen, A], mirror: Mirror.SumOf[A]): Gen[A] = - Gen.gen[A]((size, r1) => + Gen.gen[A] { (size, r1) => val (r2, i) = r1.nextInt val index = if (i == Int.MinValue) { 0 @@ -44,7 +44,7 @@ sealed abstract class ScalapropsShapelessInstances { inst.inject[(Rand, A)](index) { [t <: A] => (g: Gen[t]) => g.f(size, r2) } - ) + } } diff --git a/test/shared/src/main/scala-2/scalaprops/TestsDefinitions.scala b/test/shared/src/main/scala-2/scalaprops/TestsDefinitions.scala index b9063e2..2d50625 100644 --- a/test/shared/src/main/scala-2/scalaprops/TestsDefinitions.scala +++ b/test/shared/src/main/scala-2/scalaprops/TestsDefinitions.scala @@ -2,9 +2,9 @@ package scalaprops import scalaprops.derive.Recursive -import shapeless.{Lazy => _, _} -import shapeless.record._ -import shapeless.union._ +import shapeless.{Lazy as _, *} +import shapeless.record.* +import shapeless.union.* object TestsDefinitions { case class Simple(i: Int, s: String, blah: Boolean) diff --git a/test/shared/src/test/scala-2/scalaprops/CogenTests.scala b/test/shared/src/test/scala-2/scalaprops/CogenTests.scala index 0c1df31..3857c8b 100644 --- a/test/shared/src/test/scala-2/scalaprops/CogenTests.scala +++ b/test/shared/src/test/scala-2/scalaprops/CogenTests.scala @@ -1,17 +1,17 @@ package scalaprops -import scalaprops.derive._ +import scalaprops.derive.* -import shapeless._ +import shapeless.* import shapeless.labelled.FieldType import shapeless.record.Record import shapeless.union.Union -import Util._ +import Util.* object CogenTests extends Scalaprops { - import TestsDefinitions._ - import ScalapropsShapeless._ + import TestsDefinitions.* + import ScalapropsShapeless.* private[this] implicit val genString: Gen[String] = Gen.asciiString diff --git a/test/shared/src/test/scala-2/scalaprops/GenTests.scala b/test/shared/src/test/scala-2/scalaprops/GenTests.scala index ac55826..1255e7e 100644 --- a/test/shared/src/test/scala-2/scalaprops/GenTests.scala +++ b/test/shared/src/test/scala-2/scalaprops/GenTests.scala @@ -1,18 +1,18 @@ package scalaprops -import scalaprops.derive._ +import scalaprops.derive.* -import shapeless._ +import shapeless.* import shapeless.labelled.FieldType -import shapeless.record._ -import shapeless.union._ +import shapeless.record.* +import shapeless.union.* import shapeless.test.illTyped -import Util._ +import Util.* object GenTests extends Scalaprops { - import TestsDefinitions._ - import ScalapropsShapeless._ + import TestsDefinitions.* + import ScalapropsShapeless.* private[this] implicit val genString: Gen[String] = Gen.asciiString @@ -709,7 +709,7 @@ object GenTests extends Scalaprops { } object NoTC { - import NoTCDefinitions._ + import NoTCDefinitions.* illTyped(""" Gen[NoGenType] diff --git a/test/shared/src/test/scala-2/scalaprops/PropertyTests.scala b/test/shared/src/test/scala-2/scalaprops/PropertyTests.scala index 061982f..55344ed 100644 --- a/test/shared/src/test/scala-2/scalaprops/PropertyTests.scala +++ b/test/shared/src/test/scala-2/scalaprops/PropertyTests.scala @@ -1,6 +1,6 @@ package scalaprops -import ScalapropsShapeless._ +import ScalapropsShapeless.* import scalaprops.TestsDefinitions.{T1, T1NoRecursiveTC} object PropertyTests extends Scalaprops { diff --git a/test/shared/src/test/scala-2/scalaprops/ShrinkTests.scala b/test/shared/src/test/scala-2/scalaprops/ShrinkTests.scala index daf5e1d..03768ef 100644 --- a/test/shared/src/test/scala-2/scalaprops/ShrinkTests.scala +++ b/test/shared/src/test/scala-2/scalaprops/ShrinkTests.scala @@ -1,16 +1,16 @@ package scalaprops -import scalaprops.ScalapropsShapeless._ -import scalaprops.derive._ -import shapeless._ -import shapeless.labelled._ +import scalaprops.ScalapropsShapeless.* +import scalaprops.derive.* +import shapeless.* +import shapeless.labelled.* import shapeless.record.Record import shapeless.union.Union -import Util._ +import Util.* object ShrinkTests extends Scalaprops { - import TestsDefinitions._ + import TestsDefinitions.* private[this] implicit val shrinkChar: Shrink[Char] = Shrink.long.xmap(_.toChar, x => x) diff --git a/test/shared/src/test/scala-2/scalaprops/SingletonsTests.scala b/test/shared/src/test/scala-2/scalaprops/SingletonsTests.scala index cd5b7fb..42a6b3e 100644 --- a/test/shared/src/test/scala-2/scalaprops/SingletonsTests.scala +++ b/test/shared/src/test/scala-2/scalaprops/SingletonsTests.scala @@ -1,12 +1,12 @@ package scalaprops -import shapeless._ +import shapeless.* import scalaprops.Property.forAll import Util.validateSingletons object SingletonsTests extends Scalaprops { - import SingletonsTestsDefinitions._ + import SingletonsTestsDefinitions.* val hnil = forAll { validateSingletons[HNil](HNil) diff --git a/test/shared/src/test/scala-2/scalaprops/SizeTests.scala b/test/shared/src/test/scala-2/scalaprops/SizeTests.scala index 8ce84a0..f8f5c0f 100644 --- a/test/shared/src/test/scala-2/scalaprops/SizeTests.scala +++ b/test/shared/src/test/scala-2/scalaprops/SizeTests.scala @@ -1,15 +1,15 @@ package scalaprops object SizeTests0 { - import scalaprops.ScalapropsShapeless._ + import scalaprops.ScalapropsShapeless.* - import SizeTestsDefinitions._ + import SizeTestsDefinitions.* val genTree = Gen[Tree] } object SizeTests extends Scalaprops { - import SizeTestsDefinitions._ + import SizeTestsDefinitions.* assert(Leaf.depth == 0) assert(Branch(Leaf, Leaf).depth == 1)