Skip to content

checker: fix panic on wrong arg count with or-block containing if-expr#26653

Open
medvednikov wants to merge 2 commits intomasterfrom
claude/fix-compiler-panic-iY3WT
Open

checker: fix panic on wrong arg count with or-block containing if-expr#26653
medvednikov wants to merge 2 commits intomasterfrom
claude/fix-compiler-panic-iY3WT

Conversation

@medvednikov
Copy link
Member

When check_expected_arg_count detected wrong argument count and
returned early from fn_call, node.return_type was never set
(staying as 0). Back in call_expr, the or-block was still processed
using this zero type, and when if_expr inside the or-block called
table.type_kind(0) -> table.sym(0), the compiler panicked with
"table.sym: invalid type (typ=ast.Type(0x0 = 0) idx=0)".

Fix: set node.return_type = func.return_type before the early return
so the or-block processes correctly even after an argument count error.

https://claude.ai/code/session_01RB9tJf3t9GEuuqcw1inq8k

When `check_expected_arg_count` detected wrong argument count and
returned early from `fn_call`, `node.return_type` was never set
(staying as 0). Back in `call_expr`, the or-block was still processed
using this zero type, and when `if_expr` inside the or-block called
`table.type_kind(0)` -> `table.sym(0)`, the compiler panicked with
"table.sym: invalid type (typ=ast.Type(0x0 = 0) idx=0)".

Fix: set `node.return_type = func.return_type` before the early return
so the or-block processes correctly even after an argument count error.

https://claude.ai/code/session_01RB9tJf3t9GEuuqcw1inq8k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants