From 9eded9b977171152fb6b44706e597dc75d061736 Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Sat, 9 Nov 2024 09:27:32 +0100 Subject: [PATCH] Support scala 3.3.x (#158) --- .github/workflows/build.yml | 4 ++-- .scalafmt.conf | 2 +- build.sbt | 6 ++++-- src/main/scala/nl/gn0s1s/isbn/Isbn.scala | 3 +++ src/test/scala/nl/gn0s1s/isbn/HyphenationSuite.scala | 2 +- src/test/scala/nl/gn0s1s/isbn/IsbnSuite.scala | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f90b49..b65dbc3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - scala-version: [2.13.x] + scala-version: [2.13.x, 3.3.x] java-version: [8, 11, 17, 21] steps: - uses: actions/checkout@v4 @@ -18,6 +18,6 @@ jobs: distribution: temurin java-version: ${{ matrix.java-version }} - name: Run tests - run: sbt ++${{ matrix.scala-version }} clean versionPolicyCheck coverage test coverageReport + run: sbt ++${{ matrix.scala-version }} clean coverage test coverageReport - name: Upload coverage report run: bash <(curl -s https://codecov.io/bash) diff --git a/.scalafmt.conf b/.scalafmt.conf index 7a60977..b79a3b6 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -10,4 +10,4 @@ rewriteTokens = { "→": "->" "←": "<-" } -runner.dialect = scala213 +runner.dialect = scala213source3 diff --git a/build.sbt b/build.sbt index 2a5dbdf..09f29f7 100644 --- a/build.sbt +++ b/build.sbt @@ -13,8 +13,10 @@ developers := List( ) ) -crossScalaVersions := List("2.13.15") -scalaVersion := crossScalaVersions.value.last +scalaVersion := "2.13.15" +crossScalaVersions += "3.3.4" + +scalacOptions += "-Xsource:3" ThisBuild / versionScheme := Some("semver-spec") ThisBuild / versionPolicyIntention := Compatibility.BinaryCompatible diff --git a/src/main/scala/nl/gn0s1s/isbn/Isbn.scala b/src/main/scala/nl/gn0s1s/isbn/Isbn.scala index 747d6a8..0079b61 100644 --- a/src/main/scala/nl/gn0s1s/isbn/Isbn.scala +++ b/src/main/scala/nl/gn0s1s/isbn/Isbn.scala @@ -1,5 +1,8 @@ package nl.gn0s1s.isbn +import scala.annotation.nowarn + +@nowarn final case class Isbn private (value: String) { lazy val Array(prefixElement, registrationGroupElement, registrantElement, publicationElement, checkDigit) = toHyphenatedIsbn13.split('-') diff --git a/src/test/scala/nl/gn0s1s/isbn/HyphenationSuite.scala b/src/test/scala/nl/gn0s1s/isbn/HyphenationSuite.scala index 0ccf7ed..368a413 100644 --- a/src/test/scala/nl/gn0s1s/isbn/HyphenationSuite.scala +++ b/src/test/scala/nl/gn0s1s/isbn/HyphenationSuite.scala @@ -1,7 +1,7 @@ package nl.gn0s1s.isbn import munit.ScalaCheckSuite -import org.scalacheck.Prop._ +import org.scalacheck.Prop.* class HyphenationSuite extends ScalaCheckSuite { property("can convert to a hyphenated isbn-13") { diff --git a/src/test/scala/nl/gn0s1s/isbn/IsbnSuite.scala b/src/test/scala/nl/gn0s1s/isbn/IsbnSuite.scala index 25aaf57..f82c233 100644 --- a/src/test/scala/nl/gn0s1s/isbn/IsbnSuite.scala +++ b/src/test/scala/nl/gn0s1s/isbn/IsbnSuite.scala @@ -1,7 +1,7 @@ package nl.gn0s1s.isbn import munit.ScalaCheckSuite -import org.scalacheck.Prop._ +import org.scalacheck.Prop.* class IsbnSuite extends ScalaCheckSuite { property("accepts isbn-13s") {