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

AST for multiple consecutive operations is incorrect #16

Closed
jdidion opened this issue Mar 28, 2020 · 4 comments
Closed

AST for multiple consecutive operations is incorrect #16

jdidion opened this issue Mar 28, 2020 · 4 comments
Assignees

Comments

@jdidion
Copy link
Contributor

jdidion commented Mar 28, 2020

Int x = i + i + i

Expected: ExprAdd(ExprAdd(ExprIdentifier(i),ExprIdentifier(i)), ExprIdentifier(i))

Actual: ExprAdd(ExprIdentifier(i),ExprIdentifier(i))

Possible fixes:

  1. Generate nested structure as above
  2. Make the value of operation types that may be chained a sequence rather than just a and b - this is nicer at least for formatting, because otherwise I need to detect consecutive uses of the same operation and merge them together
@jdidion
Copy link
Contributor Author

jdidion commented Mar 28, 2020

I added branch bug/16-chained-operations with a test case

@orodeh
Copy link
Contributor

orodeh commented Mar 30, 2020

I am working on it.

@orodeh
Copy link
Contributor

orodeh commented Mar 31, 2020

So far, I've removed potential problems from the scala parser, and found out that if you add braces then things work as expected. So, (i + i) + i works, but i + i + i does not. I have asked Patrick if this is a problem in his wdl4j (WDL for Java) code, which uses the same parser.

@orodeh
Copy link
Contributor

orodeh commented Mar 31, 2020

A fix is on master branch.

@orodeh orodeh closed this as completed Mar 31, 2020
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

No branches or pull requests

2 participants