[Mono-devel-list] Critical Bug... Error in Grammar!

Gaurav Vaish gvaish at adobe.com
Fri Mar 28 06:56:49 EST 2003

    The attached program compiles with mcs, while it should not - no
attributes are allowed at namespace level.

gvaish at MASTER /cygdrive/f/gvaish/projects/csdoc/csdoc/src/tests
$ ../mcs/mcs.exe /t:library test_21.cs
Compilation succeeded

gvaish at MASTER /cygdrive/f/gvaish/projects/csdoc/csdoc/src/tests
$ csc /nologo /target:library test_21.cs
test_21.cs(4,1): error CS1518: Expected class, delegate, enum, interface, or

    This is because of the rule:

<snip file="cs-parser.jay">
    : opt_attributes NAMESPACE qualified_identifier
        Attributes attrs = (Attributes) $1;

        if (attrs != null) {
            foreach (AttributeSection asec in attrs.AttributeSections)
            if (asec.Target == "assembly")
                RootContext.AddGlobalAttributeSection (current_container,

        current_namespace = RootContext.Tree.RecordNamespace
(current_namespace, file, (string) $3);


    ... followed by no proper parsing of the attribute checking - I mean,
the attribute should be at the assembly level to be a valid attribute
("[assembly:AttributeName(...)]"). So,

    if(asec.Target == "assembly")
        RootContext.AddGlobalAttributeSection(current_container, asec);
        Error("Cannot apply non-assembly attribute to a namespace");

    I am unable to open bugzilla for some reasons.. taking too much time to
load! May be someone can file bug on this, and post the bug # on the list.

Happy Hacking,

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_21.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030328/7c87a2a8/attachment.pl 

More information about the Mono-devel-list mailing list