Author: raja
Date: 2005-04-16 06:37:03 -0400 (Sat, 16 Apr 2005)
New Revision: 43090

Added:
   trunk/mcs/tests/test-365.cs
Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/ecore.cs
   trunk/mcs/mcs/expression.cs
   trunk/mcs/tests/ChangeLog
   trunk/mcs/tests/Makefile
Log:
Fix #73834.
* mcs/ecore.cs (PropertyExpr.resolved): New.
(DoResolve): Use it to handle a case of double resolution here.
Handle a case of identical-name-and-type-name.
* mcs/expression.cs (ArrayCreation.CheckIndices): Avoid double
resolution by storing the results of expression resolution back
into the "probes" array.
* tests/test-365.cs: New test from #73834.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-04-16 07:34:01 UTC (rev 43089)
+++ trunk/mcs/mcs/ChangeLog     2005-04-16 10:37:03 UTC (rev 43090)
@@ -1,3 +1,13 @@
+2005-04-16  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix #73834.
+       * ecore.cs (PropertyExpr.resolved): New.
+       (DoResolve): Use it to handle a case of double resolution here.
+       Handle a case of identical-name-and-type-name.
+       * expression.cs (ArrayCreation.CheckIndices): Avoid double
+       resolution by storing the results of expression resolution back
+       into the "probes" array.
+
 2005-04-15  Raja R Harinath  <[EMAIL PROTECTED]>
 
        Fix cs0208-7.cs and cs0208-8.cs.

Modified: trunk/mcs/mcs/ecore.cs
===================================================================
--- trunk/mcs/mcs/ecore.cs      2005-04-16 07:34:01 UTC (rev 43089)
+++ trunk/mcs/mcs/ecore.cs      2005-04-16 10:37:03 UTC (rev 43090)
@@ -3138,6 +3138,8 @@
                public bool IsBase;
                MethodInfo getter, setter;
                bool is_static;
+
+               bool resolved;
                
                LocalTemporary temp;
                bool prepared;
@@ -3290,6 +3292,11 @@
                
                override public Expression DoResolve (EmitContext ec)
                {
+                       if (resolved) {
+                               Report.Debug ("Double resolve of " + Name);
+                               return this;
+                       }
+
                        if (getter != null){
                                if (TypeManager.GetArgumentTypes 
(getter).Length != 0){
                                        Report.Error (
@@ -3309,16 +3316,19 @@
                                //
                                if (setter == null)
                                        return null;
-                               
-                               Report.Error (154, loc, 
-                                             "The property `" + 
PropertyInfo.Name +
-                                             "' can not be used in " +
-                                             "this context because it lacks a 
get accessor");
-                               return null;
+
+                               if (InstanceExpression != EmptyExpression.Null) 
{
+                                       Report.Error (154, loc, 
+                                               "The property `" + 
PropertyInfo.Name +
+                                               "' can not be used in " +
+                                               "this context because it lacks 
a get accessor");
+                                       return null;
+                               }
                        } 
 
-                       bool must_do_cs1540_check;
-                       if (!IsAccessorAccessible (ec.ContainerType, getter, 
out must_do_cs1540_check)) {
+                       bool must_do_cs1540_check = false;
+                       if (getter != null &&
+                           !IsAccessorAccessible (ec.ContainerType, getter, 
out must_do_cs1540_check)) {
                                PropertyBase.PropertyMethod pm = 
TypeManager.GetMethod (getter) as PropertyBase.PropertyMethod;
                                if (pm != null && pm.HasCustomAccessModifier) {
                                        Report.SymbolRelatedToPreviousError 
(pm);
@@ -3348,6 +3358,8 @@
                                return null;
                        }
 
+                       resolved = true;
+
                        return this;
                }
 

Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2005-04-16 07:34:01 UTC (rev 43089)
+++ trunk/mcs/mcs/expression.cs 2005-04-16 10:37:03 UTC (rev 43090)
@@ -6152,9 +6152,11 @@
                        }
 
                        int child_bounds = -1;
-                       foreach (object o in probe) {
+                       for (int i = 0; i < probe.Count; ++i) {
+                               object o = probe [i];
                                if (o is ArrayList) {
-                                       int current_bounds = ((ArrayList) 
o).Count;
+                                       ArrayList sub_probe = o as ArrayList;
+                                       int current_bounds = sub_probe.Count;
                                        
                                        if (child_bounds == -1) 
                                                child_bounds = current_bounds;
@@ -6168,7 +6170,7 @@
                                                return false;
                                        }
                                        
-                                       bool ret = CheckIndices (ec, 
(ArrayList) o, idx + 1, specified_dims);
+                                       bool ret = CheckIndices (ec, sub_probe, 
idx + 1, specified_dims);
                                        if (!ret)
                                                return false;
                                } else {
@@ -6179,6 +6181,7 @@
                                        
                                        Expression tmp = (Expression) o;
                                        tmp = tmp.Resolve (ec);
+                                       probe [i] = tmp;
                                        if (tmp == null)
                                                return false;
 

Modified: trunk/mcs/tests/ChangeLog
===================================================================
--- trunk/mcs/tests/ChangeLog   2005-04-16 07:34:01 UTC (rev 43089)
+++ trunk/mcs/tests/ChangeLog   2005-04-16 10:37:03 UTC (rev 43090)
@@ -1,3 +1,7 @@
+2005-04-16  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * test-365.cs: New test from #73834.
+
 2005-04-14  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * Makefile (MCS): Override only in the 'default' profile.

Modified: trunk/mcs/tests/Makefile
===================================================================
--- trunk/mcs/tests/Makefile    2005-04-16 07:34:01 UTC (rev 43089)
+++ trunk/mcs/tests/Makefile    2005-04-16 10:37:03 UTC (rev 43090)
@@ -35,7 +35,7 @@
 NEW_TEST_SOURCES_common = xml-033 xml-034 xml-035 xml-036 test-329 2test-16 
test-330 a-parameter5 test-331 test-332 \
                          test-333 test-311 test-335 test-336 test-337 test-287 
test-338 test-339 test-341 test-334 test-342 \
                          test-344 test-345 test-346 test-347 test-348 test-349 
test-350 test-351 test-352 test-353 test-354 test-355 \
-                         test-356 test-357 test-358 test-359 test-360 test-361 
test-363 test-364 \
+                         test-356 test-357 test-358 test-359 test-360 test-361 
test-363 test-364 test-365 \
        mtest-7-dll mtest-7-exe \
        mtest-8-dll mtest-8-exe
 

Added: trunk/mcs/tests/test-365.cs
===================================================================
--- trunk/mcs/tests/test-365.cs 2005-04-16 07:34:01 UTC (rev 43089)
+++ trunk/mcs/tests/test-365.cs 2005-04-16 10:37:03 UTC (rev 43090)
@@ -0,0 +1,22 @@
+       public enum LiteralType
+       {
+               Void,
+       }
+       
+       class C
+       {
+               public LiteralType LiteralType                                  
+               {
+                       set
+                       {
+                       }
+               }
+               
+               private LiteralType[] widenSbyte = new LiteralType[]
+                       {
+                               LiteralType.Void
+                       };
+                       
+               static void Main () {}
+       }
+

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

Reply via email to