Skip to content

Commit

Permalink
Reformat.
Browse files Browse the repository at this point in the history
  • Loading branch information
tarao committed Nov 7, 2023
1 parent f061da9 commit f1f6285
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 28 deletions.
32 changes: 16 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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)
Expand All @@ -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"))
Expand All @@ -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,
Expand All @@ -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,
),
)
Expand All @@ -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,
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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""",
)
}
}

Expand Down Expand Up @@ -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))"""))
}

Expand All @@ -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") {
Expand All @@ -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""",
)
}
}

Expand Down Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion modules/core/src/test/scala/helper/StaticTypeMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit f1f6285

Please sign in to comment.