diff options
author | Raja R Harinath <harinath@hurrynot.org> | 2006-03-01 17:42:03 +0300 |
---|---|---|
committer | Raja R Harinath <harinath@hurrynot.org> | 2006-03-01 17:42:03 +0300 |
commit | 7713641ae9075059e06b2c3c78944c83a46ba393 (patch) | |
tree | fd646609f0b1cc1b931928ef0d2ca54f0a0c974b /mcs/gmcs | |
parent | 4675380f0b7ace5683e840915f8b3587f56a143c (diff) |
Fix #77628.
* mcs/ecore.cs (PropertyExpr.InstanceResolve): Fix CS1540 check.
* gmcs/ecore.cs (PropertyExpr.InstanceResolve): Likewise.
* tests/test-493.cs: New test from #77628.
svn path=/trunk/mcs/; revision=57464
Diffstat (limited to 'mcs/gmcs')
-rw-r--r-- | mcs/gmcs/ChangeLog | 3 | ||||
-rw-r--r-- | mcs/gmcs/ecore.cs | 21 |
2 files changed, 13 insertions, 11 deletions
diff --git a/mcs/gmcs/ChangeLog b/mcs/gmcs/ChangeLog index 6acb0b69e39..912604a8781 100644 --- a/mcs/gmcs/ChangeLog +++ b/mcs/gmcs/ChangeLog @@ -1,5 +1,8 @@ 2006-03-01 Raja R Harinath <rharinath@novell.com> + Fix #77628. + * ecore.cs (PropertyExpr.InstanceResolve): Fix CS1540 check. + Fix #77642. * typemanager.cs (GetFullNameSignature): Don't nullref on protected accessors. diff --git a/mcs/gmcs/ecore.cs b/mcs/gmcs/ecore.cs index 14a25c98137..57b7b66a2aa 100644 --- a/mcs/gmcs/ecore.cs +++ b/mcs/gmcs/ecore.cs @@ -3552,11 +3552,11 @@ namespace Mono.CSharp { InstanceExpression.CheckMarshallByRefAccess (ec.ContainerType); if (must_do_cs1540_check && InstanceExpression != EmptyExpression.Null && - InstanceExpression.Type != ec.ContainerType && - ec.ContainerType.IsSubclassOf (PropertyInfo.DeclaringType) && - InstanceExpression.Type.IsSubclassOf (PropertyInfo.DeclaringType)) { - Error_CannotAccessProtected (loc, PropertyInfo, InstanceExpression.Type, ec.ContainerType); - return false; + InstanceExpression.Type != ec.ContainerType && + ec.ContainerType.IsSubclassOf (PropertyInfo.DeclaringType) && + !InstanceExpression.Type.IsSubclassOf (ec.ContainerType)) { + Error_CannotAccessProtected (loc, PropertyInfo, InstanceExpression.Type, ec.ContainerType); + return false; } return true; @@ -3883,12 +3883,11 @@ namespace Mono.CSharp { // This is using the same mechanism as the CS1540 check in PropertyExpr. // However, in the Event case, we reported a CS0122 instead. // - if (must_do_cs1540_check && InstanceExpression != EmptyExpression.Null) { - if ((InstanceExpression.Type != ec.ContainerType) && - ec.ContainerType.IsSubclassOf (InstanceExpression.Type)) { - ErrorIsInaccesible (loc, TypeManager.CSharpSignature (EventInfo)); - return false; - } + if (must_do_cs1540_check && InstanceExpression != EmptyExpression.Null && + InstanceExpression.Type != ec.ContainerType && + ec.ContainerType.IsSubclassOf (InstanceExpression.Type)) { + ErrorIsInaccesible (loc, TypeManager.CSharpSignature (EventInfo)); + return false; } return true; |