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 parenthesization for binary operators #189

Merged
merged 9 commits into from
Oct 23, 2023

Conversation

HarrisL2
Copy link
Contributor

@HarrisL2 HarrisL2 commented Oct 9, 2023

A small modification that shouldn't impact other code, fixes part of #65

Copy link
Contributor

@LPTK LPTK left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix!

Only thing is that there's already shared/src/test/diff/codegen/Parentheses.mls, so better move your test cases there.

Also, let's add this one:

fun (--) minusminus(a, b) = a - b
//│ fun (--) minusminus: (Int, Int) -> Int

:js
1 -- (3 -- 5)
//│ Int
//│ // Prelude
//│ class TypingUnit3 {}
//│ const typing_unit3 = new TypingUnit3;
//│ // Query 1
//│ res = minusminus(1, minusminus(3, 5));
//│ // End of generated code
//│ res
//│     = 3

It doesn't have a problem because custom operators are desugared to plain methods. It was not clear to me that this is why your condition JSBinary.operators.contains(op) is sufficient in JSBackend.scala. Better add a comment to that effect there!

fun (-+-) complex(a, b) = a - 2*b
//│ fun (-+-) complex: (Int, Int) -> Int

:p
Copy link
Contributor

Choose a reason for hiding this comment

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

The test is not clean. Please remove this and finally get this PR merged...

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind, I did it myself.

@LPTK LPTK merged commit 74d13f2 into hkust-taco:new-definition-typing Oct 23, 2023
1 check passed
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