-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-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
There are a few requirements to triggering this, which explains why it still exists on stable branch (and all the way up to main branch):
class C {
late int f;
C({int? f}) {
this.f = f ?? 7;
}
}
class D extends C {
D({super.f}) {
f .isEven.toString();
}
}- Given this code, there is a compile-time error at
f.isEvenclaiming thatfcould benull. - If you change the statement to start as
f?.isEvenorf!.isEven, then there are warnings thatfcannot benull.
Code requirements:
- super class has field
f. - subclass has nullable super formal parameter,
f. - property is called on
f(.isEven) in ctor body, and a method (.toString()) is called on the property.
A hint: when you Go-to-definition of f in the original code, you are taken to super.f. When you Go-to-definition at f? or f!, you are taken to the super field.
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-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)