Type checks do not cover all objects
The type check is currently initiated by this model procesor (in virtmat.language.constraints.typechecks
)
def check_types_processor(model, _):
"""evaluate type of all objects that have type"""
classes = ['VarTuple', 'Variable', 'Print', 'ConditionIn', 'ConditionComparison']
for cls in classes:
for obj in get_children_of_type(cls, model):
_ = obj.type_
It is implicitly assumed that the objects of these classes call the type_
property for all their children. This may not be the case and is hard to check / fix.
According to the intention "evaluate type of all objects that have type", this may be a better solution:
def check_types_processor(model, metamodel):
"""evaluate type of all objects that have type"""
classes = []
for ns_key, ns_val in metamodel.namespaces.items():
if ns_key != '__base__':
for cls_name, cls in ns_val.items():
if getattr(cls, 'type_', False):
classes.append(cls_name)
for cls in classes:
for obj in get_children_of_type(cls, model):
_ = obj.type_
Also the processor should be moved to virtmat.language.constraints.processors
.
Edited by Ivan Kondov