-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
cfe-optimizationsCFE optimizationsCFE optimizationslegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.
Description
I think returning .insufficient here is too conservative:
sdk/pkg/kernel/lib/type_environment.dart
Lines 296 to 299 in 7349ef5
| if (!IsSubtypeOf.basedSolelyOnNullabilities( | |
| expressionStaticType, checkTargetType) | |
| .inMode(subtypeCheckMode)) { | |
| return TypeShapeCheckSufficiency.insufficient; |
(I assume SubtypeCheckMode.withNullabilities throughout this issue.)
Suppose we have
class Base<T> {}
class C<T> extends Base<T> {}and suppose the type test in question is e is C<T> where e has static type Base<T>?. Based solely on nullabilities, Base<T>? is not a subtype of C<T>, so we get .insufficient and must do the full type test. However, it seems that .interfaceShape should suffice here, since e is C would still correctly handle the case where e is null.
Metadata
Metadata
Assignees
Labels
cfe-optimizationsCFE optimizationsCFE optimizationslegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.