-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work oncfe-feature-extension-typesImplement extension types feature in the CFEImplement extension types feature in the CFEfeature-extension-typesImplementation of the extension type featureImplementation of the extension type featurelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.legacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.
Description
[Edit eernstg: See https://github.com/dart-lang/language/issues/3342 as well.]
According to the extension type specification representation variable is subject to promotion. But in the current implementation nor analyzer nor CFE don't promote it. For example, they both report errors below
// SharedOptions=--enable-experiment=inline-class
extension type ET1(int? id) {
void test() {
if (id != null) {
id.isOdd; // Error
}
}
}
extension type ET2<T>(T id) {
void test() {
if (id is int) {
id.isOdd; // Error
}
}
}
main() {
ET1 et1 = ET1(1);
if (et1.id != null) {
et1.id.isEven; // Error
}
ET2<num?> et2 = ET2(2);
if (et2.id != null) {
et2.id.isEven; // Error
}
}
A separate issue for private fields promotion #53439
Tested on the edge SDK (Sept 6, 2023) on Linux 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 oncfe-feature-extension-typesImplement extension types feature in the CFEImplement extension types feature in the CFEfeature-extension-typesImplementation of the extension type featureImplementation of the extension type featurelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.legacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.