X-Git-Url: http://nitlanguage.org diff --git a/src/modelbuilder_base.nit b/src/modelbuilder_base.nit index 9995338..93423df 100644 --- a/src/modelbuilder_base.nit +++ b/src/modelbuilder_base.nit @@ -81,6 +81,16 @@ class ModelBuilder return res end + # Like `try_get_mclass_by_name` but display an error message when the class is not found + fun get_mclass_by_name(node: ANode, mmodule: MModule, name: String): nullable MClass + do + var mclass = try_get_mclass_by_name(node, mmodule, name) + if mclass == null then + error(node, "Type Error: missing primitive class `{name}'.") + end + return mclass + end + # Return a property named `name` on the type `mtype` visible in the module `mmodule`. # Visibility in modules is correctly handled. # Protected properties are returned (it is up to the caller to check and reject protected properties). @@ -305,7 +315,9 @@ class ModelBuilder if mtype isa MGenericType then var mclass = mtype.mclass for i in [0..mclass.arity[ do - var bound = mclass.intro.bound_mtype.arguments[i] + var intro = mclass.try_intro + if intro == null then return null # skip error + var bound = intro.bound_mtype.arguments[i] var nt = ntype.n_types[i] var mt = resolve_mtype(mmodule, mclassdef, nt) if mt == null then return null # forward error