Fix JET-flagged may-be-undefined locals failing QA CI#46
Merged
ChrisRackauckas merged 1 commit intoJun 16, 2026
Merged
Conversation
The QA group's JET linting (added in SciML#40) reports four "local variable may be undefined" errors that fail CI on main: - `_parse_head(head::Expr)`: the `if/elseif` over `head.head` had no fallthrough, so `struct_name`, `type_params`, and `super` were undefined for any other head. Add an `else` that errors, matching the existing invalid-usage handling elsewhere in the file. This makes the function total and removes three of the JET findings. - `_parse_line(line::Expr)`: `val` was bound only inside `if assignment` but its binding is visible at the later `if assignment` read site, so JET cannot prove it defined. Initialize `val = nothing` alongside the existing `annotation = nothing`; behavior is unchanged since `val` is only read when `assignment` is true. Verified locally on Julia 1.12 (CI's `julia 1`): the QA group now passes (Aqua 11/11, JET 1/1, zero findings). Core group still passes 40/40 on Julia 1.10, including the invalid-usage assertion. 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.
What
Fixes the failing QA CI on
main. The QA group's JET linting (JET.test_package, added in #40) reports four "local variable may be undefined" errors and fails thetests / QA (julia 1)lane:These are genuine latent issues in the source, surfaced by the JET lint check that was newly added to the QA group; they are not fixed by skipping/loosening anything.
Fix (3 lines, behavior-preserving)
_parse_head(head::Expr)— theif head.head === :curly / elseif === :(<:)chain had no fallthrough, so for any otherheadthe three returned locals were undefined. Added anelsethaterror("Invalid usage of @concrete."), matching the existing invalid-usage handling in_find_struct_def/_apply_original_expr. This makes the function total and clears three findings._parse_line(line::Expr)—valwas assigned only insideif assignment, but its binding is read at the laterif assignment ? ... : ...site, which JET cannot prove reachable-only-when-defined. Initializedval = nothingnext to the existingannotation = nothing. No behavior change:valis only read whenassignmentis true.Local verification
julia 1), QA sub-env:Aqua11/11 andJET1/1 pass, zero JET findings.--checkonsrc/ConcreteStructs.jl: clean (exit 0).Please ignore until reviewed by @ChrisRackauckas.