Skip to content

Commit

Permalink
Merge pull request #560 from hughsimpson/scala3-v2
Browse files Browse the repository at this point in the history
bump deps and fix java annotations
  • Loading branch information
adamw authored Jan 14, 2025
2 parents c88baf6 + adc83bd commit 96ff73b
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 88 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import com.softwaremill.UpdateVersionInDocs
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.Publish.{updateDocs, ossPublishSettings}

val scala3 = "3.2.1"
val scala3 = "3.3.4"

ThisBuild / dynverTagPrefix := "scala3-v" // a custom prefix is needed to differentiate tags between scala2 & scala3 versions

Expand Down Expand Up @@ -75,7 +75,7 @@ lazy val test = (projectMatrix in file(".test"))
name := "magnolia-test",
scalacOptions += "-Yretain-trees",
projectDependencies ++= Seq(
"org.scalameta" %%% "munit" % "1.0.0-M6"
"org.scalameta" %%% "munit" % "1.0.0-M12"
),
testFrameworks += new TestFramework("munit.Framework"),
Test / scalaSource := baseDirectory.value / ".." / ".." / ".." / "src" / "test",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.8.0
sbt.version=1.10.1
8 changes: 4 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.0")

val sbtSoftwareMillVersion = "2.0.12"
addSbtPlugin(
Expand All @@ -8,6 +8,6 @@ addSbtPlugin(
"com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion
)

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.9")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
11 changes: 6 additions & 5 deletions src/core/impl.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package magnolia2

import scala.annotation.Annotation
import scala.compiletime.*
import scala.deriving.Mirror
import scala.reflect.*
Expand Down Expand Up @@ -85,7 +86,7 @@ object CaseClassDerivation:
parameters,
IArray(anns[A]*),
IArray(inheritedAnns[A]*),
IArray[Any](typeAnns[A]*)
IArray[Annotation](typeAnns[A]*)
):
def construct[PType: ClassTag](makeParam: Param => PType): A =
product.fromProduct(Tuple.fromArray(params.map(makeParam).to(Array)))
Expand Down Expand Up @@ -120,9 +121,9 @@ object CaseClassDerivation:
}

inline def paramsFromMaps[Typeclass[_], A, Labels <: Tuple, Params <: Tuple](
annotations: Map[String, List[Any]],
inheritedAnnotations: Map[String, List[Any]],
typeAnnotations: Map[String, List[Any]],
annotations: Map[String, List[Annotation]],
inheritedAnnotations: Map[String, List[Annotation]],
typeAnnotations: Map[String, List[Annotation]],
repeated: Map[String, Boolean],
defaults: Map[String, Option[() => Any]],
idx: Int = 0
Expand Down Expand Up @@ -165,7 +166,7 @@ trait SealedTraitDerivation:
typeInfo[A],
IArray(subtypesFromMirror[A, m.MirroredElemTypes](m)*),
IArray.from(anns[A]),
IArray(paramTypeAnns[A]*),
IArray.from(paramTypeAnns[A]),
isEnum[A],
IArray.from(inheritedAnns[A])
)
Expand Down
38 changes: 19 additions & 19 deletions src/core/interface.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package magnolia2

import scala.annotation.tailrec
import scala.annotation.{Annotation, tailrec}
import scala.reflect.*

case class TypeInfo(
Expand All @@ -15,8 +15,8 @@ object CaseClass:
val label: String,
val index: Int,
val repeated: Boolean,
val annotations: IArray[Any],
val typeAnnotations: IArray[Any]
val annotations: IArray[Annotation],
val typeAnnotations: IArray[Annotation]
) extends Serializable:

type PType
Expand All @@ -42,7 +42,7 @@ object CaseClass:
* default argument value, if any
*/
def default: Option[PType]
def inheritedAnnotations: IArray[Any] = IArray.empty[Any]
def inheritedAnnotations: IArray[Annotation] = IArray.empty[Annotation]
override def toString: String = s"Param($label)"

object Param:
Expand All @@ -53,9 +53,9 @@ object CaseClass:
repeated: Boolean,
cbn: CallByNeed[F[P]],
defaultVal: CallByNeed[Option[P]],
annotations: IArray[Any],
inheritedAnns: IArray[Any],
typeAnnotations: IArray[Any]
annotations: IArray[Annotation],
inheritedAnns: IArray[Annotation],
typeAnnotations: IArray[Annotation]
): Param[F, T] =
new CaseClass.Param[F, T](
name,
Expand Down Expand Up @@ -89,9 +89,9 @@ abstract class CaseClass[Typeclass[_], Type](
val isObject: Boolean,
val isValueClass: Boolean,
val params: IArray[CaseClass.Param[Typeclass, Type]],
val annotations: IArray[Any],
val inheritedAnnotations: IArray[Any] = IArray.empty[Any],
val typeAnnotations: IArray[Any]
val annotations: IArray[Annotation],
val inheritedAnnotations: IArray[Annotation] = IArray.empty[Annotation],
val typeAnnotations: IArray[Annotation]
) extends Serializable:

type Param = CaseClass.Param[Typeclass, Type]
Expand All @@ -113,9 +113,9 @@ abstract class CaseClass[Typeclass[_], Type](
repeated: Boolean,
cbn: CallByNeed[Typeclass[P]],
defaultVal: CallByNeed[Option[P]],
annotations: IArray[Any],
inheritedAnns: IArray[Any],
typeAnnotations: IArray[Any]
annotations: IArray[Annotation],
inheritedAnns: IArray[Annotation],
typeAnnotations: IArray[Annotation]
): Param =
new CaseClass.Param[Typeclass, Type](
name,
Expand All @@ -141,10 +141,10 @@ end CaseClass
case class SealedTrait[Typeclass[_], Type](
typeInfo: TypeInfo,
subtypes: IArray[SealedTrait.Subtype[Typeclass, Type, _]],
annotations: IArray[Any],
typeAnnotations: IArray[Any],
annotations: IArray[Annotation],
typeAnnotations: IArray[(String, List[Annotation])],
isEnum: Boolean,
inheritedAnnotations: IArray[Any]
inheritedAnnotations: IArray[Annotation]
) extends Serializable:

type Subtype[S] = SealedTrait.SubtypeValue[Typeclass, Type, S]
Expand Down Expand Up @@ -191,9 +191,9 @@ object SealedTrait:
*/
class Subtype[Typeclass[_], Type, SType](
val typeInfo: TypeInfo,
val annotations: IArray[Any],
val inheritedAnnotations: IArray[Any],
val typeAnnotations: IArray[Any],
val annotations: IArray[Annotation],
val inheritedAnnotations: IArray[Annotation],
val typeAnnotations: IArray[(String, List[Annotation])],
val isObject: Boolean,
callByNeed: CallByNeed[Typeclass[SType]],
isType: Type => Boolean,
Expand Down
Loading

0 comments on commit 96ff73b

Please sign in to comment.