[svn] r5846: nemerle/trunk/ncc/typing: MType.n TyVar.n

nazgul svnadmin at nemerle.org
Tue Oct 25 19:43:21 CEST 2005


Log:
Search in constraints in TypeOfMember for TyVarRef. Allow nulls in generic type parameters when CanBeNull returns true (because it knows what it does)

Author: nazgul
Date: Tue Oct 25 19:43:17 2005
New Revision: 5846

Modified:
   nemerle/trunk/ncc/typing/MType.n
   nemerle/trunk/ncc/typing/TyVar.n

Modified: nemerle/trunk/ncc/typing/MType.n
==============================================================================
--- nemerle/trunk/ncc/typing/MType.n	(original)
+++ nemerle/trunk/ncc/typing/MType.n	Tue Oct 25 19:43:17 2005
@@ -658,8 +658,15 @@
           s2.Apply (s1.Apply (member.GetMemType ()).Fix ())
         | Array =>
           InternalType.Array.TypeOfMember (member)
+          
+        | TyVarRef (tyvar) =>
+          foreach (t is MType.Class in tyvar.Constraints) // FIXME: what to do with "where 'a : 'b"?
+            when (t.tycon.Equals (member.DeclaringType))
+              Nemerle.Imperative.Return (t.TypeOfMember (member));
+          Util.ice ($"not found for member $(member) with dt $(member.DeclaringType) -- am in $(this)")
+        
         | _ =>
-          assert (false, $ "unsupported type: $(this)")
+          Util.ice ($ "unsupported type: for member $(member) with dt $(member.DeclaringType) -- am in $(this)")
       }
     }
     
@@ -775,7 +782,7 @@
           | Array =>
             InternalType.Array.GetInstantiatedSuperType (super_type)
 
-          | _ => Util.ice ($ "GIST: $this")
+          | _ => Util.ice ($ "GIST: $this for $super_type")
         }
     }
 

Modified: nemerle/trunk/ncc/typing/TyVar.n
==============================================================================
--- nemerle/trunk/ncc/typing/TyVar.n	(original)
+++ nemerle/trunk/ncc/typing/TyVar.n	Tue Oct 25 19:43:17 2005
@@ -698,19 +698,6 @@
                      $ "the `null' literal is not a valid value of type $tv");
           false
         } else {
-          when (Passes.Solver.IsTopLevel &&
-                IsFromNull && 
-                tv.IsFixed)
-            match (tv.FixedValue) {
-              | MType.TyVarRef (static_var) 
-                when ! (static_var.SpecialConstraints %&&
-                        GenericParameterAttributes.ReferenceTypeConstraint) =>
-                  Message.Error ($ "the `null' literal is not a valid value of "
-                                   "generic type parameter $tv");
-                                   
-              | _ => ()
-            }
-
           when (tv.IsFree && IsFromNull && !tv.IsFromNull)
             tv.IsFromNull = true;
           flags |= Flags.IsAliased;



More information about the svn mailing list