Skip to content

Incorrect code generation with existential operator inside brackets #3309

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

Closed
Diggsey opened this issue Jan 13, 2014 · 0 comments
Closed

Incorrect code generation with existential operator inside brackets #3309

Diggsey opened this issue Jan 13, 2014 · 0 comments
Labels

Comments

@Diggsey
Copy link

Diggsey commented Jan 13, 2014

The following code will alert the value "true", when clearly the only two possible outputs of the "if" are the string or undefined. It seems like coffeescript doesn't properly understand the precedence rules for the javascript ternary operator. Removing the brackets from the condition will miraculously fix it...

f = -> true

result = if (f?()) then "THIS SHOULD BE ALERTED!"

alert result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants