2009-03-17 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / mcs / literal.cs
index 7276689d1a722b11d8adc728007e79c200db4618..1565dda2daf6e624114cec017f5b0fe6996ee9e4 100644 (file)
@@ -122,6 +122,9 @@ namespace Mono.CSharp {
                        if (targetType == TypeManager.anonymous_method_type)
                                return null;
 
+                       if (type != TypeManager.null_type && !Convert.ImplicitStandardConversionExists (this, targetType))
+                               return null;
+
                        if (TypeManager.IsReferenceType (targetType))
                                return new NullLiteral (targetType, loc);
 
@@ -171,6 +174,11 @@ namespace Mono.CSharp {
                public override bool IsZeroInteger {
                        get { return true; }
                }
+               
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       type = storey.MutateType (type);
+               }
        }
 
        //