diff --git a/build.sbt b/build.sbt index f58feb1..02fdc8e 100644 --- a/build.sbt +++ b/build.sbt @@ -2,27 +2,27 @@ val groupId = "com.github.tarao" val projectName = "record4s" val rootPkg = s"$groupId.$projectName" -ThisBuild / organization := groupId +ThisBuild / organization := groupId ThisBuild / organizationName := "record4s authors" -ThisBuild / startYear := Some(2023) -ThisBuild / licenses := Seq(License.MIT) +ThisBuild / startYear := Some(2023) +ThisBuild / licenses := Seq(License.MIT) ThisBuild / developers := List( tlGitHubDev("tarao", "INA Lintaro"), tlGitHubDev("windymelt", "Windymelt"), ) lazy val metadataSettings = Def.settings( - name := projectName, + name := projectName, organization := groupId, - description := "Extensible records for Scala", - homepage := Some(url("https://github.com/tarao/record4s")), + description := "Extensible records for Scala", + homepage := Some(url("https://github.com/tarao/record4s")), ) val Scala_3 = "3.3.1" val Scala_2_13 = "2.13.12" val Scala_2_11 = "2.11.12" -ThisBuild / scalaVersion := Scala_3 +ThisBuild / scalaVersion := Scala_3 ThisBuild / crossScalaVersions := Seq(Scala_3) ThisBuild / githubWorkflowJavaVersions := Seq( JavaSpec.temurin("8"), @@ -51,16 +51,16 @@ lazy val commonSettings = Def.settings( compileSettings, initialCommands := s""" import $rootPkg.* - """ + """, ) lazy val root = tlCrossRootProject .aggregate(core) .settings(commonSettings) .settings( - console := (core.jvm / Compile / console).value, + console := (core.jvm / Compile / console).value, Test / console := (core.jvm / Test / console).value, - ThisBuild / Test / parallelExecution := false + ThisBuild / Test / parallelExecution := false, ) lazy val core = crossProject(JVMPlatform, JSPlatform) @@ -71,7 +71,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform) .settings( libraryDependencies ++= Seq( "org.scalatest" %%% "scalatest" % "3.2.17" % Test, - ) + ), ) lazy val benchmark_3 = (project in file("modules/benchmark_3")) @@ -81,7 +81,7 @@ lazy val benchmark_3 = (project in file("modules/benchmark_3")) .enablePlugins(NoPublishPlugin) .settings( Compile / run / fork := true, - javaOptions+= "-Xss10m", + javaOptions += "-Xss10m", scalacOptions ++= Seq("-Xmax-inlines", "1000"), libraryDependencies ++= Seq( scalaOrganization.value %% "scala3-compiler" % scalaVersion.value, @@ -93,9 +93,9 @@ lazy val benchmark_2_13 = (project in file("modules/benchmark_2_13")) .enablePlugins(NoPublishPlugin) .settings( scalaVersion := Scala_2_13, - javaOptions+= "-Xss10m", + javaOptions += "-Xss10m", libraryDependencies ++= Seq( - "com.chuusai" %% "shapeless" % "2.3.10", + "com.chuusai" %% "shapeless" % "2.3.10", scalaOrganization.value % "scala-compiler" % scalaVersion.value, ), ) @@ -105,9 +105,9 @@ lazy val benchmark_2_11 = (project in file("modules/benchmark_2_11")) .enablePlugins(NoPublishPlugin) .settings( scalaVersion := Scala_2_11, - javaOptions+= "-Xss10m", + javaOptions += "-Xss10m", libraryDependencies ++= Seq( - "ch.epfl.lamp" %% "scala-records" % "0.4", + "ch.epfl.lamp" %% "scala-records" % "0.4", scalaOrganization.value % "scala-compiler" % scalaVersion.value, ), ) diff --git a/modules/core/src/main/scala/com/github/tarao/record4s/Record.scala b/modules/core/src/main/scala/com/github/tarao/record4s/Record.scala index 425356e..e74197d 100644 --- a/modules/core/src/main/scala/com/github/tarao/record4s/Record.scala +++ b/modules/core/src/main/scala/com/github/tarao/record4s/Record.scala @@ -63,8 +63,8 @@ object Record { * @return * the value of the field named by `label` */ - def lookup[R <: %, L <: String & Singleton, Out](record: R, label: L)( - using Lookup.Aux[R, L, Out], + def lookup[R <: %, L <: String & Singleton, Out](record: R, label: L)(using + Lookup.Aux[R, L, Out], ): Out = record.__lookup(label).asInstanceOf[Out] diff --git a/modules/core/src/test/scala/com/github/tarao/record4s/TypeErrorSpec.scala b/modules/core/src/test/scala/com/github/tarao/record4s/TypeErrorSpec.scala index 017b6ad..6578550 100644 --- a/modules/core/src/test/scala/com/github/tarao/record4s/TypeErrorSpec.scala +++ b/modules/core/src/test/scala/com/github/tarao/record4s/TypeErrorSpec.scala @@ -62,7 +62,9 @@ class TypeErrorSpec extends helper.UnitSpec { val errs = typeCheckErrors("""Record.lookup(r, "email")""") errs should not be empty errs.head.kind shouldBe ErrorKind.Typer - errs.head.message should startWith("""Value '("email" : String)' is not a member of""") + errs.head.message should startWith( + """Value '("email" : String)' is not a member of""", + ) } it("should detect invalid key type") { @@ -71,7 +73,9 @@ class TypeErrorSpec extends helper.UnitSpec { val errs = typeCheckErrors("""Record.lookup(r, key)""") errs should not be empty errs.head.kind shouldBe ErrorKind.Typer - errs.head.message should startWith("""Value '(key : String)' is not a member of""") + errs.head.message should startWith( + """Value '(key : String)' is not a member of""", + ) } } @@ -142,7 +146,9 @@ class TypeErrorSpec extends helper.UnitSpec { case class Cell($value: Int) - checkErrors(typeCheckErrors("""ArrayRecord(name = "tarao") ++ Cell(3)""")) + checkErrors( + typeCheckErrors("""ArrayRecord(name = "tarao") ++ Cell(3)"""), + ) checkErrors(typeCheckErrors("""ArrayRecord.from(Cell(3))""")) } @@ -167,7 +173,9 @@ class TypeErrorSpec extends helper.UnitSpec { val errs = typeCheckErrors("""ArrayRecord.lookup(r, "email")""") errs should not be empty errs.head.kind shouldBe ErrorKind.Typer - errs.head.message should startWith("""Value '("email" : String)' is not a member of""") + errs.head.message should startWith( + """Value '("email" : String)' is not a member of""", + ) } it("should detect invalid key type") { @@ -176,7 +184,9 @@ class TypeErrorSpec extends helper.UnitSpec { val errs = typeCheckErrors("""ArrayRecord.lookup(r, key)""") errs should not be empty errs.head.kind shouldBe ErrorKind.Typer - errs.head.message should startWith("""Value '(key : String)' is not a member of""") + errs.head.message should startWith( + """Value '(key : String)' is not a member of""", + ) } } @@ -221,7 +231,9 @@ class TypeErrorSpec extends helper.UnitSpec { describe("RecordLike") { it("should detect non-literal label type") { val errs = - typeCheckErrors("""ArrayRecord(name = "tarao") ++ (("age", 3) *: EmptyTuple)""") + typeCheckErrors( + """ArrayRecord(name = "tarao") ++ (("age", 3) *: EmptyTuple)""", + ) errs should not be empty errs.head.kind shouldBe ErrorKind.Typer errs.head.message should startWith( diff --git a/modules/core/src/test/scala/helper/StaticTypeMatcher.scala b/modules/core/src/test/scala/helper/StaticTypeMatcher.scala index 2fa5627..8580e87 100644 --- a/modules/core/src/test/scala/helper/StaticTypeMatcher.scala +++ b/modules/core/src/test/scala/helper/StaticTypeMatcher.scala @@ -22,7 +22,10 @@ package helper import scala.compiletime.summonInline -import org.scalatest.matchers.dsl.{ResultOfATypeInvocation, ResultOfAnTypeInvocation} +import org.scalatest.matchers.dsl.{ + ResultOfATypeInvocation, + ResultOfAnTypeInvocation, +} trait StaticTypeMatcher { extension [T1](anything: T1) { diff --git a/project/plugins.sbt b/project/plugins.sbt index b8a72e2..8585c1c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") -addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.1") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")