Skip to content

Commit ddbc6bf

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Fix JET-flagged may-be-undefined locals in _parse_head/_parse_line (#46)
The QA group's JET linting (added in #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: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 480e52f commit ddbc6bf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/ConcreteStructs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ function _parse_head(head::Expr)
193193
elseif head.head === :(<:)
194194
super = head.args[2]
195195
struct_name, type_params = _parse_head(head.args[1])
196+
else
197+
error("Invalid usage of @concrete.")
196198
end
197199

198200
return (struct_name, type_params, super)
@@ -210,6 +212,7 @@ _parse_line(line) = (line, nothing)
210212
function _parse_line(line::Expr)
211213
assignment = line.head === :(=)
212214
annotation = nothing
215+
val = nothing
213216
if assignment
214217
val = line.args[2]
215218
line, annotation = _parse_line(line.args[1])

0 commit comments

Comments
 (0)