erg-lang / erg

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

`Write error` occurs when invalid array declaration #357

Closed GreasySlug closed 1 year ago

GreasySlug commented 1 year ago

Describe the bug?

Arrays can be declared with length specifications The compilation succeeds, but a Write error is received

Reproducible code

[Int; 1]
[1; 1]

Expected result

Above is success, below is error

Actual result

Write error: 既存の接続はリモート ホストに強制的に切断されました。 (os error 10054) error: process didn't exit successfully: target\debug\erg.exe (exit code: 1)

Additional context

No response

Erg version

Erg 0.6.2-nightly.1

Python version

Python3.11.x

OS

Windows 10

mtshiba commented 1 year ago

[x; n] is a shorthand for [x, x, x, ...].

i.e. [Int; 2] == [Int, Int], [1; 2] == [1, 1]

[1; 2] does not work properly, I fixed.