Namespace attributes affect other namespace declarations (even across files)
Test case:
class Foo.Maman { public void run() { print("Foo\n"); } }
class Bar.Maman { public void run() { print("Bar\n"); } }
[CCode (lower_case_cprefix = "foo_")]
namespace A {
using Foo;
public static void foo() { // Is cnamed "foo_foo" as per this namespace's attribute
new Maman ().run(); // Maman refers to Foo.Maman as per this namespace's using directive
}
}
[CCode (lower_case_cprefix = "bar_")]
namespace A {
using Bar;
public static void bar() { // Is cnamed "foo_bar" as per first namespace's attribute (this namespace's attribute is ignored)
new Maman ().run(); // Maman refers to Bar.Maman as per this namespace's using directive (first namespace's using directive is ignored)
}
}
void main() {
A.foo(); // prints "Foo"
A.bar(); // prints "Bar"
}
I think the [CCode] attribute on the first declaration of namespace A should not affect the declarations in the second declaration of namespace A. This also works across files (second namespace declaration in another file) and thus is most certainly very unexpected to the user.