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

Bug: Array literals that contain function or implicit objects with function values #5121

Closed
naeleejang opened this issue Oct 17, 2018 · 3 comments
Assignees
Labels

Comments

@naeleejang
Copy link

naeleejang commented Oct 17, 2018

Choose one: is this a bug report or feature request?

Bug report

Input Code

[k: ->]

and

[j: -> m is 0]

and

[->]

Expected Behavior

The above should compile.

Current Behavior

It does not compile.

Possible Solution

Context

[->a]

compiles and

[->,a]

compiles

Environment

  • CoffeeScript version: 2 only, version 1 compiles
  • Node.js version:
@naeleejang naeleejang changed the title Bug: Array literal with implicit object that contains a function value Bug: Array literals that contains function or implicit objects with function values Oct 17, 2018
@naeleejang naeleejang changed the title Bug: Array literals that contains function or implicit objects with function values Bug: Array literals that contain function or implicit objects with function values Oct 17, 2018
@zdenko
Copy link
Collaborator

zdenko commented Oct 18, 2018

Looks like a Rewriter issue.
All of these compiles:

[k: ->,]
[
  k: ->
]

[
  j: -> m is 0
]

[ ->,]
[
  ->
]

@zdenko zdenko self-assigned this Oct 18, 2018
@GeoffreyBooth GeoffreyBooth added bug and removed bug labels Apr 7, 2019
@helixbass
Copy link
Collaborator

Ya I think at least the cases where -> is immediately followed by ] could be handled by a similar fix to #4588

With the other example [j: -> m is 0], I'm not sure, you'd probably have to go a little deeper into the rewriter

@GeoffreyBooth
Copy link
Collaborator

All of these are fixed in 2.5.0 except [j: -> m is 0], which I’m not sure is something that should necessarily be supported; it can be compiled if you use multiline style:

[j: ->
  m is 0
]

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

4 participants