unexpected precedence #2506

markussieber opened this Issue Aug 23, 2012 · 4 comments


None yet

4 participants

if X and p or= n 

is transcompiled to

if (X && p || (p = n)) {

should be

if (X && (p || (p = n))) {

in my opinion


Nice catch.

satyr commented Sep 3, 2012

Is there a difference in behavior though?


Is there a difference in behavior though?

Yes. In the first case a falsy X causes the value of n to be assigned to p. In the second case a falsy X short-circuits the expression. The expression may evaluate differently as a result, also.

@satyr satyr added a commit to satyr/coco that referenced this issue Sep 3, 2012
@satyr satyr fixed `a && b ||= c` (jashkenas/coffeescript#2506) 3737564

Duplicate of #2181.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment