typing: Make `TypeVisitor::anchor` non-nullable
authorJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Fri, 2 Jun 2017 01:19:04 +0000 (21:19 -0400)
committerJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Fri, 2 Jun 2017 15:05:28 +0000 (11:05 -0400)
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

src/metrics/detect_covariance.nit
src/semantize/typing.nit

index 25463ad..643679a 100644 (file)
@@ -350,7 +350,6 @@ redef class TypeVisitor
                if dcp.is_disabled then return res
 
                var anchor = self.anchor
-               assert anchor != null
                var supx = sup
                var subx = sub
                var p = node.parent.as(not null)
index 41b5eeb..1555050 100644 (file)
@@ -40,7 +40,7 @@ private class TypeVisitor
 
        # The static type of the receiver
        # Mainly used for type tests and type resolutions
-       var anchor: nullable MClassType = null
+       var anchor: MClassType is noinit
 
        # The analyzed mclassdef
        var mclassdef: MClassDef is noinit
@@ -2138,7 +2138,6 @@ redef class ASuperExpr
        redef fun accept_typing(v)
        do
                var anchor = v.anchor
-               assert anchor != null
                var recvtype = v.get_variable(self, v.selfvariable)
                assert recvtype != null
                var mproperty = v.mpropdef.mproperty
@@ -2177,7 +2176,6 @@ redef class ASuperExpr
        private fun process_superinit(v: TypeVisitor)
        do
                var anchor = v.anchor
-               assert anchor != null
                var recvtype = v.get_variable(self, v.selfvariable)
                assert recvtype != null
                var mpropdef = v.mpropdef