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 | |
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
-rw-r--r-- | mcs/gmcs/ChangeLog | 3 | ||||
-rw-r--r-- | mcs/gmcs/ecore.cs | 21 | ||||
-rw-r--r-- | mcs/mcs/ChangeLog | 3 | ||||
-rw-r--r-- | mcs/mcs/ecore.cs | 21 | ||||
-rw-r--r-- | mcs/tests/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/tests/test-493.cs | 11 |
6 files changed, 41 insertions, 22 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; diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog index a335ee26a40..2183e0de1cd 100644 --- a/mcs/mcs/ChangeLog +++ b/mcs/mcs/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/mcs/ecore.cs b/mcs/mcs/ecore.cs index 8b3e61aa012..de19e0e434b 100644 --- a/mcs/mcs/ecore.cs +++ b/mcs/mcs/ecore.cs @@ -3254,11 +3254,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; @@ -3585,12 +3585,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; diff --git a/mcs/tests/ChangeLog b/mcs/tests/ChangeLog index edfa77218f2..c3d2103f8b0 100644 --- a/mcs/tests/ChangeLog +++ b/mcs/tests/ChangeLog @@ -1,3 +1,7 @@ +2006-03-01 Raja R Harinath <rharinath@novell.com> + + * test-493.cs: New test from #77628. + 2006-02-27 Marek Safar <marek.safar@seznam.cz> * test-492.cs: Another attribute tests. diff --git a/mcs/tests/test-493.cs b/mcs/tests/test-493.cs new file mode 100644 index 00000000000..b427f77f889 --- /dev/null +++ b/mcs/tests/test-493.cs @@ -0,0 +1,11 @@ +class A { + protected int f { get { return 1; } } +} + +class B : A { + int bar () { return new C().f; } + } + +class C : B { + static void Main () {} +} |