model: introduce MFormalType as a superclass of MVirtualType and MParameterType
authorJean Privat <jean@pryen.org>
Sat, 4 Apr 2015 09:56:12 +0000 (16:56 +0700)
committerJean Privat <jean@pryen.org>
Sat, 4 Apr 2015 09:56:12 +0000 (16:56 +0700)
Strangely enough, they do not have common methods yet.
It is why a super-class was never introduced.

Signed-off-by: Jean Privat <jean@pryen.org>

src/model/model.nit

index 76a3839..a5aeb76 100644 (file)
@@ -1259,9 +1259,17 @@ class MGenericType
        end
 end
 
+# A formal type (either virtual of parametric).
+#
+# The main issue with formal types is that they offer very little information on their own
+# and need a context (anchor and mmodule) to be useful.
+abstract class MFormalType
+       super MType
+end
+
 # A virtual formal type.
 class MVirtualType
-       super MType
+       super MFormalType
 
        # The property associated with the type.
        # Its the definitions of this property that determine the bound or the virtual type.
@@ -1389,7 +1397,7 @@ end
 # Note that parameter types are shared among class refinements.
 # Therefore parameter only have an internal name (see `to_s` for details).
 class MParameterType
-       super MType
+       super MFormalType
 
        # The generic class where the parameter belong
        var mclass: MClass