Repository navigation
Erase the half-built ts.If when an optional call fails - #357
Merged
Merged
Conversation
`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>
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.
Summary
f?.(1)for a callee that needs two arguments fails with TS2554, but it left itsts.Ifin the IR: a then-block with noResultOpand an unfilled else. #352 fixed the same shape inconditionalValue. 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, onmainas well. The change keeps that true for a future caller that tolerates the failure.Verification
call-aritycaseoptional_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 onmaintoo, so it is a guard, not a reproduction.🤖 Generated with Claude Code