[mcs] When setting struct empty layout consider compiler generated fields. Fixes...
[mono.git] / mcs / mcs / decl.cs
index d60e6ca0aece20e9b2e085ff78ab2c8146817449..0f0b1d1bb69749696d80b025d5da5bf27faf276b 100644 (file)
@@ -18,7 +18,7 @@ using System.Diagnostics;
 using System.Text;
 using Mono.CompilerServices.SymbolWriter;
 
-#if NET_2_1
+#if MOBILE
 using XmlElement = System.Object;
 #else
 using System.Xml;
@@ -290,7 +290,8 @@ namespace Mono.CSharp {
                        HasInstanceConstructor = 1 << 16,
                        HasUserOperators = 1 << 17,
                        CanBeReused = 1 << 18,
-                       InterfacesExpanded = 1 << 19
+                       InterfacesExpanded = 1 << 19,
+                       HasInstanceField = 1 << 20
                }
 
                /// <summary>
@@ -508,16 +509,6 @@ namespace Mono.CSharp {
                        return obsolete;
                }
 
-               /// <summary>
-               /// Checks for ObsoleteAttribute presence. It's used for testing of all non-types elements
-               /// </summary>
-               public virtual void CheckObsoleteness (Location loc)
-               {
-                       ObsoleteAttribute oa = GetAttributeObsolete ();
-                       if (oa != null)
-                               AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc, Report);
-               }
-
                //
                // Checks whether the type P is as accessible as this member
                //
@@ -534,6 +525,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;
 
@@ -553,6 +547,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:
@@ -1071,6 +1069,16 @@ namespace Mono.CSharp {
 
                #endregion
 
+               public virtual void CheckObsoleteness (IMemberContext mc, Location loc)
+               {
+                       var oa = GetAttributeObsolete ();
+                       if (oa == null)
+                               return;
+
+                       if (!mc.IsObsolete)
+                               AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc, mc.Module.Compiler.Report);
+               }
+
                public virtual ObsoleteAttribute GetAttributeObsolete ()
                {
                        if ((state & (StateFlags.Obsolete | StateFlags.Obsolete_Undetected)) == 0)