It is not an error to have a constructor with the same name as the class #5940
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-not-planned
Closed as we don't intend to take action on the reported issue
P2
A bug or feature request we're likely to work on
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
The specification (as of October 8, 2012) says:
"A constructor name always begins with the name of its immediately enclosing class, and may optionally be followed by a dot and an identifier id. It is a compile-time error if id is the name of a member declared in the immediately enclosing class. It is a compile-time error if the name of a constructor is not a constructor name."
This means that this is not an error:
class C {
C.C();
}
main() {
print(new C.C());
}
I think this should be an error.
The text was updated successfully, but these errors were encountered: