- # Can the super-constructors be called?
- for auto_super_init in auto_super_inits do
- var auto_super_init_def = auto_super_init.mpropdef
- var msig = mpropdef.msignature.as(not null)
- var supermsig = auto_super_init.msignature
- if supermsig.arity > msig.arity then
- modelbuilder.error(self, "Error: cannot do an implicit constructor call to `{auto_super_init_def}{supermsig}`. Expected at least `{supermsig.arity}` arguments, got `{msig.arity}`.")
- continue
- end
- var i = 0
- for sp in supermsig.mparameters do
- var p = msig.mparameters[i]
- var sub = p.mtype
- var sup = sp.mtype
- if not sub.is_subtype(mmodule, anchor, sup) then
- modelbuilder.error(self, "Error: cannot do an implicit constructor call to `{auto_super_init_def}{supermsig}`. Expected argument #{i} of type `{sp.mtype}`, got implicit argument `{p.name}` of type `{p.mtype}`.")
- break
- end
- i += 1
- end
- end