Author: raja
Date: 2005-05-04 08:33:09 -0400 (Wed, 04 May 2005)
New Revision: 44023

Added:
   trunk/mcs/errors/cs0122-13.cs
Modified:
   trunk/mcs/errors/ChangeLog
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/typemanager.cs
Log:
Fix #64812.
* mcs/typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
allow access to all static members.
* errors/cs0122-13.cs: New test based on #64812.


Modified: trunk/mcs/errors/ChangeLog
===================================================================
--- trunk/mcs/errors/ChangeLog  2005-05-04 12:02:44 UTC (rev 44022)
+++ trunk/mcs/errors/ChangeLog  2005-05-04 12:33:09 UTC (rev 44023)
@@ -1,3 +1,7 @@
+2005-05-04  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * cs0122-13.cs: New test based on #64812.
+
 2005-05-03  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * errors.txt (warning -28): Remove.

Added: trunk/mcs/errors/cs0122-13.cs
===================================================================
--- trunk/mcs/errors/cs0122-13.cs       2005-05-04 12:02:44 UTC (rev 44022)
+++ trunk/mcs/errors/cs0122-13.cs       2005-05-04 12:33:09 UTC (rev 44023)
@@ -0,0 +1,13 @@
+// cs0122-13.cs: 'Wrapper.Test.foo' is inaccessible due to its protection level
+// Line: 10
+
+internal class Test 
+{
+       protected const int foo = 0;
+}
+internal class Rest
+{
+       protected const int foo = Test.foo;
+
+       static void Main () {}
+}

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-05-04 12:02:44 UTC (rev 44022)
+++ trunk/mcs/mcs/ChangeLog     2005-05-04 12:33:09 UTC (rev 44023)
@@ -1,3 +1,12 @@
+2005-05-04  Raja R Harinath  <[EMAIL PROTECTED]>
+           Abin Thomas  <[EMAIL PROTECTED]>
+           Anoob V E  <[EMAIL PROTECTED]>
+           Harilal P R  <[EMAIL PROTECTED]>
+
+       Fix #64812.
+       * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
+       allow access to all static members.
+
 2005-05-04  Martin Baulig  <[EMAIL PROTECTED]>
 
        * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().

Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs        2005-05-04 12:02:44 UTC (rev 44022)
+++ trunk/mcs/mcs/typemanager.cs        2005-05-04 12:33:09 UTC (rev 44023)
@@ -2437,11 +2437,10 @@
                        if (invocation_type == null)
                                return false;
 
-                       Debug.Assert (IsNestedFamilyAccessible 
(invocation_type, m.DeclaringType));
+                       if (is_static && qualifier_type == null)
+                               // It resolved from a simple name, so it should 
be visible.
+                               return true;
 
-                       if (is_static)
-                               return true;
-                       
                        // A nested class has access to all the protected 
members visible to its parent.
                        if (qualifier_type != null
                            && TypeManager.IsNestedChildOf (invocation_type, 
qualifier_type))
@@ -2449,6 +2448,9 @@
 
                        if (invocation_type == m.DeclaringType
                            || invocation_type.IsSubclassOf (m.DeclaringType)) {
+                               if (is_static)
+                                       return true;
+
                                // Although a derived class can access 
protected members of its base class
                                // it cannot do so through an instance of the 
base class (CS1540).
                                // => Ancestry should be: declaring_type ->* 
invocation_type ->*  qualified_type
@@ -2458,8 +2460,9 @@
                                        return true;
                        }
 
-                       if (almost_match != null)
+                       if (!is_static && almost_match != null)
                                almost_match.Add (m);
+
                        return false;
                }
                

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to