[Mono-bugs] [Bug 35631][Maj] New - Improper scoping for nested classes.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
15 Dec 2002 10:51:00 -0000

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 seank@users.sf.net.


--- shadow/35631	Sun Dec 15 05:51:00 2002
+++ shadow/35631.tmp.24624	Sun Dec 15 05:51:00 2002
@@ -0,0 +1,52 @@
+Bug#: 35631
+Product: Mono/MCS
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Major
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: seank@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Improper scoping for nested classes.
+Description of Problem:
+This one is tricky.
+When csc is compiling a nested class, and stumbles upon something like
+it first checks the nested class for Collide, then the parent class for
+Collide, and so on until it hits global scope.
+If the parent class has a member called Collide, then it checks to see
+Collide is static.  Here's where mcs and csc differ.  If Collide is *not*
+static, then csc continues on to grandparent etc finally hitting global
+scope.  mcs doesn't check to see if Collide is static or not and instead
+just uses Parent.Collide
+Steps to reproduce the problem:
+1. Create a class called Collide with a static method called Die()
+2. Create a class called Parent with a non-static member named Collide
+3. Create a nested class called Nested inside Parent and call Collide.Die()
+Actual Results:
+error CS0038: Cannot access nonstatic member `Collide' of outer
+type `Parent' via nested type `Parent+Nested'
+Expected Results:
+Successful compile.  It should see that Parent.Collide is NOT static and
+ignore it, continuing through scopes until it discovers the class Collide
+with the static function Die.
+Additional Information:
+Check the attached file for an example... it compiles just peachy under
+csc, but fails miserably under mcs.