Closed
Description
The following weird program is accepted by both the analyzer and the CFE:
class A {
const A(void Function() x);
}
class C<@A(B) T> {
static void B() {}
}
main() {
new C<int>();
}
This seems to contradict the spec, which says "Type parameters are declared in the type parameter scope of a class or function" (15 Generics) and "The constant expression given in an annotation is type checked and evaluated in the scope surrounding the declaration being annotated" (16 Metadata). Together these seems to imply that the reference to B
in @A(B)
should be an error, because there is no declaration of B
in scope.