end
# Check class
- var mclass = try_get_mclass_by_qid(qid, mmodule)
- if mclass != null then
+ var found_class = try_get_mclass_by_qid(qid, mmodule)
+ if found_class != null then
var arity = ntype.n_types.length
- if arity != mclass.arity then
+ if arity != found_class.arity then
if arity == 0 then
- error(ntype, "Type Error: `{mclass.signature_to_s}` is a generic class.")
- else if mclass.arity == 0 then
+ error(ntype, "Type Error: `{found_class.signature_to_s}` is a generic class.")
+ else if found_class.arity == 0 then
error(ntype, "Type Error: `{name}` is not a generic class.")
else
- error(ntype, "Type Error: expected {mclass.arity} formal argument(s) for `{mclass.signature_to_s}`; got {arity}.")
+ error(ntype, "Type Error: expected {found_class.arity} formal argument(s) for `{found_class.signature_to_s}`; got {arity}.")
end
return null
end
if arity == 0 then
- res = mclass.mclass_type
+ res = found_class.mclass_type
if ntype.n_kwnullable != null then res = res.as_nullable
ntype.mtype = res
return res
if mt == null then return null # Forward error
mtypes.add(mt)
end
- res = mclass.get_mtype(mtypes)
+ res = found_class.get_mtype(mtypes)
if ntype.n_kwnullable != null then res = res.as_nullable
ntype.mtype = res
return res
if ntype.checked_mtype then return mtype
if mtype isa MGenericType then
- var mclass = mtype.mclass
- for i in [0..mclass.arity[ do
- var intro = mclass.try_intro
+ var found_class = mtype.mclass
+ for i in [0..found_class.arity[ do
+ var intro = found_class.try_intro
if intro == null then return null # skip error
var bound = intro.bound_mtype.arguments[i]
var nt = ntype.n_types[i]
# Note that the broken status is not propagated to parent or children nodes.
# e.g. a broken expression used as argument does not make the whole call broken.
var is_broken = false is writable
+
+ redef fun dump_info(v) do
+ var res = super
+ if is_broken then
+ res += v.red("*broken*")
+ end
+ return res
+ end
end
redef class AType
# Is the mtype a valid one?
var checked_mtype: Bool = false
+
+ redef fun dump_info(v) do
+ var res = super
+ var mtype = self.mtype
+ if mtype != null then
+ res += v.yellow(":{mtype}")
+ end
+ return res
+ end
end
redef class AVisibility