Skip to content

Fix derivation compile crash (made 0.1.3, drop private from inline helpers) - #2

Merged
halotukozak merged 1 commit into
mainfrom
fix-compile-made-013
Jun 15, 2026
Merged

Fix derivation compile crash (made 0.1.3, drop private from inline helpers)#2
halotukozak merged 1 commit into
mainfrom
fix-compile-made-013

Conversation

@halotukozak

Copy link
Copy Markdown
Owner

The project did not compile against made:0.1.2, and derives MCodec crashed the compiler. Two independent fixes.

1. Bump made 0.1.2 → 0.1.3

deriveProduct uses …toArrayOf[Boolean], which needs the containsOnly given that only exists in made 0.1.3. With 0.1.2 the main sources failed to compile:

No given instance of type (?1 : Tuple) containsOnly Boolean … toArrayOf in package made

2. Drop private from the inline helpers in Derivation

With main compiling, every derives MCodec site crashed the compiler during inlining:

java.lang.AssertionError: assertion failed: position not set for
Derivation_this.asInstanceOf[mcodec.MCodec.type & mcodec.Derivation]

Derivation mixes into object MCodec via the singleton self-type this: MCodec.type =>. Inlining a transparent inline method that reaches a private sibling through that self-type makes the compiler synthesize a Derivation_this.asInstanceOf[MCodec.type & Derivation] cast with no source position, tripping the assertion. Removing private (the helpers are inlined away anyway) avoids the synthetic cast. transparent is preserved.

Verification

  • scala-cli --power compile .
  • scala-cli --power test . ✅ — all suites pass, 0 failed

🤖 Generated with Claude Code

… inline derivation helpers

- made 0.1.2 -> 0.1.3: 0.1.2 lacked the `containsOnly` given required by
  `toArrayOf[Boolean]` in `deriveProduct`, so the project did not compile
- Drop `private` from the inline helpers in `Derivation`. As `private`
  members reached through the `this: MCodec.type =>` self-type, inlining
  synthesized a positionless `Derivation_this.asInstanceOf[...]` cast that
  crashed the compiler (`assertion failed: position not set`) at every
  `derives MCodec` call site.

All tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@halotukozak
halotukozak merged commit 364c12f into main Jun 15, 2026
1 check passed
@halotukozak
halotukozak deleted the fix-compile-made-013 branch June 15, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant