Don't show internal error when default paramater expression cannot be converted to...
authorMarek Safar <marek.safar@gmail.com>
Mon, 5 Aug 2013 10:17:18 +0000 (12:17 +0200)
committerMarek Safar <marek.safar@gmail.com>
Mon, 5 Aug 2013 10:17:18 +0000 (12:17 +0200)
mcs/errors/cs1750-4.cs [new file with mode: 0644]
mcs/mcs/parameter.cs

diff --git a/mcs/errors/cs1750-4.cs b/mcs/errors/cs1750-4.cs
new file mode 100644 (file)
index 0000000..4499780
--- /dev/null
@@ -0,0 +1,23 @@
+// CS1750: Optional parameter expression of type `null' cannot be converted to parameter type `A'
+// Line: 8
+
+using System;
+
+class GenericClass<T>
+{
+       public GenericClass (GenericClass<T> g = null, A a = null)
+       {
+       }
+}
+
+class DerivedClass<T> : GenericClass<T>
+{
+       public DerivedClass (GenericClass<T> g) : base(g)
+       {
+       }
+}
+
+public struct A
+{
+       public int Field;
+}
index 62ee7ab5aa8d6417ef00f8db80335abef0e570e7..c03630d2cdf9f82e4c5dffa19353cf2dd920764a 100644 (file)
@@ -1378,6 +1378,8 @@ namespace Mono.CSharp {
                        rc.Report.Error (1750, Location,
                                "Optional parameter expression of type `{0}' cannot be converted to parameter type `{1}'",
                                type.GetSignatureForError (), parameter_type.GetSignatureForError ());
+
+                       this.expr = ErrorExpression.Instance;
                }
                
                public override object Accept (StructuralVisitor visitor)