[mcs] Fix error reporting propagation for loop statements. Fixes #20034
authorMarek Safar <marek.safar@gmail.com>
Mon, 26 May 2014 13:14:58 +0000 (15:14 +0200)
committerMarek Safar <marek.safar@gmail.com>
Mon, 26 May 2014 13:16:10 +0000 (15:16 +0200)
mcs/errors/cs1593-5.cs [new file with mode: 0644]
mcs/mcs/statement.cs

diff --git a/mcs/errors/cs1593-5.cs b/mcs/errors/cs1593-5.cs
new file mode 100644 (file)
index 0000000..6055fee
--- /dev/null
@@ -0,0 +1,27 @@
+// CS1593: Delegate `System.Action<System.Threading.Tasks.Task>' does not take `0' arguments
+// Line: 17
+
+using System;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+
+namespace CrashRepro.Core
+{
+       public class X
+       {               
+               async void Foo ()
+               {
+                       var pushes = await Run ().ContinueWith (l =>
+                       {
+                               for (int i = 0; i < 1; ++i)
+                                       Run ().ContinueWith(() => { });
+                       });
+               }
+
+               Task Run ()
+               {
+                       return null;
+               }
+       }
+}
+
index cbce03f2bc5506facff0ca588a77ec51cef52df0..5b9507b858dcf0895979fe808597fdd3380d863c 100644 (file)
@@ -688,11 +688,7 @@ namespace Mono.CSharp {
                                infinite = true;
                        }
 
-                       base.Resolve (bc);
-
-                       Iterator.Resolve (bc);
-
-                       return true;
+                       return base.Resolve (bc) && Iterator.Resolve (bc);
                }
 
                protected override bool DoFlowAnalysis (FlowAnalysisContext fc)
@@ -859,11 +855,11 @@ namespace Mono.CSharp {
                        var prev_loop = bc.EnclosingLoop;
                        var prev_los = bc.EnclosingLoopOrSwitch;
                        bc.EnclosingLoopOrSwitch = bc.EnclosingLoop = this;
-                       Statement.Resolve (bc);
+                       var ok = Statement.Resolve (bc);
                        bc.EnclosingLoopOrSwitch = prev_los;
                        bc.EnclosingLoop = prev_loop;
 
-                       return true;
+                       return ok;
                }
 
                //