From: Marek Safar Date: Mon, 11 Jan 2016 12:30:53 +0000 (+0100) Subject: [mcs] Fixes inconsistent accessibility check for partial types. Fixes #37232 X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=2ab35ec231cf745c1040c07ab1fc667d230aedf2;p=mono.git [mcs] Fixes inconsistent accessibility check for partial types. Fixes #37232 --- diff --git a/mcs/errors/cs0051-3.cs b/mcs/errors/cs0051-3.cs new file mode 100644 index 00000000000..55041ee4c1e --- /dev/null +++ b/mcs/errors/cs0051-3.cs @@ -0,0 +1,17 @@ +// CS0051: Inconsistent accessibility: parameter type `NV' is less accessible than method `C1.Foo(NV)' +// Line: 14 + +internal class NV +{ +} + +public partial class C1 +{ +} + +partial class C1 +{ + public void Foo (NV arg) + { + } +} \ No newline at end of file diff --git a/mcs/mcs/decl.cs b/mcs/mcs/decl.cs index a386ab18b3b..3f88a5935c0 100644 --- a/mcs/mcs/decl.cs +++ b/mcs/mcs/decl.cs @@ -524,6 +524,9 @@ namespace Mono.CSharp { while (TypeManager.HasElementType (p)) p = TypeManager.GetElementType (p); + if (p.BuiltinType != BuiltinTypeSpec.Type.None) + return true; + if (p.IsGenericParameter) return true; @@ -543,6 +546,10 @@ namespace Mono.CSharp { bool same_access_restrictions = false; for (MemberCore mc = this; !same_access_restrictions && mc != null && mc.Parent != null; mc = mc.Parent) { + var tc = mc as TypeContainer; + if (tc != null && tc.PartialContainer != null) + mc = tc.PartialContainer; + var al = mc.ModFlags & Modifiers.AccessibilityMask; switch (pAccess) { case Modifiers.INTERNAL: