evhub / evhub/coconut

Type hints don't work with *args inside data

Open
#579 0 comments 0 reactions 0 assignees View on GitHub
modification
Dominant language
Python
Stars
4.4k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

Coconut's `data` allows for arbitrary length constructor using the `*args` syntax, like a function, but don't allow for type hints in those.

This will work:

```python
def foo(*args: float):
```
But this won't:

```python
data foo(*args: float):
```

Coconut has built-in mypy support, so I think that syntax should be accepted (and replicated to the `__new__`, so mypy won't complain when using `--strict`).

Contributor guide

Open the contributing guide

Research direction

Start by locating Coconut's handling of data constructors and its existing type-hint generation, then compare it with Python's *args annotations. Check how the constructor is replicated to __new__ and run the relevant mypy checks with --strict. Done means data foo(*args: float) is accepted and the generated code satisfies mypy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.