Skip to content

0.2.0 - Hearth 0.4.0 and the sbt 2.0 Migration

Latest

Choose a tag to compare

@MateuszKubuszok MateuszKubuszok released this 26 Jun 18:05
b679202

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 both

Highlights

  • Now tracks Hearth 0.4.0 (#23) — a pure dependency bump. The 0.4 line (union soundness, opaque/annotation/HKT/source-text APIs, enclosingScope, an AtCallSite-default caseFieldValuesAt, and a hardened semiEval contract) is source-compatible with refined-compat, so no library code had to change. refined-compat continues to double as a real-world semiEval feedback project for Hearth.

  • Migrated the build to sbt 2.0 (#18) — sbt.version is now 2.0.0 (from the sbt 1.x line). Notable mechanics:

    • sbt-projectmatrix is now built in to sbt 2.0 and is dropped from plugins.sbt.
    • %%% is gone; sbt 2.0's %% is platform-aware, so dependencies use %%.
    • Convenience tasks (compileAll / testAll / publishLocalAll) are exposed via addCommandAlias instead of sbt-welcome (which has no sbt 2.0 build).
    • The Scala 3 cross-quotes compiler plugin is resolved as the JVM-only hearth-cross-quotes_3 artifact and its -Xplugin jar is located via fileConverter.toPath (classpath entries are now xsbti.HashedVirtualFileRef, not File).
  • CI uses sbt testFull (#18) — on sbt 2.0 the bare test task is incremental/machine-cached and a fresh CI run could vacuously pass with "No tests to run", so CI now runs testFull to force a real test run.

  • Hardened dependency management (#22) — a new .scala-steward.conf keeps the build on the Scala 3.3 LTS line by ignoring the whole org.scala-lang group (the only reliable way to stop a scala3-library_sjs1_3 leak) 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-plugin to 1.12.12 (#14), tracked interim Hearth snapshots on the road to 0.4.0 (#15, #20, #23), and bumped actions/checkout v6 → 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!