Skip to content

Fix element access exception caused by invalid TS#1410

Merged
Perryvw merged 2 commits intomasterfrom
exception-elementaccess
Feb 26, 2023
Merged

Fix element access exception caused by invalid TS#1410
Perryvw merged 2 commits intomasterfrom
exception-elementaccess

Conversation

@Perryvw
Copy link
Copy Markdown
Member

@Perryvw Perryvw commented Feb 26, 2023

No description provided.

});
});

test("no exception from invalid TS syntax", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do consider these "sequence expressions" (a, b execute a, then use b as a result) valid syntax and the code below is just let [a, b] = testFunc(5)[a, b] = testFunc(b)

This test is more "can use sequence expressions inside an element access expression without fatal errors" which isn't related to destructuring

Don't want to cover all potential invalid TS code!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to at least not throw as long as a valid AST is passed into tstl. I guess I should not call it invalid syntax because the syntax itself is valid, it's just that there are also semantic errors reported by TS, in which case we will not guarantee we produce correct output, but there should be no exception.

@Perryvw Perryvw merged commit 4511e17 into master Feb 26, 2023
@Perryvw Perryvw deleted the exception-elementaccess branch February 26, 2023 14:03
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.

2 participants