Nimblesite / Nimblesite/Basilisk
Generics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 54
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Basilisk doesn't seem to handle rather basic examples involving generics, for example:
from typing import assert_type
class P: ...
def duplicate[T](value: T) -> tuple[T, T]:
return value, value
assert_type(duplicate(P()), tuple[P, P])
Basilisk fails this assertion and incorrectly infers tuple[T, T] (leaking type variables) instead of tuple[P, P].
Using list[T] or int | T in the return type leads to similar failures.
It also seems to rely on the fact that type variables are capitalized? It fails this assertion and infers t instead of int:
def identity[t](value: t) -> t:
return value
assert_type(identity(1), int)
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 by reproducing the generic-function and assert_type examples from the issue, then trace Basilisk's generic inference and type-variable handling. Done means the examples infer tuple[P, P] and int rather than leaking or preserving the type variables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100