Merge pull request #4403 from BrzVlad/fix-workers-par-context
[mono.git] / mcs / tests / dtest-error-01.cs
index 52b3de623a072140dfc779a5709fa2bba5ff525e..2cba37f3e8f32417a72aef55721f2934eac6f0ff 100644 (file)
@@ -17,12 +17,40 @@ class Helper
 class Tester
 {
 #pragma warning disable 169
+       void NonInvocable ()
+       {
+               AssertError (
+                       () => {
+                               dynamic d = 1;
+                               d ();
+                       }, "Cannot invoke a non-delegate type");
+       }
+       
+       void Using_1 ()
+       {
+               AssertError (
+                       () => {
+                               using (dynamic d = 1) { }
+                       }, "Cannot implicitly convert type 'int' to 'System.IDisposable'");
+       }
+       
        void Unsafe_1 ()
        {
                dynamic d = 1;
                AssertError (
                        () => Helper.Foo (d),
-                       "Pointers and fixed size buffers cannot be used in a dynamic context");
+                       "Dynamic calls cannot be used in conjunction with pointers");
+       }
+       
+       void NullableConversion ()
+       {
+               dynamic d = 1;
+               AssertError (
+                       () => {
+                               dynamic b = false;
+                               byte? b2 = null;
+                               b &= b2;
+                       }, "Operator '&=' cannot be applied to operands of type 'bool' and 'byte?'");
        }
        
 #pragma warning restore 169
@@ -33,7 +61,7 @@ class Tester
                        a ();
                } catch (RuntimeBinderException e) {
                        if (e.Message != msg)
-                               throw;
+                               throw new ApplicationException ("Expected error message: " + e.Message);
                        
                        return;
                }