Skip to content

0.4.1 - Compile-Time Performance, 30+ Fixes, and copyMethod / Expr.annotated / Type.Lazy APIs

Latest

Choose a tag to compare

@MateuszKubuszok MateuszKubuszok released this 14 Jul 07:30
abae0f1

0.4.1 is a polish and quality-of-life release. Chimney is now Hearth-powered — and it got there on 0.4.0, without waiting for anything in this release; where it met a rough edge it simply worked around it, exactly as a good downstream library should. 0.4.1 upstreams the proper fixes so those workarounds (and the ones Kindlings carried) can be dropped, adds a compile-time performance pass, and lands a few small, requested APIs. It is a non-breaking, drop-in release: MiMa is enabled against 0.4.0 and green.

Highlights

  • Chimney is now built on Hearth — 0.4.1 upstreams the rough edges it worked around (#332)

    • Chimney migrated onto Hearth on 0.4.0 and shipped with local workarounds for the sharp corners it hit; 0.4.1 folds the real fixes back in so they are no longer needed. A single batch closed 20 such issues (#306#330), with several follow-up rounds completing the incomplete fixes (#335, #336, #337, #345).
    • Representative fixes: NamedTuple.Empty and TupleXXL (arity ≥ 23) views (#313, #314); Scala 3 export-created type aliases now report constructors/flags (#315); inherited constructor-val fields report correct metadata (#327); Method.fold keeps a value/implicit clause that follows a type-parameter clause (#331); applyTypeArgs is consistent across platforms (#312); Type.isPrimitive counts Unit, Type.isCaseVal sees parameterless Scala 3 enum cases, Type.directChildren no longer collapses same-named subtypes (#310, #311, #309).
  • Compile-time performance: 27.2% → 18.9% macro share on a dense derivation load (#347, #350, #346)

    • Type.Cache for per-expansion memoization; unsortedMethods / unsortedMethodsOf for the (common) search-by-name callers that don't need source order; lazy provider registration and by-name provider skip reasons (the discarded prettyPrint was ~5% of macro time); deferred per-expansion module-init work; and quote-unpickling fast paths (Ctor.apply, cached bottom Types).
    • All binary-compatible — hot paths that had to change signature are shimmed as private[…] members so existing compiled extensions still link.
  • Small new APIs

    • CaseClass.copyMethod — a helper that surfaces the synthesized copy method (#246, #303).
    • Expr.annotated — cross-platform expression annotation for @nowarn / @SuppressWarnings-wrapped expressions (#334, #340).
    • Type.Lazy — a scope-safe, deferred Type for per-expansion helper objects (the primitive behind Kindlings' 353-val-to-lazy migration) (#356).
    • IsCollectionOf.sizeHintForBuilder — safe per-provider builder pre-allocation for O(1)-sized collections (#354), plus public Method.sort / sortBy for the filter-first pattern.
  • Type annotations in case classes (#306, #348)

    • Type-position annotations are now supported on case-class fields, and they survive the caseFields / knownReturning getter path on Scala 2.13 (the getter's return type had been losing its AnnotatedType).
  • macro-commons-inherited bug fixes (#358, #357, #359)

    • Intersection-type (A with B) method listing (#673-class bug); matchOn on lowercase-named enum values; sealed-hierarchy children now come back in stable declaration order on Scala 3 (was a source-position flake); and a mid-inference member is reflected without leaking a CyclicReference (Chimney #899).
  • Cross-quotes & standard-extensions robustness

    • Scala 2 quoted references from separately-compiled extensions resolve at the expansion site (companions, objects, types) (#320); sibling implicit lazy val Type definitions no longer deadlock on Scala 3 (#316); CtorN.of with a non-Any upper bound and wildcard existential args generate typechecking code (#307, #343); EnumSet/EnumMap quotes survive re-typecheck and match enums from the current run (#322, #323).
    • Built-in providers no longer match bottom types (Null/Nothing) and crash eagerly (#319); an unloadable StandardMacroExtension jar degrades gracefully (warn + skip) instead of poisoning every derivation in the module (#325); the Java Iterable provider no longer asserts on proper subtypes (#324).
  • Binary compatibility

    • MiMa is now enabled against 0.4.0 and passes on the public API — 0.4.1 is a drop-in upgrade from 0.4.0.
  • Hearth-based libraries to learn from

    • Chimney — the canonical data-transformation library, now with a Hearth-powered macro layer.
    • Kindlings — derivation, DI, mocking, optics and more; the newest release on Hearth 0.4.1 is 0.3.1.
    • Pipez (0.6.1) and refined-compat (0.2.1) also track this release.

Summary

0.4.1 is a quality-of-life release for the libraries built on Hearth: it upstreams the fixes that Chimney and Kindlings had been working around locally, cuts macro-expansion overhead on a dense derivation load from a 27.2% to an 18.9% share, and adds CaseClass.copyMethod, Expr.annotated, Type.Lazy, and IsCollectionOf.sizeHintForBuilder. None of it was a prerequisite for shipping on 0.4.0 — it just makes downstream maintainers' lives easier. It is binary-compatible with 0.4.0 (MiMa-verified), so upgrading is a one-line bump.

Be sure to look at our documentation, star the project ⭐ and leave us some feedback!