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

Invalid syntax error with array comprehension #495

Open
mtshiba opened this issue Mar 18, 2024 · 0 comments
Open

Invalid syntax error with array comprehension #495

mtshiba opened this issue Mar 18, 2024 · 0 comments
Labels
bug Something isn't working bug-parser seems-easy

Comments

@mtshiba
Copy link
Member

mtshiba commented Mar 18, 2024

Describe the bug?

If we use array comprehension to return the result without any processing, a syntax error will occur.
It's simply a parser bug.

Reproducible code

print! [ x | x <- [1, 2] ]

Expected result

[1, 2]

Actual result

Error[#0761]: File <stdin>, line 1,

1 │ print! [ x | x <- [1, 2] ]
  ·                --

SyntaxError: expected: VBar, got: Inclusion

Additional context

The following code works.

lc = [i * 2 | i <- 1..4]
assert lc == [2, 4, 6, 8]
lc2 = [i + 1 | i <- 1..5 | i <= 3]
assert lc2 == [2, 3, 4]
lc3 = [i <- 1..10 | i <= 5]
assert lc3 == [1, 2, 3, 4, 5]

Erg version

0.6.32

Python version

None

OS

None

@mtshiba mtshiba added bug Something isn't working bug-parser seems-easy labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bug-parser seems-easy
Projects
None yet
Development

No branches or pull requests

1 participant