erg-lang / erg

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

Improve Tuple Type parse #328

Open GreasySlug opened 1 year ago

GreasySlug commented 1 year ago

Describe the code issue?

In the current implementation, the parse starts when the first element is followed by a comma This is processed in the same way for parentheses Thus, the parentheses will cause unintended behavior, since the analysis will be the same as if the parentheses were not present

>> f x, y)
Error[#0205]: File <stdin>, line 1, 

1 | f x, y)
  : ------
  :      `- `;` or newline should be added

SyntaxError: invalid syntax

>>> f(x, y
::f:
    ::x
    ::y

Additional context

Erg version

0.6.1-nightly.1

Python version

Python3.11.x

OS

Windows 10

mtshiba commented 1 year ago

Perhaps related to:

https://github.com/erg-lang/erg/issues/245