Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix self statement semicolon rewrite #1347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pieter12345
Copy link
Contributor

  • Fix semicolons not getting added to self statements where placement was intended.
  • Add documentation.

While this fixes the intended behavior of the addSelfStatements method, two unit tests are broken since this newly added __autoconcat__ ends up in the runtime AST as __statements__:

[ERROR]   OptimizationTest.testSwitchInSwitch:410 expected:
<...s__(switch(dyn(1),2,[switch(dyn(4),5,__statements__(msg('hi')),6,__statements__(msg('hi']))),3,__statements__...>
but was:
<...s__(switch(dyn(1),2,[__statements__(switch(dyn(4),5,__statements__(msg('hi')),6,__statements__(msg('hi')]))),3,__statements__...>

[ERROR]   OptimizationTest.testUnreachableCodeComplex:164 expected:
<...(msg('a'),if(dyn(1),[ifelse(dyn(1),__statements__(die()),dyn(2),__statements__(die()),__statements__(die(]))),__statements__(m...>
but was:
<...(msg('a'),if(dyn(1),[__statements__(ifelse(dyn(1),__statements__(die()),dyn(2),__statements__(die()),__statements__(die()]))),__statements__(m...>

@LadyCailin What is the intended behavior here?

Fix semicolons not getting added to self statements where placement was intended.
@LadyCailin
Copy link
Member

Intended behavior is that switch with inner statements is also a statement. Same for ifelse. It's odd that the outer one isn't a self-statement as well, I suppose it's likely because of the order of operations in the tree descent? Anyways, I would expect the outer switch/if to be in a statement as well, but the fact that the inner ones are statements is expected.

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