model: rename `as_notnullable` to `undecorate`
[nit.git] / src / metrics / detect_variance_constraints.nit
index 0319572..1f0205e 100644 (file)
@@ -50,7 +50,7 @@ private class DetectVarianceConstraintsPhase
        do
                if not toolcontext.opt_detect_variance_constraints.value and not toolcontext.opt_all.value then return
 
-               print "--- Metrics of covariance detection ---"
+               print "--- Detection of variance constraints on formal parameter types ---"
 
                var k = new DetectVarianceConstraints
                k.collect(mainmodule)
@@ -76,11 +76,6 @@ private class DetectVarianceConstraintsPhase
        end
 end
 
-redef class MParameterType
-       # The fully-qualified name of the formal parameter.
-       fun full_name: String do return "{mclass.full_name}::{name}"
-end
-
 # A specific analysis that detects the variance constraints of formal parameters.
 #
 # The client has 3 steps to do:
@@ -118,7 +113,7 @@ class DetectVarianceConstraints
                                        if pd isa MMethodDef then
                                                # Parameters (contravariant)
                                                for p in pd.msignature.mparameters do
-                                                       var t = p.mtype.as_notnullable
+                                                       var t = p.mtype.undecorate
                                                        if not t.need_anchor then
                                                                # OK
                                                        else if t isa MParameterType then
@@ -134,7 +129,7 @@ class DetectVarianceConstraints
                                                # Return (covariant)
                                                var t = pd.msignature.return_mtype
                                                if t != null and t.need_anchor then
-                                                       t = t.as_notnullable
+                                                       t = t.undecorate
                                                        if t isa MParameterType then
                                                                covar_pt.add(t)
                                                        else if t isa MVirtualType then
@@ -149,7 +144,7 @@ class DetectVarianceConstraints
                                                # Attribute (invariant)
                                                var t = pd.static_mtype
                                                if t != null and t.need_anchor then
-                                                       t = t.as_notnullable
+                                                       t = t.undecorate
                                                        if t isa MParameterType then
                                                                covar_pt.add t
                                                                contravar_pt.add t
@@ -166,7 +161,7 @@ class DetectVarianceConstraints
                                                # Virtual type bound (covariant)
                                                var t = pd.bound
                                                if t != null and t.need_anchor then
-                                                       t = t.as_notnullable
+                                                       t = t.undecorate
                                                        if t isa MParameterType then
                                                                covar_pt.add t
                                                        else if t isa MVirtualType then
@@ -228,7 +223,7 @@ class DetectVarianceConstraints
                        # Process the generic types in a covariant position
                        for c in covar_classes do for i in [0..c.mclass.arity[ do
                                # The type used in the argument
-                               var ta = c.arguments[i].as_notnullable
+                               var ta = c.arguments[i].undecorate
                                # The associated formal parameter
                                var tp = c.mclass.mparameters[i]
 
@@ -264,7 +259,7 @@ class DetectVarianceConstraints
                        # Process the generic types in a contravariant position
                        for c in contravar_classes do for i in [0..c.mclass.arity[ do
                                # The type used in the argument
-                               var ta = c.arguments[i].as_notnullable
+                               var ta = c.arguments[i].undecorate
                                # The associated formal parameter
                                var tp = c.mclass.mparameters[i]