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

Coconut REPL crashes when importing some functions with mixed typed and untyped arguments. #667

Closed
tom-a-horrocks opened this issue Aug 12, 2022 · 2 comments

Comments

@tom-a-horrocks
Copy link

Steps to reproduce:

  1. Create file my_file.coco containing def fun0(a: str, b) = 'foo'.
  2. Open latest coconut REPL (v1.6.0) and enter import my_file.
  3. Note the REPL crashes with error CoconutSyntaxError: non-default arguments must come first or after star argument/separator.

This is a REPL issue only: coconut my_file.coco compiles and runs without issue. I can't figure out the exact pattern of typed and untyped arguments that cause the crash, but here's all combinations of 2 and 3-arugment functions:

REPL imports without issue
def fun00(a, b) = 'foo'
def fun02(a, b: str) = 'foo'
def fun03(a: str, b: str) = 'foo'
def fun04(a, b, c) = 'foo'
def fun07(a, b, c: str) = 'foo'
def fun10(a, b: str, c: str) = 'foo'
def fun11(a: str, b: str, c: str) = 'foo'

REPL crashes on import
def fun01(a: str, b) = 'foo'
def fun05(a: str, b, c) = 'foo'
def fun06(a, b: str, c) = 'foo'
def fun08(a: str, b: str, c) = 'foo'
def fun09(a: str, b, c: str) = 'foo'

@tom-a-horrocks tom-a-horrocks changed the title Coconut REPL crashes when importing certain functions having typed and untyped arguments. Coconut REPL crashes when importing some functions with mixed typed and untyped arguments. Aug 12, 2022
@evhub evhub added the bug label Aug 12, 2022
@evhub evhub added this to the v2.0.0 milestone Aug 12, 2022
@evhub
Copy link
Owner

evhub commented Aug 12, 2022

Strange. Can you show me the output of coconut --version?

Also, if you switch to develop (pip install -U coconut-develop), does it resolve the issue?

@tom-a-horrocks
Copy link
Author

coconut --version:

Coconut: Version 1.6.0 [Vocational Guidance Counsellor] running on Python 3.9.7 and Cython cPyparsing v2.4.7.1.1.0

Switching to coconut-develop fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants