patrick-kidger / patrick-kidger/jaxtyping
`Array` type doesn't deal nicely with `Tuple`s
Open
Nobody has claimed this yet.
question
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 96
- PR merge metrics
- No merged PRs in 30d
Description
def test(a: Tuple[Array, ...], b: Array) -> Array:
return a + b
Clearly, a + b is a Tuple[Array, ...] yet the LSP is unable to distinguish it in the case where we use Array.
Replacing Array with any other type does error out so its definitely due to the semantics of Array implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in the issue and inspect the implementation and semantics of Array, especially how it interacts with Tuple types. Confirm the LSP's inferred type for a + b and add a regression test showing that it is reported as Tuple[Array, ...].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100