src: use `as_notnullable` in code
[nit.git] / src / rapid_type_analysis.nit
index 3d7ec38..17d5e0c 100644 (file)
@@ -88,7 +88,7 @@ class RapidTypeAnalysis
                var mtype = callsite.recv
                var anchor = callsite.anchor
                if anchor != null then mtype = mtype.anchor_to(callsite.mmodule, anchor)
-               if mtype isa MNullableType then mtype = mtype.mtype
+               mtype = mtype.as_notnullable
                assert mtype isa MClassType
                mtype = mtype.mclass.intro.bound_mtype
                var mproperty = callsite.mproperty
@@ -219,12 +219,12 @@ class RapidTypeAnalysis
                                v.add_monomorphic_send(vararg, self.modelbuilder.force_get_primitive_method(node, "with_native", vararg.mclass, self.mainmodule))
                        end
 
-
-                       for i in [0..mmethoddef.msignature.arity[ do
-                               var origtype = mmeth.intro.msignature.mparameters[i].mtype
+                       var sig = mmethoddef.msignature.as(not null)
+                       var osig = mmeth.intro.msignature.as(not null)
+                       for i in [0..sig.arity[ do
+                               var origtype = osig.mparameters[i].mtype
                                if not origtype.need_anchor then continue # skip non covariant stuff
-                               var paramtype = mmethoddef.msignature.mparameters[i].mtype
-                               #paramtype = v.cleanup_type(paramtype).as(not null)
+                               var paramtype = sig.mparameters[i].mtype
                                add_cast(paramtype)
                        end
 
@@ -457,7 +457,7 @@ class RapidTypeVisitor
        do
                mtype = mtype.anchor_to(self.analysis.mainmodule, self.receiver)
                if mtype isa MNullType then return null
-               if mtype isa MNullableType then mtype = mtype.mtype
+               mtype = mtype.as_notnullable
                assert mtype isa MClassType
                assert not mtype.need_anchor
                return mtype