Skip to content

Commit f5e733f

Browse files
committed
Merge: autosuperinit: do not crash on broken model
Fix the reason that the catalog is currenlty broken (maybe ironicaly related to #1816) Pull-Request: #1824
2 parents 02618ef + b91d4b0 commit f5e733f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/semantize/auto_super_init.nit

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ redef class AMethPropdef
5757
fun do_auto_super_init(modelbuilder: ModelBuilder)
5858
do
5959
var mclassdef = self.parent.as(AClassdef).mclassdef
60-
if mclassdef == null then return # skip error
60+
if mclassdef == null or mclassdef.is_broken then return # skip error
6161
var mpropdef = self.mpropdef
62-
if mpropdef == null then return # skip error
62+
if mpropdef == null or mpropdef.is_broken then return # skip error
6363
var mmodule = mpropdef.mclassdef.mmodule
6464
var anchor = mclassdef.bound_mtype
6565
var recvtype = mclassdef.mclass.mclass_type
@@ -121,6 +121,11 @@ redef class AMethPropdef
121121
if candidate.is_root_init then continue
122122

123123
var candidatedefs = candidate.lookup_definitions(mmodule, anchor)
124+
if candidatedefs.is_empty then
125+
# skip broken
126+
is_broken = true
127+
return
128+
end
124129
var candidatedef = candidatedefs.first
125130
# TODO, we drop the others propdefs in the callsite, that is not great :(
126131

@@ -136,6 +141,11 @@ redef class AMethPropdef
136141
var the_root_init_mmethod = modelbuilder.the_root_init_mmethod
137142
if the_root_init_mmethod != null and auto_super_inits.is_empty then
138143
var candidatedefs = the_root_init_mmethod.lookup_definitions(mmodule, anchor)
144+
if candidatedefs.is_empty then
145+
# skip broken
146+
is_broken = true
147+
return
148+
end
139149

140150
# Search the longest-one and checks for conflict
141151
var candidatedef = candidatedefs.first

0 commit comments

Comments
 (0)