-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Incompatible code generated with 1.12.6 using function call followed by if statement. #4568
Comments
Perhaps you somehow triggered it being parsed as |
bigger example of code failing in 1.12.6 bug working in 1.12.5 and lower:
results in 1.12.6 (example generated by: http://coffeescript.org/#try)
results in 1.12.5. (example generated by js2.coffee:
both examples can also locally be reproduced by transpiling locally |
Paging @helixbass since it might be from #4554 (?). |
@vendethiel not a bad guess but #4554 was only merged into |
It’s from #4532, allowing implicit braces after a test:
bam: () ->
fn bar: {
foo: 123
} if not condition it’s ambiguous what the If you insist on a trailing test:
bam: () ->
(fn bar: {
foo: 123
}) if not condition I don’t think there’s a bug here. Yes the output changed, but it’s as a result of fixing another bug regarding implicit braces and |
Actually it's probably due to #4534. But my point still stands. |
I don't think we should be changing such semantics on 1.x. |
Yeah we shouldn’t have merged #4534 into So I guess the question is what to do about it. We’re keeping #4534 on |
Until version 1.12.5 the code
foo bar if baz
transpiled toif(baz){foo(bar)}
since 1.12.6 this code transpiles to
foo(baz ? bar: void 0)
which breaks old code.But when i use
mood = greatlyImproved if singing
(from docs) it compiles toif (singing) {mood = greatlyImproved;}
Is this indented? Maybe by 'Bugfixes for incorrect code generated by the ? operator within a termary if statement`? I cant find any Bug report for that.
bg,
Johannes
The text was updated successfully, but these errors were encountered: