Skip to content

Commit 1306c61

Browse files
committed
support Return None and fall-off
1 parent 3b4e471 commit 1306c61

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

type_check_Lfun.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def type_check_exp(self, e, env):
8181
case _:
8282
raise Exception('type_check_exp: in call, unexpected ' + \
8383
repr(func_t))
84+
case Constant(None):
85+
return VoidType()
8486
case _:
8587
return super().type_check_exp(e, env)
8688

type_check_Lgrad.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def type_check_exp(self, e, env):
5858
match e:
5959
case Constant(value) if value is True or value is False:
6060
return BoolType()
61+
case Constant(None):
62+
return VoidType()
6163
# Cases for Lvar
6264
case Name(id):
6365
return env[id]

0 commit comments

Comments
 (0)