* test-158.cs: New test for bug #22119.
svn path=/trunk/mcs/; revision=6485
+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
* Member Access & Simple Names
- test-151.cs
+ test-151.cs test-159.cs
* Invocation
* Attributes
- test-157.cs
+ test-157.cs test-158.cs
Test cases listed by Number:
============================
-----------
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.
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
-// 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;
}
[My("testclass")]
-
public class Test {
static public int Main() {
System.Reflection.MemberInfo info = typeof (Test);
--- /dev/null
+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;
+ }
+ }
+}
--- /dev/null
+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;
+ }
+ }
+}