Commit 7c2abca0 authored by Tom Niget's avatar Tom Niget

Fix typevariable name generation

parent 30e86670
......@@ -79,16 +79,21 @@ class MagicType(BaseType, typing.Generic[T]):
cur_var = 0
def next_var_id():
global cur_var
cur_var += 1
return cur_var
@dataclass(eq=False)
class TypeVariable(BaseType):
name: str = field(default_factory=lambda: chr(ord('a') + cur_var))
name: str = field(default_factory=lambda: next_var_id())
resolved: Optional[BaseType] = None
def __str__(self):
if self.resolved is None:
#return f"TypeVar[\"{self.name}\"]"
return "_" + self.name
return f"_{self.name}"
return str(self.resolved)
def resolve(self) -> BaseType:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment