Skip to content

Erase the half-built ts.If when an optional call fails - #357

Merged
ASDAlexander77 merged 1 commit into
mainfrom
fix-optional-call-half-built-if
Sep 24, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
fix-optional-call-half-built-if

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

f?.(1) for a callee that needs two arguments fails with TS2554, but it left its ts.If in the IR: a then-block with no ResultOp and an unfilled else. #352 fixed the same shape in conditionalValue. The if is now erased, and the insertion point restored, before the failure is returned.

This is defensive. No caller carries on after this failure today. At every site tried (local, module level, class field, template literal, ??, typeof, void callee), the compile stops with the TS2554 error alone, on main as well. The change keeps that true for a future caller that tolerates the failure.

Verification

  • New call-arity case optional_call_value: the result is used inside an expression at module level, in a global's initializer. It must print the TS2554 message with no stack dump or assertion. It passes on main too, so it is a guard, not a reproduction.
  • Windows Release: 2859/2859 passed.
  • Linux (WSL): 2854/2854 passed.

🤖 Generated with Claude Code

`f?.(1)` for a callee that needs two arguments failed with TS2554 but
left its ts.If in the IR, with a then-block holding no ResultOp and an
unfilled else. #352 fixed the same shape in conditionalValue. The if is
now erased before the failure is returned.

No caller carries on after this failure today: at every site tried
(local, module level, class field, template literal, ??, typeof) the
compile stops with the TS2554 error alone, on main as well. This keeps
it that way for a caller that does. The new call-arity case,
optional_call_value, uses the result inside an expression at module
level, in a global's initializer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 65da860 into main Sep 24, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix-optional-call-half-built-if branch September 24, 2026 00:01
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.

1 participant