Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82717 --- shadow/82717 2007-09-06 09:43:18.000000000 -0400 +++ shadow/82717.tmp.4870 2007-09-06 09:43:18.000000000 -0400 @@ -0,0 +1,58 @@ +Bug#: 82717 +Product: Mono: Compilers +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: The compiler fails because of if/foreach scope bug + +Description of Problem: + +The following code (although a little ugly) should compile: + +if (e.Event.Key == Gdk.Key.Escape) // cancel + foreach (Gtk.Widget w in representation) + if (w.Name == "new") + w.Destroy(); // bye bye +else if (e.Event.Key == Gdk.Key.Return) // ok + foreach (Gtk.Widget w in representation) + if (w.Name == "new") { + string text = ((Gtk.Entry)w).Text; + if (text != "") + representation.Add(new Gtk.Button(text)); + w.Destroy(); // bye bye + } + +Steps to reproduce the problem: +1. Compile the above lines of code + +Actual Results: + +Compile error: + +A local variable named `w' cannot be declared in this scope because it +would give a different meaning to `w', which is already used in a `parent' +scope to denote something else(CS0136) + +Expected Results: + +Compiles fine since the second foreach w is in a different if block than +the first foreach w. + +How often does this happen? + +Always + +Additional Information: + +Using Mono 1.2.3.1. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
