2002-08-07 Martin Baulig <martin@gnome.org>
authorMartin Baulig <martin@novell.com>
Tue, 6 Aug 2002 22:12:19 +0000 (22:12 -0000)
committerMartin Baulig <martin@novell.com>
Tue, 6 Aug 2002 22:12:19 +0000 (22:12 -0000)
* test-158.cs: New test for bug #22119.

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

mcs/tests/ChangeLog
mcs/tests/README.tests
mcs/tests/makefile
mcs/tests/test-157.cs
mcs/tests/test-158.cs [new file with mode: 0644]
mcs/tests/test-159.cs [new file with mode: 0644]

index 991e292082ca7081ae97034539ee30e0360ae50d..683174a5d09070d476d686a16c78cec380adf596 100755 (executable)
@@ -1,3 +1,7 @@
+2002-08-07  Martin Baulig  <martin@gnome.org>
+
+       * test-158.cs: New test for bug #22119.
+
 2002-08-05  Martin Baulig  <martin@gnome.org>
 
        * test-157.cs: Formerly known as ../errors/cs-20.cs
index 4bcb3aa8305e7778f415aacb958e91d093106e20..5b806927a073095c1575eaa20a8e1930675fbf9f 100644 (file)
@@ -31,7 +31,7 @@ Test cases listed by Category:
 
 * Member Access & Simple Names
 
-  test-151.cs
+  test-151.cs test-159.cs
 
 * Invocation
 
@@ -47,7 +47,7 @@ Test cases listed by Category:
 
 * Attributes
 
-  test-157.cs
+  test-157.cs test-158.cs
 
 Test cases listed by Number:
 ============================
@@ -106,6 +106,14 @@ test-157.cs
 -----------
 Attributes.
 
+test-158.cs
+-----------
+Attributes.
+
+test-159.cs
+-----------
+SimpleNameLookup: Cast to `A.Iface' type when there's a parameter called `A'.
+
 verify-1.cs
 -----------
 Test whether we do not jump out of the method in a Try/Finally block.
index 8d925bc99a611c21d821cdc69da5298558630f0f..c5b4c53fa79191656771f1ca0439e4d456f67f9e 100755 (executable)
@@ -24,7 +24,7 @@ TEST_SOURCES = \
        test-121          test-123          test-125 test-126 test-127 test-128 test-129 test-130 \
        test-131                   test-134 test-135 test-136 test-137 test-138 test-139 test-140 \
        test-141 test-142 test-143 test-144 test-145 test-146 test-147 test-148 test-149 test-150 \
-                         test-153 test-154 test-155 test-156 test-157
+                         test-153 test-154 test-155 test-156 test-157 test-158 test-159
 
 UNSAFE_SOURCES = \
        unsafe-1 unsafe-2 unsafe-3 test-58.cs
index 10dabe30e1ac14d79b2ba818828863e641e5637e..a01ffc79c1c78404569e8c3ade48fc50be605489 100644 (file)
@@ -1,6 +1,3 @@
-// cs-20.cs : Cannot find attribute type My (maybe you forgot to set the usage using the AttributeUsage attribute ?).
-// Line : 18
-
 using System;
 using System.Reflection;
 
@@ -16,7 +13,6 @@ namespace Test {
        }
        
        [My("testclass")]
-
        public class Test {
                static public int Main() {
                        System.Reflection.MemberInfo info = typeof (Test);
diff --git a/mcs/tests/test-158.cs b/mcs/tests/test-158.cs
new file mode 100644 (file)
index 0000000..1de8e5d
--- /dev/null
@@ -0,0 +1,28 @@
+using System;
+using System.Reflection;
+
+[AttributeUsage (AttributeTargets.All)]
+public class My : Attribute {
+       public object o;
+
+       public My (object o) {
+               this.o = o;
+       }
+       
+       [My(TypeCode.Empty)]
+       public class Test {
+               static public int Main() {
+                       System.Reflection.MemberInfo info = typeof (Test);
+                       object[] attributes = info.GetCustomAttributes (false);
+                       for (int i = 0; i < attributes.Length; i ++) {
+                               System.Console.WriteLine(attributes[i]);
+                       }
+                       if (attributes.Length != 1)
+                               return 1;
+                       My attr = (My) attributes [0];
+                       if (attr.o != TypeCode.Empty)
+                               return 2;
+                       return 0;
+               }
+       }
+}
diff --git a/mcs/tests/test-159.cs b/mcs/tests/test-159.cs
new file mode 100644 (file)
index 0000000..d3d9f10
--- /dev/null
@@ -0,0 +1,15 @@
+using System;
+namespace A {
+        public class Iface {
+                void bah() {}
+        }
+        class my {
+                A.Iface b;
+                void doit (Object A) {
+                        b = (A.Iface)A;
+                }
+                public static int Main () {
+                        return 0;
+                }
+        }
+}