erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.69k stars 55 forks source link

Array subscription is not work properly #299

Closed mtshiba closed 1 year ago

mtshiba commented 1 year ago

Describe the bug?

...

Reproducible code

x = [1, 2, 3][0]
print! x

Expected result

1

Actual result

[1, 2, 3]

Additional context

this code seems to be parsed as

x = [1, 2, 3]
[0]
print! x

Erg version

0.6.0-beta.2

Python version

No response

OS

None

GreasySlug commented 1 year ago

Does this include Tuple, Str, etc.?

zero = (1, 0, 2).1
h = "Hello, world"[0]