Skip to content

Commit

Permalink
Merge pull request #643 from fthomas/topic/enumeratum-scala-3
Browse files Browse the repository at this point in the history
Build ciris-enumeratum with Scala 3
  • Loading branch information
vlovgr authored Feb 8, 2023
2 parents 7e4d847 + 6527c58 commit fa78c0f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ lazy val enumeratum = crossProject(JSPlatform, JVMPlatform)
),
publishSettings,
mimaSettings,
scalaSettings,
scalaSettings ++ Seq(
crossScalaVersions += scala3
),
testSettings
)
.jsSettings(sharedJsSettings)
Expand Down Expand Up @@ -366,7 +368,7 @@ lazy val publishSettings =

lazy val mimaSettings = Seq(
mimaPreviousArtifacts := {
val unpublishedModules = Set[String]()
val unpublishedModules = Set[String]("ciris-enumeratum")
if (publishArtifact.value && !unpublishedModules.contains(moduleName.value)) {
Set(organization.value %% moduleName.value % (ThisBuild / previousStableVersion).value.get)
} else Set()
Expand Down Expand Up @@ -429,7 +431,7 @@ lazy val scalaSettings = Seq(

val scala3ScalacOptions =
if (scalaVersion.value.startsWith("3")) {
Seq("-Ykind-projector")
Seq("-Ykind-projector", "-Yretain-trees")
} else Seq()

commonScalacOptions ++
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2017-2023 Viktor Rudebeck
*
* SPDX-License-Identifier: MIT
*/

package enumeratum.internal

import scala.quoted._

private[internal] trait TypeNameRuntimePlatform {
inline given [A]: TypeName[A] =
${TypeNameRuntimePlatform.typeName[A]}
}

private[internal] object TypeNameRuntimePlatform {
final def typeName[A](using t: Type[A], ctx: Quotes): Expr[TypeName[A]] =
'{TypeName[A](${Expr(Type.show[A])})}
}

0 comments on commit fa78c0f

Please sign in to comment.