fixed bugs in impl

This commit is contained in:
pca006132 2020-12-17 15:00:09 +08:00 committed by pca006132
parent 1efbbe832f
commit dfc393064e
2 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@ from top_level import *
test = """
class A:
a: int
def foo(a: B) -> int:
def foo(a: B):
pass
class B(A):

View File

@ -16,7 +16,7 @@ class Context:
def parse_type(ctx: Context, ty):
if ty is None:
return None
return None, set()
elif isinstance(ty, ast.Name):
if ty.id in ctx.types:
return ctx.types[ty.id], set()
@ -52,6 +52,8 @@ def parse_type(ctx: Context, ty):
return VirtualClassType(param), var
else:
raise CustomError(f"Unknown Generic Type {ty.value}")
else:
raise CustomError(f"Unrecognized Type {ty}")
def parse_function(ctx: Context, base, fn: ast.FunctionDef):