|
@@ -15058,9 +15058,7 @@ class TypeCheckLlambda(TypeCheckLfun):
|
|
|
e.has_type = ty
|
|
|
match ty:
|
|
|
case FunctionType(params_t, return_t):
|
|
|
- new_env = {x:t for (x,t) in env.items()}
|
|
|
- for (p,t) in zip(params, params_t):
|
|
|
- new_env[p] = t
|
|
|
+ new_env = env.copy().update(zip(params, params_t))
|
|
|
self.check_exp(body, return_t, new_env)
|
|
|
case _:
|
|
|
raise Exception('lambda does not have type ' + str(ty))
|
|
@@ -15092,9 +15090,7 @@ class TypeCheckLlambda(TypeCheckLfun):
|
|
|
return
|
|
|
match ss[0]:
|
|
|
case FunctionDef(name, params, body, dl, returns, comment):
|
|
|
- new_env = {x: t for (x,t) in env.items()}
|
|
|
- for (x,t) in params:
|
|
|
- new_env[x] = t
|
|
|
+ new_env = env.copy().update(params)
|
|
|
rt = self.check_stmts(body, returns, new_env)
|
|
|
self.check_stmts(ss[1:], return_ty, env)
|
|
|
case Return(value):
|