Author: raja
Date: 2006-04-18 07:30:50 -0400 (Tue, 18 Apr 2006)
New Revision: 59586
Added:
trunk/mcs/errors/cs1690-4.cs
trunk/mcs/errors/cs1690-5.cs
trunk/mcs/errors/cs1690-6.cs
trunk/mcs/errors/cs1690-7.cs
Modified:
trunk/mcs/errors/ChangeLog
trunk/mcs/errors/cs1690-2.cs
trunk/mcs/errors/cs1690-3.cs
trunk/mcs/errors/cs1690.cs
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/expression.cs
trunk/mcs/gmcs/report.cs
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/ecore.cs
trunk/mcs/mcs/expression.cs
trunk/mcs/mcs/report.cs
Log:
In mcs and gmcs:
Possibly fix #77752. Fix cs1690-[4-7].cs.
* ecore.cs (Expression.CheckMarshalByRefAccess): Renamed from
CheckMarshallByRefAccess. Drop parameter.
(FieldExpr.CheckMarshalByRefAccess): Update. Change CS1690 to a
warning.
(FieldExpr.DoResolve): Call CheckMarshalByRefAccess on
InstanceExpression.
* report.cs (AllWarnings): Add CS1690.
* expression.cs (Argument.Resolve): Use EmptyExpression.OutAccess
for ref access too.
(LocalVariableReference.DoResolveBase): Update.
In errors:
* cs1690.cs, cs1690-2.cs, cs1690-3.cs: Update.
* cs1690-4.cs, cs1690-5.cs, cs1690-6.cs, cs1690-7.cs: New tests
inspired by #77752.
Modified: trunk/mcs/errors/ChangeLog
===================================================================
--- trunk/mcs/errors/ChangeLog 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/ChangeLog 2006-04-18 11:30:50 UTC (rev 59586)
@@ -1,3 +1,9 @@
+2006-04-18 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * cs1690.cs, cs1690-2.cs, cs1690-3.cs: Update.
+ * cs1690-4.cs, cs1690-5.cs, cs1690-6.cs, cs1690-7.cs: New tests
+ inspired by #77752.
+
2006-03-22 Raja R Harinath <[EMAIL PROTECTED]>
* gcs1908.cs, gcs1908-2.cs, gcs1908-3.cs, gcs1908-4.cs: New tests
Modified: trunk/mcs/errors/cs1690-2.cs
===================================================================
--- trunk/mcs/errors/cs1690-2.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/cs1690-2.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -1,5 +1,6 @@
// cs1690-2.cs: Cannot call methods, properties, or indexers on `A.point'
because it is a value type member of a marshal-by-reference class
-// Line: 21
+// Line: 22
+// Compiler options: -warn:1 -warnaserror
using System;
Modified: trunk/mcs/errors/cs1690-3.cs
===================================================================
--- trunk/mcs/errors/cs1690-3.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/cs1690-3.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -1,5 +1,6 @@
// cs1690-3.cs: Cannot call methods, properties, or indexers on `A.point'
because it is a value type member of a marshal-by-reference class
-// Line: 21
+// Line: 22
+// Compiler options: -warn:1 -warnaserror
using System;
Added: trunk/mcs/errors/cs1690-4.cs
===================================================================
--- trunk/mcs/errors/cs1690-4.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/cs1690-4.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -0,0 +1,29 @@
+// cs1690-4.cs: Cannot call methods, properties, or indexers on `A.point'
because it is a value type member of a marshal-by-reference class
+// Line: 27
+// Compiler options: -warn:1 -warnaserror
+
+using System;
+
+public struct Coord
+{
+ public void Error () {}
+}
+
+public struct Point {
+ public Coord x;
+ public Coord y;
+}
+
+public class A : MarshalByRefObject
+{
+ public Point point = new Point ();
+}
+
+public class Test
+{
+ public static void Main ()
+ {
+ A a = new A ();
+ a.point.x.Error ();
+ }
+}
Property changes on: trunk/mcs/errors/cs1690-4.cs
___________________________________________________________________
Name: svn:mime-type
+ text/cpp
Added: trunk/mcs/errors/cs1690-5.cs
===================================================================
--- trunk/mcs/errors/cs1690-5.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/cs1690-5.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -0,0 +1,29 @@
+// cs1690-4.cs: Cannot call methods, properties, or indexers on `A.point'
because it is a value type member of a marshal-by-reference class
+// Line: 27
+// Compiler options: -warn:1 -warnaserror
+
+using System;
+
+public struct Coord
+{
+ public int val;
+}
+
+public struct Point {
+ public Coord x;
+ public Coord y;
+}
+
+public class A : MarshalByRefObject
+{
+ public Point point = new Point ();
+}
+
+public class Test
+{
+ public static void Main ()
+ {
+ A a = new A ();
+ a.point.x.val = 0;
+ }
+}
Property changes on: trunk/mcs/errors/cs1690-5.cs
___________________________________________________________________
Name: svn:mime-type
+ text/cpp
Added: trunk/mcs/errors/cs1690-6.cs
===================================================================
--- trunk/mcs/errors/cs1690-6.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/cs1690-6.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -0,0 +1,29 @@
+// cs1690-4.cs: Cannot call methods, properties, or indexers on `A.point'
because it is a value type member of a marshal-by-reference class
+// Line: 27
+// Compiler options: -warn:1 -warnaserror
+
+using System;
+
+public struct Coord
+{
+ public int val;
+}
+
+public struct Point {
+ public Coord x;
+ public Coord y;
+}
+
+public class A : MarshalByRefObject
+{
+ public Point point = new Point ();
+}
+
+public class Test
+{
+ public static void Main ()
+ {
+ A a = new A ();
+ Console.WriteLine (a.point.x.val);
+ }
+}
Property changes on: trunk/mcs/errors/cs1690-6.cs
___________________________________________________________________
Name: svn:mime-type
+ text/cpp
Added: trunk/mcs/errors/cs1690-7.cs
===================================================================
--- trunk/mcs/errors/cs1690-7.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/cs1690-7.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -0,0 +1,29 @@
+// cs1690-4.cs: Cannot call methods, properties, or indexers on `A.point'
because it is a value type member of a marshal-by-reference class
+// Line: 27
+// Compiler options: -warn:1 -warnaserror
+
+using System;
+
+public struct Coord
+{
+ public int val;
+}
+
+public struct Point {
+ public Coord x;
+ public Coord y;
+}
+
+public class A : MarshalByRefObject
+{
+ public Point point = new Point ();
+}
+
+public class Test
+{
+ public static void Main ()
+ {
+ A a = new A ();
+ Console.WriteLine (a.point.x);
+ }
+}
Property changes on: trunk/mcs/errors/cs1690-7.cs
___________________________________________________________________
Name: svn:mime-type
+ text/cpp
Modified: trunk/mcs/errors/cs1690.cs
===================================================================
--- trunk/mcs/errors/cs1690.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/errors/cs1690.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -1,5 +1,6 @@
// cs1690.cs: Cannot call methods, properties, or indexers on `A.point'
because it is a value type member of a marshal-by-reference class
-// Line: 21
+// Line: 22
+// Compiler options: -warn:1 -warnaserror
using System;
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/gmcs/ChangeLog 2006-04-18 11:30:50 UTC (rev 59586)
@@ -1,3 +1,17 @@
+2006-04-18 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Possibly fix #77752. Fix cs1690-[4-7].cs.
+ * ecore.cs (Expression.CheckMarshalByRefAccess): Renamed from
+ CheckMarshallByRefAccess. Drop parameter.
+ (FieldExpr.CheckMarshalByRefAccess): Update. Change CS1690 to a
+ warning.
+ (FieldExpr.DoResolve): Call CheckMarshalByRefAccess on
+ InstanceExpression.
+ * report.cs (AllWarnings): Add CS1690.
+ * expression.cs (Argument.Resolve): Use EmptyExpression.OutAccess
+ for ref access too.
+ (LocalVariableReference.DoResolveBase): Update.
+
2006-04-09 Marek Safar <[EMAIL PROTECTED]>
class.cs (MethodOrOperator): Moved common parts from method class.
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/gmcs/ecore.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -129,14 +129,13 @@
/// </summary>
public void Error (int error, string s)
{
- if (loc.IsNull)
- Report.Error (error, s);
- else
- Report.Error (error, loc, s);
+ Report.Error (error, loc, s);
}
- // Not nice but we have broken hierarchy
- public virtual void CheckMarshallByRefAccess (Type container) {}
+ // Not nice but we have broken hierarchy.
+ public virtual void CheckMarshalByRefAccess ()
+ {
+ }
public virtual bool GetAttributableValue (Type valueType, out
object value)
{
@@ -3099,6 +3098,8 @@
if (InstanceExpression == null)
return null;
+
+ InstanceExpression.CheckMarshalByRefAccess ();
}
if (!in_initializer && !ec.IsFieldInitializer) {
@@ -3217,12 +3218,12 @@
return null;
}
- public override void CheckMarshallByRefAccess (Type container)
+ public override void CheckMarshalByRefAccess ()
{
- if (!IsStatic && Type.IsValueType &&
!container.IsSubclassOf (TypeManager.mbr_type) && DeclaringType.IsSubclassOf
(TypeManager.mbr_type)) {
+ if (!IsStatic && Type.IsValueType &&
!(InstanceExpression is This) && DeclaringType.IsSubclassOf
(TypeManager.mbr_type)) {
Report.SymbolRelatedToPreviousError
(DeclaringType);
- Report.Error (1690, loc, "Cannot call methods,
properties, or indexers on `{0}' because it is a value type member of a
marshal-by-reference class",
- GetSignatureForError ());
+ Report.Warning (1690, 1, loc, "Cannot call
methods, properties, or indexers on `{0}' because it is a value type member of
a marshal-by-reference class",
+ GetSignatureForError ());
}
}
@@ -3235,7 +3236,7 @@
return variable != null &&
InstanceExpression.Type.IsValueType && variable.VerifyFixed ();
}
- public override int GetHashCode()
+ public override int GetHashCode ()
{
return FieldInfo.GetHashCode ();
}
@@ -3566,9 +3567,9 @@
InstanceExpression =
InstanceExpression.DoResolve (ec);
if (InstanceExpression == null)
return false;
-
- InstanceExpression.CheckMarshallByRefAccess
(ec.ContainerType);
+ InstanceExpression.CheckMarshalByRefAccess ();
+
if (must_do_cs1540_check && InstanceExpression !=
EmptyExpression.Null &&
InstanceExpression.Type != ec.ContainerType &&
ec.ContainerType.IsSubclassOf
(PropertyInfo.DeclaringType) &&
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/gmcs/expression.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -3544,7 +3544,7 @@
VariableInfo variable_info = local_info.VariableInfo;
if (lvalue_right_side != null){
if (is_readonly){
- if (lvalue_right_side is
LocalVariableReference || lvalue_right_side == EmptyExpression.OutAccess)
+ if (lvalue_right_side ==
EmptyExpression.OutAccess)
Report.Error (1657, loc,
"Cannot pass `{0}' as a ref or out argument because it is a `{1}'",
Name,
local_info.GetReadOnlyContext ());
else if (lvalue_right_side ==
EmptyExpression.LValueMemberAccess)
@@ -4119,7 +4119,7 @@
}
int errors = Report.Errors;
- Expr = Expr.DoResolveLValue (ec, Expr);
+ Expr = Expr.DoResolveLValue (ec,
EmptyExpression.OutAccess);
if (Expr == null && errors == Report.Errors)
Error_LValueRequired (loc);
} else if (ArgType == AType.Out) {
@@ -5312,7 +5312,7 @@
}
if (mg.InstanceExpression != null)
- mg.InstanceExpression.CheckMarshallByRefAccess
(ec.ContainerType);
+ mg.InstanceExpression.CheckMarshalByRefAccess
();
eclass = ExprClass.Value;
this.method = method;
@@ -8406,7 +8406,7 @@
return null;
}
- instance_expr.CheckMarshallByRefAccess
(ec.ContainerType);
+ instance_expr.CheckMarshalByRefAccess ();
eclass = ExprClass.IndexerAccess;
return this;
@@ -8486,7 +8486,7 @@
}
}
- instance_expr.CheckMarshallByRefAccess
(ec.ContainerType);
+ instance_expr.CheckMarshalByRefAccess ();
eclass = ExprClass.IndexerAccess;
return this;
Modified: trunk/mcs/gmcs/report.cs
===================================================================
--- trunk/mcs/gmcs/report.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/gmcs/report.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -80,7 +80,7 @@
612, 618, 626, 628, 642, 649, 652, 658, 659, 660, 661,
665, 672,
1030, 1058,
1522, 1570, 1571, 1572, 1573, 1574, 1580, 1581, 1584,
1587, 1589, 1590, 1591, 1592,
- 1616, 1633, 1634, 1635, 1691, 1692,
+ 1616, 1633, 1634, 1635, 1690, 1691, 1692,
1717, 1718,
1901,
2002, 2023,
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/mcs/ChangeLog 2006-04-18 11:30:50 UTC (rev 59586)
@@ -1,3 +1,17 @@
+2006-04-18 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Possibly fix #77752. Fix cs1690-[4-7].cs.
+ * ecore.cs (Expression.CheckMarshalByRefAccess): Renamed from
+ CheckMarshallByRefAccess. Drop parameter.
+ (FieldExpr.CheckMarshalByRefAccess): Update. Change CS1690 to a
+ warning.
+ (FieldExpr.DoResolve): Call CheckMarshalByRefAccess on
+ InstanceExpression.
+ * report.cs (AllWarnings): Add CS1690.
+ * expression.cs (Argument.Resolve): Use EmptyExpression.OutAccess
+ for ref access too.
+ (LocalVariableReference.DoResolveBase): Update.
+
2006-04-09 Marek Safar <[EMAIL PROTECTED]>
class.cs (MethodOrOperator): Moved common parts from method class.
Modified: trunk/mcs/mcs/ecore.cs
===================================================================
--- trunk/mcs/mcs/ecore.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/mcs/ecore.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -129,14 +129,13 @@
/// </summary>
public void Error (int error, string s)
{
- if (loc.IsNull)
- Report.Error (error, s);
- else
- Report.Error (error, loc, s);
+ Report.Error (error, loc, s);
}
- // Not nice but we have broken hierarchy
- public virtual void CheckMarshallByRefAccess (Type container) {}
+ // Not nice but we have broken hierarchy.
+ public virtual void CheckMarshalByRefAccess ()
+ {
+ }
public virtual bool GetAttributableValue (Type valueType, out
object value)
{
@@ -2801,6 +2800,8 @@
if (InstanceExpression == null)
return null;
+
+ InstanceExpression.CheckMarshalByRefAccess ();
}
if (!in_initializer && !ec.IsFieldInitializer) {
@@ -2913,12 +2914,12 @@
return null;
}
- public override void CheckMarshallByRefAccess (Type container)
+ public override void CheckMarshalByRefAccess ()
{
- if (!IsStatic && Type.IsValueType &&
!container.IsSubclassOf (TypeManager.mbr_type) && DeclaringType.IsSubclassOf
(TypeManager.mbr_type)) {
+ if (!IsStatic && Type.IsValueType &&
!(InstanceExpression is This) && DeclaringType.IsSubclassOf
(TypeManager.mbr_type)) {
Report.SymbolRelatedToPreviousError
(DeclaringType);
- Report.Error (1690, loc, "Cannot call methods,
properties, or indexers on `{0}' because it is a value type member of a
marshal-by-reference class",
- GetSignatureForError ());
+ Report.Warning (1690, 1, loc, "Cannot call
methods, properties, or indexers on `{0}' because it is a value type member of
a marshal-by-reference class",
+ GetSignatureForError ());
}
}
@@ -2931,7 +2932,7 @@
return variable != null &&
InstanceExpression.Type.IsValueType && variable.VerifyFixed ();
}
- public override int GetHashCode()
+ public override int GetHashCode ()
{
return FieldInfo.GetHashCode ();
}
@@ -3259,9 +3260,9 @@
InstanceExpression =
InstanceExpression.DoResolve (ec);
if (InstanceExpression == null)
return false;
-
- InstanceExpression.CheckMarshallByRefAccess
(ec.ContainerType);
+ InstanceExpression.CheckMarshalByRefAccess ();
+
if (must_do_cs1540_check && InstanceExpression !=
EmptyExpression.Null &&
InstanceExpression.Type != ec.ContainerType &&
ec.ContainerType.IsSubclassOf
(PropertyInfo.DeclaringType) &&
Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/mcs/expression.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -3455,7 +3455,7 @@
VariableInfo variable_info = local_info.VariableInfo;
if (lvalue_right_side != null){
if (is_readonly){
- if (lvalue_right_side is
LocalVariableReference || lvalue_right_side == EmptyExpression.OutAccess)
+ if (lvalue_right_side ==
EmptyExpression.OutAccess)
Report.Error (1657, loc,
"Cannot pass `{0}' as a ref or out argument because it is a `{1}'",
Name,
local_info.GetReadOnlyContext ());
else if (lvalue_right_side ==
EmptyExpression.LValueMemberAccess)
@@ -4026,7 +4026,7 @@
}
int errors = Report.Errors;
- Expr = Expr.DoResolveLValue (ec, Expr);
+ Expr = Expr.DoResolveLValue (ec,
EmptyExpression.OutAccess);
if (Expr == null && errors == Report.Errors)
Error_LValueRequired (loc);
} else if (ArgType == AType.Out) {
@@ -5056,7 +5056,7 @@
}
if (mg.InstanceExpression != null)
- mg.InstanceExpression.CheckMarshallByRefAccess
(ec.ContainerType);
+ mg.InstanceExpression.CheckMarshalByRefAccess
();
eclass = ExprClass.Value;
this.method = method;
@@ -7977,7 +7977,7 @@
return null;
}
- instance_expr.CheckMarshallByRefAccess
(ec.ContainerType);
+ instance_expr.CheckMarshalByRefAccess ();
eclass = ExprClass.IndexerAccess;
return this;
@@ -8057,7 +8057,7 @@
}
}
- instance_expr.CheckMarshallByRefAccess
(ec.ContainerType);
+ instance_expr.CheckMarshalByRefAccess ();
eclass = ExprClass.IndexerAccess;
return this;
Modified: trunk/mcs/mcs/report.cs
===================================================================
--- trunk/mcs/mcs/report.cs 2006-04-18 10:28:11 UTC (rev 59585)
+++ trunk/mcs/mcs/report.cs 2006-04-18 11:30:50 UTC (rev 59586)
@@ -80,7 +80,7 @@
612, 618, 626, 628, 642, 649, 652, 658, 659, 660, 661,
665, 672,
1030, 1058,
1522, 1570, 1571, 1572, 1573, 1574, 1580, 1581, 1584,
1587, 1589, 1590, 1591, 1592,
- 1616, 1633, 1634, 1635, 1691, 1692,
+ 1616, 1633, 1634, 1635, 1690, 1691, 1692,
1717, 1718,
1901,
2002, 2023,
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches