Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update scalafmt config #374

Merged
merged 1 commit into from
Aug 25, 2024
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 .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scalaprops

import derive._
import derive.*

sealed abstract class ScalapropsShapeless
extends SingletonInstances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scalaprops
package derive

import shapeless._
import shapeless.*

/**
* Derives `Cogen[T]` instances for `T` an `HList`, a `Coproduct`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scalaprops
package derive

import shapeless._
import shapeless.*

/**
* Derives `Gen[T]` instances for `T` an `HList`, a `Coproduct`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scalaprops
package derive

import shapeless._
import shapeless.*

/**
* Derives `Shrink[T]` instances for `T` an `HList`, a `Coproduct`,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]) => {
Expand All @@ -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
Expand All @@ -44,7 +44,7 @@ sealed abstract class ScalapropsShapelessInstances {
inst.inject[(Rand, A)](index) {
[t <: A] => (g: Gen[t]) => g.f(size, r2)
}
)
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions test/shared/src/test/scala-2/scalaprops/CogenTests.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions test/shared/src/test/scala-2/scalaprops/GenTests.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -709,7 +709,7 @@ object GenTests extends Scalaprops {
}

object NoTC {
import NoTCDefinitions._
import NoTCDefinitions.*

illTyped("""
Gen[NoGenType]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scalaprops

import ScalapropsShapeless._
import ScalapropsShapeless.*
import scalaprops.TestsDefinitions.{T1, T1NoRecursiveTC}

object PropertyTests extends Scalaprops {
Expand Down
12 changes: 6 additions & 6 deletions test/shared/src/test/scala-2/scalaprops/ShrinkTests.scala
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions test/shared/src/test/scala-2/scalaprops/SizeTests.scala
Original file line number Diff line number Diff line change
@@ -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)
Expand Down