Skip to content

Commit d00bd4d

Browse files
committed
Merge: model: fix try_get_primitive_method
The implementation was an old code that did not use modern facilities, moreover it was broken anyway. Reported-by: Lucas Bajolet <r4pass@hotmail.com> Pull-Request: #1844 Reviewed-by: Lucas Bajolet <r4pass@hotmail.com> Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
2 parents 5678b14 + 010e252 commit d00bd4d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/model/model.nit

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,15 @@ redef class MModule
300300
var props = self.model.get_mproperties_by_name(name)
301301
if props == null then return null
302302
var res: nullable MMethod = null
303+
var recvtype = recv.intro.bound_mtype
303304
for mprop in props do
304305
assert mprop isa MMethod
305-
var intro = mprop.intro_mclassdef
306-
for mclassdef in recv.mclassdefs do
307-
if not self.in_importation.greaters.has(mclassdef.mmodule) then continue
308-
if not mclassdef.in_hierarchy.greaters.has(intro) then continue
309-
if res == null then
310-
res = mprop
311-
else if res != mprop then
312-
print("Fatal Error: ambigous property name '{name}'; conflict between {mprop.full_name} and {res.full_name}")
313-
abort
314-
end
306+
if not recvtype.has_mproperty(self, mprop) then continue
307+
if res == null then
308+
res = mprop
309+
else if res != mprop then
310+
print("Fatal Error: ambigous property name '{name}'; conflict between {mprop.full_name} and {res.full_name}")
311+
abort
315312
end
316313
end
317314
return res

0 commit comments

Comments
 (0)