The second release of refined-compat — compile-time refinement validation for refined types on both Scala 2.13 and Scala 3, powered by Hearth's Expr.semiEval.
This is a maintenance release. There are no source or API changes since 0.1.0 — every public entry point (hearth.refined.auto._, refineMV, RefinedTypeOpsM) and the full predicate coverage behave exactly as before. What changed is underneath: refined-compat now tracks Hearth 0.4.0, migrates the build to sbt 2.0, and tightens up CI and dependency management. If you are upgrading, this is a drop-in bump.
import hearth.refined.auto._
val x: Int Refined Positive = 5 // compiles on both Scala 2.13 and 3
val y: String Refined NonEmpty = "" // fails at compile time on bothHighlights
-
Now tracks Hearth 0.4.0 (#23) — a pure dependency bump. The 0.4 line (union soundness, opaque/annotation/HKT/source-text APIs,
enclosingScope, anAtCallSite-defaultcaseFieldValuesAt, and a hardenedsemiEvalcontract) is source-compatible with refined-compat, so no library code had to change. refined-compat continues to double as a real-worldsemiEvalfeedback project for Hearth. -
Migrated the build to sbt 2.0 (#18) —
sbt.versionis now2.0.0(from the sbt 1.x line). Notable mechanics:sbt-projectmatrixis now built in to sbt 2.0 and is dropped fromplugins.sbt.%%%is gone; sbt 2.0's%%is platform-aware, so dependencies use%%.- Convenience tasks (
compileAll/testAll/publishLocalAll) are exposed viaaddCommandAliasinstead ofsbt-welcome(which has no sbt 2.0 build). - The Scala 3 cross-quotes compiler plugin is resolved as the JVM-only
hearth-cross-quotes_3artifact and its-Xpluginjar is located viafileConverter.toPath(classpath entries are nowxsbti.HashedVirtualFileRef, notFile).
-
CI uses
sbt testFull(#18) — on sbt 2.0 the baretesttask is incremental/machine-cached and a fresh CI run could vacuously pass with "No tests to run", so CI now runstestFullto force a real test run. -
Hardened dependency management (#22) — a new
.scala-steward.confkeeps the build on the Scala 3.3 LTS line by ignoring the wholeorg.scala-langgroup (the only reliable way to stop ascala3-library_sjs1_3leak) and pins Scala Steward's view of sbt to the 1.x line, while the build itself runs sbt 2.0. -
Housekeeping — bumped
sbt/scripted-pluginto 1.12.12 (#14), tracked interim Hearth snapshots on the road to 0.4.0 (#15, #20, #23), and bumpedactions/checkoutv6 → v7 (#19).
How it works
Unchanged from 0.1.0: Hearth's semiEval reconstructs both the literal value and the Validate[T, P] (or Inference[A, B]) instance from the expression AST at macro-expansion time, runs the validation, and either emits Refined.unsafeApply(value) or aborts compilation with the predicate's error message. No c.eval needed — which is exactly why it works on Scala 3.
Summary
A maintenance release: same API and same predicate coverage as 0.1.0, now built on Hearth 0.4.0 and sbt 2.0. Still published for Scala 2.13 and Scala 3 (3.3 LTS) on JVM, Scala.js, and Scala Native. Replace eu.timepit.refined.auto._ with hearth.refined.auto._ and you're done.
Star the project ⭐ and leave us some feedback!