Skip to content

Commit b7dc16e

Browse files
authored
update to Scala 3.3.7 (#313)
2 parents a5a8add + e216f11 commit b7dc16e

27 files changed

+75
-87
lines changed

build.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ThisBuild / organizationName := "arainko"
1313
ThisBuild / startYear := Some(2023)
1414
ThisBuild / licenses := Seq(License.Apache2)
1515
ThisBuild / developers := List(tlGitHubDev("arainko", "Aleksander Rainko"))
16-
ThisBuild / scalaVersion := "3.3.6"
16+
ThisBuild / scalaVersion := "3.3.7"
1717
ThisBuild / tlSitePublishBranch := Some("series/0.2.x")
1818

1919
ThisBuild / semanticdbEnabled := true
@@ -47,8 +47,8 @@ lazy val ducktape =
4747
.in(file("ducktape"))
4848
.settings(
4949
scalacOptions ++= List("-deprecation", "-Wunused:all", "-Ykind-projector:underscores", "-Xcheck-macros"),
50-
Test / scalacOptions --= List("-deprecation"),
51-
Test / scalacOptions ++= List("-Werror", "-Wconf:cat=deprecation:s"),
50+
Test / scalacOptions --= List("-deprecation", "-Wunused:all"),
51+
Test / scalacOptions ++= List("-Werror", "-Wconf:cat=deprecation:s", "-Wunused:imports"),
5252
libraryDependencies += "org.scalameta" %%% "munit" % "1.2.1" % Test
5353
)
5454
.nativeSettings(

ducktape/src/main/scala/io/github/arainko/ducktape/Transformer.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.github.arainko.ducktape
22

33
import io.github.arainko.ducktape
4-
import io.github.arainko.ducktape.Transformer.Derived.FromFunction
54
import io.github.arainko.ducktape.internal.{ FallibleTransformations, TotalTransformations }
65

76
/**

ducktape/src/main/scala/io/github/arainko/ducktape/internal/ConfigInstructionRefiner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private[ducktape] object ConfigInstructionRefiner {
1010
case inst @ Instruction.Static(_, _, config, _) =>
1111
config match
1212
case cfg: (Const | CaseComputed | FieldComputed | FieldComputedDeep | FieldReplacement) => inst.copy(config = cfg)
13-
case fallible: (FallibleConst | FallibleFieldComputed | FallibleFieldComputedDeep | FallibleCaseComputed) => None
13+
case _: (FallibleConst | FallibleFieldComputed | FallibleFieldComputedDeep | FallibleCaseComputed) => None
1414
case inst: (Instruction.Dynamic | Instruction.Bulk | Instruction.Regional | Instruction.Failed) => inst
1515

1616
}

ducktape/src/main/scala/io/github/arainko/ducktape/internal/ConfigParser.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.arainko.ducktape.internal
22

33
import io.github.arainko.ducktape.*
44

5+
import scala.annotation.nowarn
56
import scala.quoted.*
67

78
import Configuration.*
@@ -12,6 +13,8 @@ private[ducktape] sealed trait ConfigParser[+F <: Fallible] {
1213
def apply(using Quotes, Context): PartialFunction[(Priority, quotes.reflect.Term), Instruction[F] | ParsedFlag]
1314
}
1415

16+
@nowarn("msg=unused pattern variable")
17+
@nowarn("msg=unused local definition")
1518
private[ducktape] object ConfigParser {
1619
val total = NonEmptyList(Total)
1720

@@ -486,8 +489,6 @@ private[ducktape] object ConfigParser {
486489

487490
private object DeprecatedFallibleConfig {
488491
def unapply[F[+x]: Type](using Quotes)(prioAndTerm: (Priority, quotes.reflect.Term)) = {
489-
import quotes.reflect.*
490-
491492
val (prio, expr) = prioAndTerm
492493

493494
PartialFunction.condOpt(expr.asExpr) {

ducktape/src/main/scala/io/github/arainko/ducktape/internal/Configuration.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private[ducktape] object Configuration {
4646
Quotes
4747
): Configuration[Nothing] | plan.type =
4848
plan.dest.tpe match {
49-
case tpe @ '[Option[a]] => Configuration.Const('{ None }, tpe)
49+
case tpe @ '[Option[?]] => Configuration.Const('{ None }, tpe)
5050
case _ => plan
5151
}
5252

@@ -126,7 +126,7 @@ private[ducktape] object Configuration {
126126
parsers: NonEmptyList[ConfigParser[F]]
127127
)(using Quotes, Context): (List[Instruction[F]], PlanFlags) = {
128128
import quotes.reflect.*
129-
def fallback(term: quotes.reflect.Term, priority: Priority) =
129+
def fallback(term: quotes.reflect.Term) =
130130
Configuration.Instruction.Failed(
131131
Path.empty(Type.of[Nothing]),
132132
Side.Dest,
@@ -144,7 +144,7 @@ private[ducktape] object Configuration {
144144
parser
145145
.applyOrElse(
146146
(Priority.of(priority), expr.asTerm),
147-
(priority, expr) => fallback(expr, Priority.of(priority))
147+
(_, expr) => fallback(expr)
148148
)
149149
.match {
150150
case instruction: Instruction[F] => Left(instruction)

ducktape/src/main/scala/io/github/arainko/ducktape/internal/Constructor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private[ducktape] object Constructor {
99
val (repr, constructor, tpeArgs) =
1010
tpe match {
1111
case AppliedType(repr, reprArguments) => (repr, repr.typeSymbol.primaryConstructor, reprArguments)
12-
case notApplied => (tpe, tpe.typeSymbol.primaryConstructor, Nil)
12+
case _ => (tpe, tpe.typeSymbol.primaryConstructor, Nil)
1313
}
1414

1515
// workaround for invoking constructors of singleton which in turn actually create new instances of singletons!

ducktape/src/main/scala/io/github/arainko/ducktape/internal/ErroneousnessRefiner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ private[ducktape] object ErroneousnessRefiner {
55
protected def foldOver(plan: Plan[Erroneous, Fallible], accumulator: List[Plan.Error]): List[Plan.Error] =
66
plan match {
77
case error: Plan.Error => error :: accumulator
8-
case other => accumulator
8+
case _ => accumulator
99
}
1010
}
1111

ducktape/src/main/scala/io/github/arainko/ducktape/internal/FallibilityRefiner.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import scala.util.boundary.Label
1010
private[ducktape] object FallibilityRefiner {
1111
def run[E <: Erroneous](plan: Plan[E, Fallible]): Plan[E, Nothing] | None.type =
1212
recurse(plan) match
13-
case None => None
14-
case b: Unit => plan.asInstanceOf[Plan[E, Nothing]]
13+
case None => None
14+
case () => plan.asInstanceOf[Plan[E, Nothing]]
1515

1616
private def recurse[E <: Erroneous](plan: Plan[E, Fallible]): None.type | Unit =
1717
boundary[None.type | Unit]:
@@ -30,15 +30,15 @@ private[ducktape] object FallibilityRefiner {
3030

3131
case Configured(source, dest, config, _) =>
3232
config match
33-
case Configuration.Const(value, tpe) => ()
34-
case Configuration.CaseComputed(tpe, function) => ()
35-
case Configuration.FieldComputed(tpe, function) => ()
36-
case Configuration.FieldComputedDeep(tpe, srcTpe, function) => ()
37-
case Configuration.FieldReplacement(source, _, name, tpe) => ()
38-
case Configuration.FallibleConst(value, tpe) => boundary.break(None)
39-
case Configuration.FallibleFieldComputed(tpe, function) => boundary.break(None)
40-
case Configuration.FallibleFieldComputedDeep(tpe, srcTpe, function) => boundary.break(None)
41-
case Configuration.FallibleCaseComputed(tpe, function) => boundary.break(None)
33+
case Configuration.Const(value, _) => ()
34+
case Configuration.CaseComputed(_, function) => ()
35+
case Configuration.FieldComputed(_, function) => ()
36+
case Configuration.FieldComputedDeep(_, _, function) => ()
37+
case Configuration.FieldReplacement(source, _, name, _) => ()
38+
case Configuration.FallibleConst(value, _) => boundary.break(None)
39+
case Configuration.FallibleFieldComputed(_, function) => boundary.break(None)
40+
case Configuration.FallibleFieldComputedDeep(_, _, function) => boundary.break(None)
41+
case Configuration.FallibleCaseComputed(_, function) => boundary.break(None)
4242

4343
case BetweenProductFunction(source, dest, argPlans) =>
4444
evaluate(argPlans.map((_, fieldPlan) => fieldPlan.plan))

ducktape/src/main/scala/io/github/arainko/ducktape/internal/FalliblePlanInterpreter.scala

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package io.github.arainko.ducktape.internal
33
import io.github.arainko.ducktape.internal.Summoner.UserDefined.{ FallibleTransformer, TotalTransformer }
44
import io.github.arainko.ducktape.{ Mode, Transformer }
55

6+
import scala.annotation.nowarn
67
import scala.collection.Factory
78
import scala.collection.immutable.VectorMap
89
import scala.quoted.*
@@ -20,7 +21,6 @@ private[ducktape] object FalliblePlanInterpreter {
2021
value: Expr[Any],
2122
F: TransformationMode[F]
2223
)(using toplevelValue: Expr[A])(using Quotes): Value[F] = {
23-
import quotes.reflect.*
2424

2525
FallibilityRefiner.run(plan) match
2626
case plan: Plan[Nothing, Nothing] =>
@@ -33,13 +33,13 @@ private[ducktape] object FalliblePlanInterpreter {
3333
config match
3434
case cfg @ Configuration.Const(_, _) =>
3535
Value.Unwrapped(PlanInterpreter.evaluateConfig(cfg, value))
36-
case cfg @ Configuration.CaseComputed(tpe, function) =>
36+
case cfg @ Configuration.CaseComputed(_, function) =>
3737
Value.Unwrapped(PlanInterpreter.evaluateConfig(cfg, value))
38-
case cfg @ Configuration.FieldComputed(tpe, function) =>
38+
case cfg @ Configuration.FieldComputed(_, function) =>
3939
Value.Unwrapped(PlanInterpreter.evaluateConfig(cfg, value))
40-
case cfg @ Configuration.FieldComputedDeep(tpe, srcTpe, function) =>
40+
case cfg @ Configuration.FieldComputedDeep(_, _, function) =>
4141
Value.Unwrapped(PlanInterpreter.evaluateConfig(cfg, value))
42-
case cfg @ Configuration.FieldReplacement(source, _, name, tpe) =>
42+
case cfg @ Configuration.FieldReplacement(source, _, name, _) =>
4343
Value.Unwrapped(PlanInterpreter.evaluateConfig(cfg, value))
4444
case Configuration.FallibleConst(value, tpe) =>
4545
tpe match {
@@ -52,7 +52,7 @@ private[ducktape] object FalliblePlanInterpreter {
5252
Value.Wrapped('{ $function($toplevelValue) }.asExprOf[F[tpe]])
5353
}
5454

55-
case Configuration.FallibleFieldComputedDeep(tpe, srcTpe, function) =>
55+
case Configuration.FallibleFieldComputedDeep(tpe, _, function) =>
5656
tpe match {
5757
case '[tpe] =>
5858
Value.Wrapped('{ $function($value) }.asExprOf[F[tpe]])
@@ -167,8 +167,7 @@ private[ducktape] object FalliblePlanInterpreter {
167167
)(using $f)
168168
})
169169
}
170-
171-
}
170+
}: @nowarn("msg=unused local definition")
172171

173172
case Plan.BetweenSingletons(source, dest) =>
174173
Value.Unwrapped(dest.value)
@@ -235,7 +234,6 @@ private[ducktape] object FalliblePlanInterpreter {
235234
value: Expr[Any],
236235
F: TransformationMode[F]
237236
)(construct: ProductConstructor)(using quotes: Quotes, toplevelValue: Expr[A]) = {
238-
import quotes.reflect.*
239237

240238
val (unwrapped, wrapped) =
241239
plans.zipWithIndex.partitionMap {
@@ -276,7 +274,6 @@ private[ducktape] object FalliblePlanInterpreter {
276274
value: Expr[Any],
277275
F: TransformationMode[F]
278276
)(construct: ProductConstructor)(using quotes: Quotes, toplevelValue: Expr[A]) = {
279-
import quotes.reflect.*
280277

281278
def handleVectorMap(sourceStruct: Structure.Product, fieldPlans: VectorMap[String, FieldPlan[Nothing, Fallible]])(using
282279
Quotes

ducktape/src/main/scala/io/github/arainko/ducktape/internal/FallibleTransformations.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ private[ducktape] object FallibleTransformations {
9191
function: Expr[Func],
9292
F: Expr[Mode[F]]
9393
)(using Quotes): Expr[F[Any]] = {
94-
import quotes.reflect.*
95-
9694
given Context.PossiblyFallible[F](
9795
WrapperType.create[F],
9896
TransformationSite.Transformation,

0 commit comments

Comments
 (0)