0.4.1 - Compile-Time Performance, 30+ Fixes, and copyMethod / Expr.annotated / Type.Lazy APIs
Latest0.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.Emptyand TupleXXL (arity ≥ 23) views (#313, #314); Scala 3 export-created type aliases now report constructors/flags (#315); inherited constructor-valfields report correct metadata (#327);Method.foldkeeps a value/implicit clause that follows a type-parameter clause (#331);applyTypeArgsis consistent across platforms (#312);Type.isPrimitivecountsUnit,Type.isCaseValsees parameterless Scala 3 enum cases,Type.directChildrenno 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.Cachefor per-expansion memoization;unsortedMethods/unsortedMethodsOffor the (common) search-by-name callers that don't need source order; lazy provider registration and by-name provider skip reasons (the discardedprettyPrintwas ~5% of macro time); deferred per-expansion module-init work; and quote-unpickling fast paths (Ctor.apply, cached bottomTypes).- 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 synthesizedcopymethod (#246, #303).Expr.annotated— cross-platform expression annotation for@nowarn/@SuppressWarnings-wrapped expressions (#334, #340).Type.Lazy— a scope-safe, deferredTypefor 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 publicMethod.sort/sortByfor 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/knownReturninggetter path on Scala 2.13 (the getter's return type had been losing itsAnnotatedType).
- Type-position annotations are now supported on case-class fields, and they survive the
-
macro-commons-inherited bug fixes (#358, #357, #359)
- Intersection-type (
A with B) method listing (#673-class bug);matchOnon 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 aCyclicReference(Chimney #899).
- Intersection-type (
-
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
valTypedefinitions no longer deadlock on Scala 3 (#316);CtorN.ofwith a non-Anyupper 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 unloadableStandardMacroExtensionjar degrades gracefully (warn + skip) instead of poisoning every derivation in the module (#325); the JavaIterableprovider no longer asserts on proper subtypes (#324).
- Scala 2 quoted references from separately-compiled extensions resolve at the expansion site (companions, objects, types) (#320); sibling implicit lazy
-
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
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!