Skip to content

TypeChecker: don't ICE when duplicate user-defined operators are reached before the using for check#16720

Open
genisis0x wants to merge 1 commit into
argotorg:developfrom
genisis0x:fix/16616-16636-ice-duplicate-using-for-operator
Open

TypeChecker: don't ICE when duplicate user-defined operators are reached before the using for check#16720
genisis0x wants to merge 1 commit into
argotorg:developfrom
genisis0x:fix/16616-16636-ice-duplicate-using-for-operator

Conversation

@genisis0x
Copy link
Copy Markdown

Summary

`TypeChecker::visit(UnaryOperation)` and `endVisit(BinaryOperation)` both asserted `m_errorReporter.hasErrors()` when more than one matching user-defined operator definition was found, relying on the duplicate check inside `endVisit(UsingForDirective)` (error 4705) to have already fired. That assumption breaks when a function body references the operator before the directive is fully type-checked — the duplicate is visible via the scope lookup, but no error has been emitted yet, so the assertion triggers an ICE.

Drop the assertion. Picking the first match is harmless because the directive's duplicate check still runs and surfaces error 4705 to the user, halting compilation cleanly.

Fixes #16616
Fixes #16636

Test plan

…hed before the `using for` check

`TypeChecker::visit(UnaryOperation)` and `endVisit(BinaryOperation)` both
asserted `m_errorReporter.hasErrors()` when more than one matching
user-defined operator definition was found, relying on the duplicate
check inside `endVisit(UsingForDirective)` (error 4705) to have already
fired. That assumption breaks when a function body references the
operator before the directive is fully type-checked — the duplicate is
visible via the scope lookup, but no error has been emitted yet, so the
assertion triggers an ICE.

Drop the assertion. Picking the first match is harmless because the
directive's duplicate check still runs and surfaces error 4705 to the
user, halting compilation cleanly.

Fixes argotorg#16616
Fixes argotorg#16636
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant