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

Lexer: Ending a “for of” or “for in” loop with a function in which you provide an object, causes the next line to result in an error #4564

Closed
hawkerboy7 opened this issue Jun 8, 2017 · 3 comments
Labels

Comments

@hawkerboy7
Copy link

hawkerboy7 commented Jun 8, 2017

The following code fails to compile:

for key of test a: 5
 add[key] = true

Error on line 2: unexpected [

Adding parentheses works:

for key of test(a: 5)
 add[key] = true

And the one-liner works too:

add[key] = true for key of test a: 5

I feel this is a bug or is this expected behaviour?

@GeoffreyBooth
Copy link
Collaborator

GeoffreyBooth commented Jun 11, 2017

Minimal case:

for key of fn k: v
  a

###
[stdin]:2:4: error: unexpected end of input
  a
   ^

Interestingly, this compiles:

a for key of fn k: v

@GeoffreyBooth GeoffreyBooth changed the title Ending a "for of"-loop or "for in"-loop with a function in which you provide an object, causes the next line to result in an error Lexer: Ending a “for of” or “for in” loop with a function in which you provide an object, causes the next line to result in an error Jun 11, 2017
helixbass added a commit to helixbass/copheescript that referenced this issue Jun 13, 2017
GeoffreyBooth pushed a commit that referenced this issue Jun 15, 2017
* indent closes implicit object [Fixes #4564]

* add test for just implicit object

* remove stray lib file
@helixbass
Copy link
Collaborator

@hawkerboy7 this is fixed on 2 via #4570

@GeoffreyBooth this can be closed?

@GeoffreyBooth
Copy link
Collaborator

Yes! Thanks 😄

Fixed via #4570.

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