RecordBuilderMacro
The macro behind AvroVulcan.recordBuilder — walks A's case fields at EXPANSION and emits the WholeRecordBuilder.RecordShape the runtime assembly resolves against the codec's schema.
The macro's whole job is classification: it never emits per-field code. Each case field becomes one WholeRecordBuilder.FieldShape arm —
Option[X](dealiased) → WholeRecordBuilder.OptionKind overX's classification;- Boolean / Int / Long / Float / Double / String → WholeRecordBuilder.DirectKind;
- a case class (Case-flagged class, not sealed, not a module, not an AnyVal) → WholeRecordBuilder.RecordKind with the sub-shape, or WholeRecordBuilder.SelfKind when the type is already an ancestor on the derivation path (recursive case classes terminate at compile time and resolve through the runtime level chain);
- everything else → WholeRecordBuilder.CodecKind holding the field type's own
vulcan.Codec, summoned HERE so the caller's scope answers for its leaves — a missing leaf codec is a compile error pointing at the exact field.
Because the emitted value is plain data, everything schema-dependent (slot resolution, arm validation) happens at builder construction in WholeRecordBuilder.derive — ordinary testable Scala, no staged code. The whole classification lives in builderImpl as local defs under ONE Quotes: TypeRepr / Symbol are path-dependent on the Quotes instance, so a (using Quotes)-taking helper called from inside a quote would type against a different path.
Attributes
- Source
- RecordBuilderMacro.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RecordBuilderMacro.type