Skip to content

1.1.0 — Branching support and improved diagnostics

Choose a tag to compare

@sorunokoe sorunokoe released this 31 Jul 11:05
· 28 commits to main since this release

Highlights

  • Branching: if/else and switch can now appear directly inside a
    builder closure — no more hoisting to a switch-expression/helper function
    outside the closure. The generated builder implements buildEither(first:)
    / buildEither(second:) plus a generic single-field buildBlock.
    • Optional-typed fields need an explicit else (producing nil) rather
      than a bare if — see README's Branching section
      for why (buildOptional isn't implemented; it would double-wrap an
      already-Optional field's value).
  • Better diagnostics:
    • Multiple-initializer errors are now reported once per extra
      initializer, each at its own location, instead of a single diagnostic
      on the kept initializer.
    • Unlabeled-parameter errors (_ name: String) now come with a Fix-It
      that promotes the internal name to the label, plus a clearer message.

See the updated README for full usage, the branching caveats,
and the complete list of diagnostics.

Compatibility

Fully additive — no breaking changes to the @Mapper macro's existing
generated API. Existing consumers can upgrade from 1.0.0 with no code
changes required.