Fix derivation compile crash (made 0.1.3, drop private from inline helpers) - #2
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The project did not compile against
made:0.1.2, andderives MCodeccrashed the compiler. Two independent fixes.1. Bump
made0.1.2 → 0.1.3deriveProductuses…toArrayOf[Boolean], which needs thecontainsOnlygiven that only exists inmade0.1.3. With 0.1.2 the main sources failed to compile:2. Drop
privatefrom the inline helpers inDerivationWith main compiling, every
derives MCodecsite crashed the compiler during inlining:Derivationmixes intoobject MCodecvia the singleton self-typethis: MCodec.type =>. Inlining atransparent inlinemethod that reaches aprivatesibling through that self-type makes the compiler synthesize aDerivation_this.asInstanceOf[MCodec.type & Derivation]cast with no source position, tripping the assertion. Removingprivate(the helpers are inlined away anyway) avoids the synthetic cast.transparentis preserved.Verification
scala-cli --power compile .✅scala-cli --power test .✅ — all suites pass, 0 failed🤖 Generated with Claude Code