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

Declear built-in proc or func with empty args cause panic in REPL #265

Closed GreasySlug closed 1 year ago

GreasySlug commented 1 year ago

Describe the bug?

if, if!, while! and for! Declare these when with not arguments cause error then, input a line break causes panic.

Reproducible code

>>> if # if!, while!, for!

Expected result

Invalid syntax error

Actual result

>>> if
Traceback (most recent call last):
  File "<string>", line 28, in <module>
  File "<string>", line 1, in <module>
  File "<stdin>", line -1, in <module>
NameError: name '::if' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 32, in <module>
NameError: name 'e' is not defined

>>>
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 10053, kind: ConnectionAborted, message: "確立された接続がホスト コンピューター 
のソウトウェアによって中止されました。" }', src\dummy.rs:94:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace       
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 10053, kind: ConnectionAborted, message: "確立された接続がホスト コンピューター 
のソウトウェアによって中止されました。" }', src\dummy.rs:94:49

Additional context

No response

Erg version

0.5.13

Python version

python3.10.8

OS

Windows 10