Commit 8fd5e9fb authored by Tom Niget's avatar Tom Niget

thing

parent 95b8479f
......@@ -59,6 +59,7 @@ class str:
def __contains__(self, item: Self) -> bool: ...
assert len("a")
assert not len(6)
class bytes:
def decode(self, encoding: str) -> str: ...
......@@ -172,4 +173,6 @@ assert not __test_type().test_opt()
def exit(code: int | None = None) -> None: ...
class Exception:
def __init__(self, message: str) -> None: ...
\ No newline at end of file
def __init__(self, message: str) -> None: ...
assert next([])
\ No newline at end of file
......@@ -8,7 +8,7 @@ from transpiler.phases.typing.common import ScoperVisitor, get_iter, get_next, i
from transpiler.phases.typing.exceptions import ArgumentCountMismatchError, TypeMismatchKind, TypeMismatchError
from transpiler.phases.typing.types import BaseType, TY_STR, TY_BOOL, TY_INT, TY_COMPLEX, TY_FLOAT, TY_NONE, \
ClassTypeType, ResolvedConcreteType, GenericType, CallableInstanceType, TY_LIST, TY_SET, TY_DICT, RuntimeValue, \
TypeVariable, TY_LAMBDA, TypeListType, MethodType
TypeVariable, TY_LAMBDA, TypeListType, MethodType, TY_TUPLE
from transpiler.phases.typing.scope import ScopeKind, VarDecl, VarKind
from transpiler.utils import linenodata
......@@ -52,7 +52,7 @@ class ScoperExprVisitor(ScoperVisitor):
return res
def visit_Tuple(self, node: ast.Tuple) -> BaseType:
return TupleType(*[self.visit(e) for e in node.elts])
return TY_TUPLE.instantiate_(*[self.visit(e) for e in node.elts])
def visit_Slice(self, node: ast.Slice) -> BaseType:
for n in ("lower", "upper", "step"):
......
......@@ -501,7 +501,7 @@ class CallableInstanceType(GenericInstanceType, MethodType):
)
def __str__(self):
return f"({", ".join(map(str, self.parameters + ([", *args"] if self.is_variadic else [])))}) -> {self.return_type}"
return f"({", ".join(map(str, self.parameters + (["*args"] if self.is_variadic else [])))}) -> {self.return_type}"
def try_assign_internal(self, other: BaseType) -> bool:
if not isinstance(other, CallableInstanceType):
......
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