From: Jean Privat Date: Wed, 25 Nov 2015 16:50:04 +0000 (-0500) Subject: model: fix `try_get_primitive_method` X-Git-Tag: v0.8~79^2 X-Git-Url: http://nitlanguage.org?hp=5678b141e7b33c26dd95c243fa7f1feaa87e99fc 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 Signed-off-by: Jean Privat --- diff --git a/src/model/model.nit b/src/model/model.nit index 49ababd..b9d6aa2 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -300,18 +300,15 @@ redef class MModule var props = self.model.get_mproperties_by_name(name) if props == null then return null var res: nullable MMethod = null + var recvtype = recv.intro.bound_mtype for mprop in props do assert mprop isa MMethod - var intro = mprop.intro_mclassdef - for mclassdef in recv.mclassdefs do - if not self.in_importation.greaters.has(mclassdef.mmodule) then continue - if not mclassdef.in_hierarchy.greaters.has(intro) then continue - if res == null then - res = mprop - else if res != mprop then - print("Fatal Error: ambigous property name '{name}'; conflict between {mprop.full_name} and {res.full_name}") - abort - end + if not recvtype.has_mproperty(self, mprop) then continue + if res == null then + res = mprop + else if res != mprop then + print("Fatal Error: ambigous property name '{name}'; conflict between {mprop.full_name} and {res.full_name}") + abort end end return res