Skip to content

feat: Analyzing TypeVar Variables and their usage and generating correct stubs #63

@Masara

Description

@Masara

Is your feature request related to a problem?

Currently TypeVars are generated wrongly in the stubs.

Desired solution

The following TypeVar usages should generate correct stubs:

from typing import TypeVar

# Example 1
first_type_var = TypeVar("first_type_var")
def func(a: List[first_type_var]) -> first_type_var: ...

# Example 2
def  func2[T](a: T, b: T) -> T: ...

The stubs should look like the following:

# Example 1
@Pure
fun func<FirstTypeVar>(a: List<FirstTypeVar>) -> result1: FirstTypeVar

# Exmaple 2
@Pure
fun func2<T>(a: T) -> result1: T

To achieve this, while analyzing the code, perhaps a list of all TypeVars with their usages should be created.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✔️ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions