[Mono-bugs] [Bug 35413][Nor] New - MCS doesn't support attribute targets

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
10 Dec 2002 21:27:24 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jonpryor@vt.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=35413

--- shadow/35413	Tue Dec 10 16:27:24 2002
+++ shadow/35413.tmp.12993	Tue Dec 10 16:27:24 2002
@@ -0,0 +1,82 @@
+Bug#: 35413
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jonpryor@vt.edu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MCS doesn't support attribute targets
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+mcs doesn't support "attribute targets" (See ECMA-334, Section 24.2, page
+312, PDF page 326 -- for my version, anyway, dated October 27, 2002).
+
+In particular, it doesn't support the "return:" attribute target, and
+possibly others.
+
+For example, consider the following code:
+
+        using System;
+
+        class FooAttribute : Attribute {
+        }
+
+        delegate void BarDelegate ();
+
+        [type: Foo]
+        class Test {
+          [field: Foo]
+          int a;
+
+          [event: Foo]
+          event BarDelegate;
+
+          [method: Foo]
+          [return: Foo]
+          void Method ([param: Foo] int a);
+
+          [property: Foo]
+          bool Property {
+            get {return false;}
+          }
+
+          public static void Main () {
+          }
+        }
+
+This code attempts to use all the attribute targets that the standard
+specifies.  When I try to compile under MCS, I get a parser error:
+
+        syntax error, expecting OPEN_BRACKET STAR IDENTIFIER
+        at.cs (14,18), Token: SEMICOLON   : Parsing error
+        Mono.CSharp.yyParser.yyException: irrecoverable syntax error
+        in <0x006fa> 00 Mono.CSharp.CSharpParser:yyparse
+                (Mono.CSharp.yyParser.yyInput)
+        in <0x0006f> 00 Mono.CSharp.CSharpParser:parse ()
+
+        error CS5001: Program at.exe does not have an entry point defined
+        Compilation failed: 1 error(s), 0 warnings
+
+Note: I have not tried to compile the above code under CSC.EXE, so I do not
+know if the code is semantically correct (though it seems a fair guess that
+it is).  It is syntactically correct, at least according to the grammar
+specified in the C# standard.
+
+I think most of the attribute targets are provided for disambiguation. 
+However, the "return" target is also visible through Reflection; the
+attribute specified on the "return" target is available through
+System.Reflection.MethodInfo.ReturnTypeCustomAttributes.
+
+This will need to be fixed for full C# language support.