-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
The code below produces an error in the analyzer but works without any issue in VM.
class C {
const C();
}
mixin M on C {
static const M instance = MC(); // Analyzer error. The constructor being called isn't a const constructor.
}
class MC = C with M;
main() {
print(M.instance);
}According to the Dart language specification (12.3 Mixin Application) if C has a constant constructor and M declares no instance variables then default constructor of MC is also a constant constructor. So, I believe, that CFE is right here and the analyzer produces a wrong error. Please confirm.
If Sq is a generative const constructor, and MC does not declare any instance variables, Cq is also a const constructor
Dart SDK version: 3.7.0-264.0.dev (dev) (Wed Dec 18 00:02:57 2024 -0800) on "windows_x64"
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)