From 010e2521c2cfa5b08033f9b2ae7ea1c6c88443cf Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 25 Nov 2015 11:50:04 -0500 Subject: [PATCH 1/1] 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 --- src/model/model.nit | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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 -- 1.7.9.5