2006-07-08 Marek Safar <marek.safar@seznam.cz>
authorMarek Safar <marek.safar@gmail.com>
Sat, 8 Jul 2006 13:05:47 +0000 (13:05 -0000)
committerMarek Safar <marek.safar@gmail.com>
Sat, 8 Jul 2006 13:05:47 +0000 (13:05 -0000)
* attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Fixed to look
for accessors as well.
* ecore.cs (EventExpr): Add AccessorTable.

svn path=/trunk/mcs/; revision=62362

mcs/errors/CS0619-51-lib.cs [new file with mode: 0644]
mcs/errors/Makefile
mcs/errors/cs0619-51.cs [new file with mode: 0644]
mcs/errors/known-issues-gmcs
mcs/errors/known-issues-mcs
mcs/gmcs/ChangeLog
mcs/gmcs/attribute.cs
mcs/gmcs/ecore.cs
mcs/mcs/ChangeLog
mcs/mcs/attribute.cs
mcs/mcs/ecore.cs

diff --git a/mcs/errors/CS0619-51-lib.cs b/mcs/errors/CS0619-51-lib.cs
new file mode 100644 (file)
index 0000000..53f5d59
--- /dev/null
@@ -0,0 +1,14 @@
+using System;\r
+\r
+public delegate void D ();\r
+\r
+public class A\r
+{\r
+               [Obsolete ("Please use ...", true)]\r
+               protected event D comparer {\r
+                       add {\r
+                       }\r
+                       remove {\r
+                       }\r
+               }\r
+}
\ No newline at end of file
index d6c5e54fe6cff2994b32e7c4f377fae25d393480..4924c954ab0e8c3244ccd5e7898e156e62ded1bd 100644 (file)
@@ -37,7 +37,7 @@ TEST_SUPPORT_FILES = \
        CS0433-lib.dll CS0433-2-lib.dll \
        CS0534-3-lib.dll CS0534-4-lib.dll CS0571-3-lib.dll \
        CS0612-2-lib.dll CS0618-2-lib.dll CS0619-8-lib.dll CS0619-17-lib.dll CS0619-32-lib.dll CS0619-33-lib.dll CS0619-36-lib.dll CS0619-42-lib.dll \
-       CS0619-43-lib.dll CS1546-lib.dll CS2015-lib.dll CS3005-16-lib.dll CS3013-module.dll CSExternAlias-lib.dll \
+       CS0619-43-lib.dll CS1546-lib.dll CS0619-51-lib.dll CS2015-lib.dll CS3005-16-lib.dll CS3013-module.dll CSExternAlias-lib.dll \
        $(EXTRA_SUPPORT_FILES) 
 
 all-local:
diff --git a/mcs/errors/cs0619-51.cs b/mcs/errors/cs0619-51.cs
new file mode 100644 (file)
index 0000000..f651d43
--- /dev/null
@@ -0,0 +1,20 @@
+// cs0619-51.cs: `A.comparer' is obsolete: `Please use ...'
+// Line: 16\r
+// Compiler options: -reference:CS0619-51-lib.dll\r
+\r
+using System;\r
+using System.Collections;\r
+\r
+public class B : A\r
+{\r
+       void test ()\r
+       {\r
+       }\r
+       \r
+       public void AA ()\r
+       {\r
+               comparer += new D (test);\r
+       }\r
+       \r
+       public static void Main () {}\r
+}\r
index 14d0b0222720963c8993f34f9e8eb1e7a4fbd715..d1235a9161e9ee3730a626c9bd03a6520274752f 100644 (file)
@@ -23,7 +23,6 @@ cs0547.cs
 cs0548-4.cs
 cs0548.cs
 cs0567.cs
-cs0612-2.cs NO ERROR
 cs0619-42.cs
 cs0631-2.cs
 cs0647-3.cs
index fbc05bd9c1afe97244560e496f10b15fa1e005de..f3041fc171a95f9889c7827cbe9fc9fef2e579ae 100644 (file)
@@ -21,7 +21,6 @@ cs0547.cs
 cs0548-4.cs
 cs0548.cs
 cs0567.cs
-cs0612-2.cs NO ERROR
 cs0619-42.cs
 cs0631-2.cs
 cs1501-5.cs
index ec633f258533fb4d0cdb693d7fafa812934c68d3..81772e18da470b5515d32fa84c52ea0ed1cbf520 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-08  Marek Safar  <marek.safar@seznam.cz>
+
+       * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Fixed to look
+       for accessors as well.
+       * ecore.cs (EventExpr): Add AccessorTable.
+
 2006-07-03  Martin Baulig  <martin@ximian.com>
 
        * ecore.cs (UnboxCast.Emit): Also use `Unbox_Any' for generic
index 8ce931618c375512eab0e5c88139b7616bf2af61..8b672f801e67ada62b6669dbfb72e4ae1a4a9e71 100644 (file)
@@ -1792,9 +1792,18 @@ namespace Mono.CSharp {
                        if (mb.IsSpecialName) {
                                PropertyInfo pi = PropertyExpr.AccessorTable [mb] as PropertyInfo;
                                if (pi != null) {
-                                       // FIXME: This is buggy as properties from this assembly are included as well
+                                       if (TypeManager.LookupDeclSpace (pi.DeclaringType) == null)
+                                               return GetMemberObsoleteAttribute (pi);
+
+                                       return null;
+                               }
+
+                               EventInfo ei = EventExpr.AccessorTable [mb] as EventInfo;
+                               if (ei != null) {
+                                       if (TypeManager.LookupDeclSpace (ei.DeclaringType) == null)
+                                               return GetMemberObsoleteAttribute (ei);
+
                                        return null;
-                                       //return GetMemberObsoleteAttribute (pi);
                                }
                        }
 
index 39441e8de50b1db77279de30f17016a5ba5095ea..a3c3ace1151192b1756723ef3dd9cb6e4b358a85 100644 (file)
@@ -3832,6 +3832,8 @@ namespace Mono.CSharp {
 
                bool is_static;
                MethodInfo add_accessor, remove_accessor;
+
+               internal static PtrHashtable AccessorTable = new PtrHashtable (); 
                
                public EventExpr (EventInfo ei, Location loc)
                {
@@ -3841,6 +3843,10 @@ namespace Mono.CSharp {
 
                        add_accessor = TypeManager.GetAddMethod (ei);
                        remove_accessor = TypeManager.GetRemoveMethod (ei);
+                       if (add_accessor != null)
+                               AccessorTable [add_accessor] = ei;
+                       if (remove_accessor != null)
+                               AccessorTable [remove_accessor] = ei;
                        
                        if (add_accessor.IsStatic || remove_accessor.IsStatic)
                                is_static = true;
index b36a08c5d2683e217ee7547e49c07e57889c281d..79a685a14645538d1c1db249e157c3893b03e5f7 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-08  Marek Safar  <marek.safar@seznam.cz>
+
+       * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Fixed to look
+       for accessors as well.
+       * ecore.cs (EventExpr): Add AccessorTable.
+
 2006-07-01  Marek Safar  <marek.safar@seznam.cz>
 
        A fix for #78738
index 2fb61c3c3bc9e6d68ec83a63861903014b1ab16d..083c97924c3c4de70abed46f34ae9bafd5f5fb05 100644 (file)
@@ -1763,9 +1763,18 @@ namespace Mono.CSharp {
                        if (mb.IsSpecialName) {
                                PropertyInfo pi = PropertyExpr.AccessorTable [mb] as PropertyInfo;
                                if (pi != null) {
-                                       // FIXME: This is buggy as properties from this assembly are included as well
+                                       if (TypeManager.LookupDeclSpace (pi.DeclaringType) == null)
+                                               return GetMemberObsoleteAttribute (pi);
+
+                                       return null;
+                               }
+
+                               EventInfo ei = EventExpr.AccessorTable [mb] as EventInfo;
+                               if (ei != null) {
+                                       if (TypeManager.LookupDeclSpace (ei.DeclaringType) == null)
+                                               return GetMemberObsoleteAttribute (ei);
+
                                        return null;
-                                       //return GetMemberObsoleteAttribute (pi);
                                }
                        }
 
index 89c5e4ae6fdc759ab9da03ddff208151c3b7729f..1d7cf40b04c11cf7bc527df8948a32bdb0af37f1 100644 (file)
@@ -3524,6 +3524,8 @@ namespace Mono.CSharp {
 
                bool is_static;
                MethodInfo add_accessor, remove_accessor;
+
+               internal static PtrHashtable AccessorTable = new PtrHashtable (); 
                
                public EventExpr (EventInfo ei, Location loc)
                {
@@ -3533,6 +3535,10 @@ namespace Mono.CSharp {
 
                        add_accessor = TypeManager.GetAddMethod (ei);
                        remove_accessor = TypeManager.GetRemoveMethod (ei);
+                       if (add_accessor != null)
+                               AccessorTable [add_accessor] = ei;
+                       if (remove_accessor != null)
+                               AccessorTable [remove_accessor] = ei;
                        
                        if (add_accessor.IsStatic || remove_accessor.IsStatic)
                                is_static = true;