Skip to content

Conversation

@Perryvw
Copy link
Member

@Perryvw Perryvw commented Jul 11, 2021

Fixes #1044 Crash is the result of an optional assignment left-hand-side to be transformed to a lualib CallExpression, but we only allow identifiers or table index expressions as assignment left-hand side.

If trying to assign to an optional left-hand-side, exit out of transformAssignment early with a diagnostic. TypeScript also already throws a diagnostic here, but it felt wrong to just silently ignore code.

@Perryvw Perryvw requested review from lolleko and tomblind July 11, 2021 18:29
@Perryvw Perryvw merged commit 69a44a6 into master Aug 3, 2021
@Perryvw Perryvw deleted the optional-chaining-fix branch August 3, 2021 19:25
sanikoyes pushed a commit to sanikoyes/TypeScriptToLua that referenced this pull request Sep 24, 2021
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.

Incorrect left-hand optional chain assignment crashes compiler

1 participant