fix: make the unsupported-int-width message compile - #41
Merged
Conversation
packInt and getIntSize both end their signed and unsigned branches with a @CompileError that concatenates a u16 onto a string: @CompileError("Unsupported signed int with " ++ type_info.int.bits ++ "bits"); ++ needs indexable operands, so this fails on its own terms before the message is produced. Asking for an unsupported width gave error: expected indexable; found 'u16' rather than the intended text. Six sites, across both functions and both resolveFixedSizeIntHeader branches. std.fmt.comptimePrint builds it properly, and the missing space before "bits" is gone. packInt(&w, i96, 1) now reports error: Unsupported signed int with 96 bits Never surfaced because nothing instantiates these with an unsupported width, the same reason the defects behind #21, #22 and #23 stayed hidden. The message is reachable in practice, though: std.Io.Timestamp and std.Io.Duration are both struct { nanoseconds: i96 }, so encoding either lands here.
|
Warning Review limit reachedNext included review available in 18 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Fixes #34.
packIntandgetIntSizeboth end their signed and unsigned branches with a@compileErrorthat concatenates au16onto a string:++needs indexable operands, so it fails on its own terms before the message is ever produced. Before:After:
Six sites — both functions, plus both branches of
resolveFixedSizeIntHeader.std.fmt.comptimePrintbuilds the message properly, and the missing space beforebitsis gone.Never surfaced because nothing instantiates these with an unsupported width, which is the same reason the defects behind #21, #22 and #23 stayed hidden. It is reachable in practice though:
std.Io.Timestampandstd.Io.Durationare bothstruct { nanoseconds: i96 }, so encoding either one lands exactly here, and a legible error is the difference between "this width is not supported" and a confusing complaint about++.Reproduced and verified with
packInt(&w, i96, 1).No changelog entry — the error text is not user-visible until you hit it, and nothing about the supported widths changed. Happy to add one if you would rather it were recorded.
zig build test: 183/183 pass.