metrics/detect_covariance: update check_subtype
authorJean Privat <jean@pryen.org>
Thu, 16 Apr 2015 15:50:30 +0000 (22:50 +0700)
committerJean Privat <jean@pryen.org>
Thu, 16 Apr 2015 15:50:30 +0000 (22:50 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/metrics/detect_covariance.nit

index 4a3437d..1ab719b 100644 (file)
@@ -343,7 +343,7 @@ redef class TypeVisitor
                return sub
        end
 
-       redef fun check_subtype(node: ANode, sub, sup: MType): nullable MType
+       redef fun check_subtype(node: ANode, sub, sup: MType, autocast: Bool): nullable MType
        do
                var res = super
 
@@ -361,6 +361,9 @@ redef class TypeVisitor
                        if node isa AAsCastExpr then
                                return res
                        end
+                       if not autocast then
+                               return res
+                       end
                        sup = supx.resolve_for(anchor.mclass.mclass_type, anchor, mmodule, true)
                        if self.is_subtype(sub, sup) then
                                dcp.cpt_autocast.inc("vt")