checker: fix panic on wrong arg count with or-block containing if-expr#26653
Open
medvednikov wants to merge 2 commits intomasterfrom
Open
checker: fix panic on wrong arg count with or-block containing if-expr#26653medvednikov wants to merge 2 commits intomasterfrom
medvednikov wants to merge 2 commits intomasterfrom
Conversation
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
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.
When
check_expected_arg_countdetected wrong argument count andreturned early from
fn_call,node.return_typewas never set(staying as 0). Back in
call_expr, the or-block was still processedusing this zero type, and when
if_exprinside the or-block calledtable.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_typebefore the early returnso the or-block processes correctly even after an argument count error.
https://claude.ai/code/session_01RB9tJf3t9GEuuqcw1inq8k