Fix undefined nerror (typo for error) on the invalid-@concrete path#41
Merged
ChrisRackauckas merged 1 commit intoJun 8, 2026
Merged
Conversation
`_find_struct_def` fell through to `nerror("Invalid usage of @concrete.")`
when given an expression that is neither a `:struct` definition nor a
`:macrocall` wrapping one. `nerror` is undefined (a typo for `error`), so
this path threw `UndefVarError(:nerror)` instead of the intended clear
`ErrorException`. JET flagged the undefined binding.
Change `nerror` to `error` and add a regression test exercising the
invalid-usage path (`@concrete x = 1`), asserting it now throws an
`ErrorException` with the "Invalid usage of @concrete." message. The test
fails (UndefVarError) before the fix and passes after.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
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.
JET flagged an undefined binding in
src/ConcreteStructs.jl:_find_struct_defis supposed to raise a clear error when@concreteis applied to an expression that is neither a:structdefinition nor a:macrocallwrapping one. But the fallthrough callednerror, which is undefined — a typo forerror. As a result, on that invalid-usage path the macro threwUndefVarError(:nerror)instead of the intendedErrorException("Invalid usage of @concrete."). Existing tests never exercised that path, so the bug stayed latent.Fix
nerror(toerror(atsrc/ConcreteStructs.jl:254.nerroris defined nowhere in the package (confirmed via grep), so it really is a typo.Test
test/runtests.jlthat exercises the path via@macroexpand(@concrete x = 1)(an=expression reaches the fallthrough) and asserts:Verified locally on Julia 1.11:
UndefVarError: \nerror` not defined in `ConcreteStructs``.ErrorExceptionwith the "Invalid usage of @concrete." message), and the full suite is green (40/40).Ignore until reviewed by @ChrisRackauckas.