-
Notifications
You must be signed in to change notification settings - Fork 429
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
Make exponentiation operator print with right associativity. #1678
Conversation
Why was this not an issue before? |
Seems introduced in v3.0.0. Printer issue only |
It's indeed printer only. Parser seems to parse with the correct precedence. /* input */
let foo = (100. /. 2.) ** 2. +. (200. /. 2.) ** 2.; reason 1 [
structure_item (test.re[1,0+0]..[1,0+51])
Pstr_value Nonrec
[
<def>
pattern (test.re[1,0+4]..[1,0+7])
Ppat_var "foo" (test.re[1,0+4]..[1,0+7])
expression (test.re[1,0+10]..[1,0+50])
Pexp_apply
expression ([0,0+-1]..[0,0+-1])
Pexp_ident "+." ([0,0+-1]..[0,0+-1])
[
<arg>
Nolabel
expression (test.re[1,0+10]..[1,0+28])
Pexp_apply
expression ([0,0+-1]..[0,0+-1])
Pexp_ident "**" ([0,0+-1]..[0,0+-1])
[
<arg>
Nolabel
expression (test.re[1,0+10]..[1,0+22])
Pexp_apply
expression ([0,0+-1]..[0,0+-1])
Pexp_ident "/." ([0,0+-1]..[0,0+-1])
[
<arg>
Nolabel
expression (test.re[1,0+11]..[1,0+15])
Pexp_constant PConst_float (100.,None)
<arg>
Nolabel
expression (test.re[1,0+19]..[1,0+21])
Pexp_constant PConst_float (2.,None)
]
<arg>
Nolabel
expression (test.re[1,0+26]..[1,0+28])
Pexp_constant PConst_float (2.,None)
]
<arg>
Nolabel
expression (test.re[1,0+32]..[1,0+50])
Pexp_apply
expression ([0,0+-1]..[0,0+-1])
Pexp_ident "**" ([0,0+-1]..[0,0+-1])
[
<arg>
Nolabel
expression (test.re[1,0+32]..[1,0+44])
Pexp_apply
expression ([0,0+-1]..[0,0+-1])
Pexp_ident "/." ([0,0+-1]..[0,0+-1])
[
<arg>
Nolabel
expression (test.re[1,0+33]..[1,0+37])
Pexp_constant PConst_float (200.,None)
<arg>
Nolabel
expression (test.re[1,0+41]..[1,0+43])
Pexp_constant PConst_float (2.,None)
]
<arg>
Nolabel
expression (test.re[1,0+48]..[1,0+50])
Pexp_constant PConst_float (2.,None)
]
]
]
] reason 3 [
structure_item (exp.re[1,0+0]..[1,0+51])
Pstr_value Nonrec
[
<def>
pattern (exp.re[1,0+4]..[1,0+7])
Ppat_var "foo" (exp.re[1,0+4]..[1,0+7])
expression (exp.re[1,0+10]..[1,0+50])
Pexp_apply
expression (exp.re[1,0+29]..[1,0+31])
Pexp_ident "+." (exp.re[1,0+29]..[1,0+31])
[
<label> ""
expression (exp.re[1,0+10]..[1,0+28])
Pexp_apply
expression (exp.re[1,0+23]..[1,0+25])
Pexp_ident "**" (exp.re[1,0+23]..[1,0+25])
[
<label> ""
expression (exp.re[1,0+10]..[1,0+22])
Pexp_apply
expression (exp.re[1,0+16]..[1,0+18])
Pexp_ident "/." (exp.re[1,0+16]..[1,0+18])
[
<label> ""
expression (exp.re[1,0+11]..[1,0+15])
Pexp_constant Const_float 100.
<label> ""
expression (exp.re[1,0+19]..[1,0+21])
Pexp_constant Const_float 2.
]
<label> ""
expression (exp.re[1,0+26]..[1,0+28])
Pexp_constant Const_float 2.
]
<label> ""
expression (exp.re[1,0+32]..[1,0+50])
Pexp_apply
expression (exp.re[1,0+45]..[1,0+47])
Pexp_ident "**" (exp.re[1,0+45]..[1,0+47])
[
<label> ""
expression (exp.re[1,0+32]..[1,0+44])
Pexp_apply
expression (exp.re[1,0+38]..[1,0+40])
Pexp_ident "/." (exp.re[1,0+38]..[1,0+40])
[
<label> ""
expression (exp.re[1,0+33]..[1,0+37])
Pexp_constant Const_float 200.
<label> ""
expression (exp.re[1,0+41]..[1,0+43])
Pexp_constant Const_float 2.
]
<label> ""
expression (exp.re[1,0+48]..[1,0+50])
Pexp_constant Const_float 2.
]
]
]
] |
Merging! Thanks |
Fixes #1676
The exponentiation operator should be printed with right associativity.
now compiles into
with bucklescript, which is the correct output.