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

"for thing, i (in|of) things" doesn't compile inside an object definition #3216

Closed
mattparlane opened this issue Oct 23, 2013 · 5 comments · Fixed by #3328
Closed

"for thing, i (in|of) things" doesn't compile inside an object definition #3216

mattparlane opened this issue Oct 23, 2013 · 5 comments · Fixed by #3328
Labels

Comments

@mattparlane
Copy link

This code:

o =
  first: 'thing'
  second: for thing, i of things
    thing
  third: for thing, i in things
    thing

compiled correctly in 1.5.0, but in 1.6.0 and later, it gives this error:

test.coffee:3:19: error: unexpected }
  second: for thing, i of things

The absence or presence of any of the lines doesn't seem to make much difference -- in other words, removing the "first" line doesn't matter, and both the "second" and "third" lines fail on their own.

@connec
Copy link
Collaborator

connec commented Oct 23, 2013

Worth noting that without the , i it all works:

o =
  key: v for v in a
  key: for v in a then v
  key: for v in a
    v

With the , i all variants fail with the same error:

o =
  key: v for v, i in a
o =
  key: for v, i in a then v
o =
  key: for v, i in a
    v

# All fail with the following error, always with the "v" highlighted
# [stdin]:2:YY: error: unexpected }
#   key: [...] for v, i in a [...]
#                  ^

However, wrapping the loops in parenthesis will work:

o =
  key: (v for v, i in a)
  key: (for v, i in a then v)
  key: (for v, i in a
    v
  )

@mattparlane
Copy link
Author

Yeah, I meant to mention that. I didn't realise that wrapping them in parens worked -- thanks!

I'll leave it open though since it does appear to be a regression.

michaelficarra added a commit that referenced this issue Jan 26, 2014
Fixes #3216 for declarations in object literals
@mattparlane
Copy link
Author

You guys all rock! Any clues on when the next release including this change will be?

@xixixao
Copy link
Contributor

xixixao commented Jan 26, 2014

Tomorrow. Right @jashkenas ? :)

@michaelficarra
Copy link
Collaborator

@xixixao: As soon as @jashkenas approves #3326, I can cut the release.

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

Successfully merging a pull request may close this issue.

4 participants