Skip to content

Commit 183c618

Browse files
committed
added type_checks method
1 parent 8597f7b commit 183c618

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

synth/syntax/program.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ def __contains__(self, other: "Program") -> bool:
124124
def __pickle__(o: "Program") -> Tuple:
125125
pass
126126

127+
def type_checks(self) -> bool:
128+
return True
129+
127130

128131
class Variable(Program):
129132
"""
@@ -271,6 +274,12 @@ def __str__(self) -> str:
271274
s += " " + format(arg)
272275
return s + ")"
273276

277+
def type_checks(self) -> bool:
278+
return all(
279+
arg.type.is_instance(f_arg_t)
280+
for arg, f_arg_t in zip(self.arguments, self.function.type.arguments())
281+
)
282+
274283
def __pretty_print__(
275284
self,
276285
defined: Dict["Program", Tuple[int, str, str]],

0 commit comments

Comments
 (0)