Do not create a constant null value for runtime types.
authorMarek Safar <marek.safar@gmail.com>
Tue, 12 Oct 2010 08:54:50 +0000 (09:54 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 12 Oct 2010 10:22:56 +0000 (11:22 +0100)
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs
mcs/tests/dtest-006.cs
mcs/tests/ver-il-dmcs.xml

index 04a43cfd3f4982517322cc3704d3a858616ac647..d05e4a95c050e605237e3d1f7affb417c1106d22 100644 (file)
@@ -201,7 +201,7 @@ namespace Microsoft.CSharp.RuntimeBinder
                //
                public Compiler.Expression CreateCompilerExpression (CSharpArgumentInfo info, DynamicMetaObject value)
                {
-                       if (value.Value == null && (info == null || (info.Flags & (CSharpArgumentInfoFlags.IsOut | CSharpArgumentInfoFlags.IsRef)) == 0)) {
+                       if (value.Value == null && (info == null || (info.Flags & (CSharpArgumentInfoFlags.IsOut | CSharpArgumentInfoFlags.IsRef | CSharpArgumentInfoFlags.UseCompileTimeType)) == 0)) {
                                if (value.LimitType == typeof (object))
                                        return new Compiler.NullLiteral (Compiler.Location.Null);
 
index e43d80d857226b65fdf71b61cb86319765afec3a..af722cf4e58cbccb855818a2134bfcfed77d271f 100644 (file)
@@ -309,7 +309,7 @@ class Tester
 
                dynamic d2 = (MyEnumUlong?) MyEnumUlong.Value_1;
                Assert (d2 + (byte) 1, MyEnumUlong.Value_2, "#2");
-               Assert<MyEnumUlong?> (d2 + (object) null, null, "#2a");
+               Assert<MyEnumUlong?> (d2 + null, null, "#2a");
                
                // CSC: Invalid System.InvalidOperationException
                Assert<MyEnum?> (d + null, null, "#1");
@@ -1878,7 +1878,7 @@ class Tester
 
                dynamic d2 = (MyEnumUlong?) MyEnumUlong.Value_2;
                Assert (d2 - (byte) 1, MyEnumUlong.Value_1, "#2");
-               Assert<MyEnumUlong?> (d2 - (object) null, null, "#2a");
+               Assert<MyEnumUlong?> (d2 - null, null, "#2a");
                
                // CSC: Invalid System.InvalidOperationException
                Assert<MyEnum?> (d - null, null, "#3");
index 4f1848f19243a07e1145c3f2e64abfdd08806445..90b36ca3be2ca9b554864f27489f704a670b5a18 100644 (file)
         <size>74</size>
       </method>
       <method name="Int32 Main()">
-        <size>842</size>
+        <size>1039</size>
       </method>
       <method name="Void .ctor()">
         <size>18</size>
         <size>41</size>
       </method>
       <method name="Void AssertError(System.Action, System.String)">
-        <size>53</size>
+        <size>73</size>
       </method>
       <method name="Boolean RunTest(System.Reflection.MethodInfo)">
         <size>92</size>
       <method name="Int32 Main()">
         <size>179</size>
       </method>
-      <method name="Boolean &lt;Main&gt;m__1(System.Reflection.MethodInfo)">
-        <size>12</size>
-      </method>
-      <method name="System.String &lt;Main&gt;m__2(System.Reflection.MethodInfo)">
-        <size>7</size>
-      </method>
-      <method name="Boolean &lt;Main&gt;m__3(System.Reflection.MethodInfo)">
-        <size>7</size>
-      </method>
-      <method name="Boolean &lt;Main&gt;m__4(Boolean)">
-        <size>5</size>
-      </method>
       <method name="Void .ctor()">
         <size>7</size>
       </method>
         <size>7</size>
       </method>
     </type>
+    <type name="Tester">
+      <method name="Void NullableConversion()">
+        <size>47</size>
+      </method>
+      <method name="Void &lt;NullableConversion&gt;m__1()">
+        <size>105</size>
+      </method>
+      <method name="Boolean &lt;Main&gt;m__2(System.Reflection.MethodInfo)">
+        <size>12</size>
+      </method>
+      <method name="System.String &lt;Main&gt;m__3(System.Reflection.MethodInfo)">
+        <size>7</size>
+      </method>
+      <method name="Boolean &lt;Main&gt;m__4(System.Reflection.MethodInfo)">
+        <size>7</size>
+      </method>
+      <method name="Boolean &lt;Main&gt;m__5(Boolean)">
+        <size>5</size>
+      </method>
+    </type>
   </test>
   <test name="dtest-etree-01.cs">
     <type name="C">
         <size>162</size>
       </method>
       <method name="Void LeftShiftTest_3()">
-        <size>184</size>
+        <size>169</size>
       </method>
       <method name="Void LeftShiftTest_4()">
         <size>261</size>
         <size>159</size>
       </method>
       <method name="Void RightShiftTest_3()">
-        <size>184</size>
+        <size>169</size>
       </method>
       <method name="Void RightShiftTest_4()">
         <size>258</size>
       <method name="Void EqualTestDelegate_3()">
         <size>212</size>
       </method>
+      <method name="Void DivideTest_7()">
+        <size>185</size>
+      </method>
+      <method name="Void MultiplyTest_8()">
+        <size>198</size>
+      </method>
+      <method name="Void RightShiftTest_6()">
+        <size>145</size>
+      </method>
     </type>
   </test>
   <test name="gtest-etree-02.cs">