mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:49:47 +00:00
Update "why not promoted" language tests with analyzer expectations.
This is possible now that the test runner uses the analyzer's new JSON output format. Bug: https://github.com/dart-lang/sdk/issues/44898 Change-Id: Ib38e52e0c6a8f73074ef702b8a8b18bd9b128743 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194014 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
parent
7f009e528d
commit
61747ae4d3
|
@ -8,8 +8,9 @@
|
|||
|
||||
class C1 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 29] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 47] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(int i) {}
|
||||
}
|
||||
|
||||
|
@ -17,15 +18,16 @@ required_unnamed(C1 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 29] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 1] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 47] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C2 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 38] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 48] 'bad' refers to a property so it couldn't be promoted.
|
||||
f([int i = 0]) {}
|
||||
}
|
||||
|
||||
|
@ -33,15 +35,16 @@ optional_unnamed(C2 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 38] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 2] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 48] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C3 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 3] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 6] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 49] 'bad' refers to a property so it couldn't be promoted.
|
||||
f({required int i}) {}
|
||||
}
|
||||
|
||||
|
@ -49,15 +52,16 @@ required_named(C3 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(i: c.bad);
|
||||
// ^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 3] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 49] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C4 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 4] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 16] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 50] 'bad' refers to a property so it couldn't be promoted.
|
||||
f({int i = 0}) {}
|
||||
}
|
||||
|
||||
|
@ -65,15 +69,16 @@ optional_named(C4 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(i: c.bad);
|
||||
// ^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 16] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 4] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 50] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C5 {
|
||||
List<int>? bad;
|
||||
// ^
|
||||
// [context 5] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 33] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 51] 'bad' refers to a property so it couldn't be promoted.
|
||||
f<T>(List<T> x) {}
|
||||
}
|
||||
|
||||
|
@ -81,15 +86,16 @@ type_inferred(C5 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 33] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 5] The argument type 'List<int>?' can't be assigned to the parameter type 'List<int>' because 'List<int>?' is nullable and 'List<int>' isn't.
|
||||
// [cfe 51] The argument type 'List<int>?' can't be assigned to the parameter type 'List<int>' because 'List<int>?' is nullable and 'List<int>' isn't.
|
||||
}
|
||||
|
||||
class C6 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 6] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 21] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 52] 'bad' refers to a property so it couldn't be promoted.
|
||||
C6(int i);
|
||||
}
|
||||
|
||||
|
@ -97,15 +103,16 @@ C6? constructor_with_implicit_new(C6 c) {
|
|||
if (c.bad == null) return null;
|
||||
return C6(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 21] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 6] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 52] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C7 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 7] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 42] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 53] 'bad' refers to a property so it couldn't be promoted.
|
||||
C7(int i);
|
||||
}
|
||||
|
||||
|
@ -113,24 +120,25 @@ C7? constructor_with_explicit_new(C7 c) {
|
|||
if (c.bad == null) return null;
|
||||
return new C7(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 42] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 7] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 53] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C8 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 8] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 13] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 54] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
userDefinableBinaryOpRhs(C8 c) {
|
||||
if (c.bad == null) return;
|
||||
1 + c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 13] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 8] A value of type 'int?' can't be assigned to a variable of type 'num' because 'int?' is nullable and 'num' isn't.
|
||||
// [cfe 54] A value of type 'int?' can't be assigned to a variable of type 'num' because 'int?' is nullable and 'num' isn't.
|
||||
}
|
||||
|
||||
class C9 {
|
||||
|
@ -171,9 +179,11 @@ equalRhs(C10 c, D10 d) {
|
|||
|
||||
class C11 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 9] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 10] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 30] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 46] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 55] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 56] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(bool b) {}
|
||||
}
|
||||
|
||||
|
@ -181,21 +191,23 @@ andOperand(C11 c, bool b) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad && b);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 46] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 9] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 55] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
c.f(b && c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 30] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 10] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 56] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C12 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 11] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 12] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 27] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 36] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 57] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 58] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(bool b) {}
|
||||
}
|
||||
|
||||
|
@ -203,48 +215,51 @@ orOperand(C12 c, bool b) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad || b);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 27] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 11] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 57] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
c.f(b || c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 36] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 12] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 58] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C13 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 13] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 40] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 59] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
assertStatementCondition(C13 c) {
|
||||
if (c.bad == null) return;
|
||||
assert(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 40] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 13] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 59] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C14 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 14] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 60] 'bad' refers to a property so it couldn't be promoted.
|
||||
C14.assertInitializerCondition(C14 c)
|
||||
: bad = c.bad!,
|
||||
assert(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 14] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 60] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C15 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 15] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 28] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 61] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(bool b) {}
|
||||
}
|
||||
|
||||
|
@ -252,48 +267,53 @@ notOperand(C15 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(!c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 28] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 15] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 61] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C16 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 16] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 17] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 18] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 19] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 22] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 24] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 25] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 32] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 62] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 63] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 64] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 65] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
forLoopCondition(C16 c) {
|
||||
if (c.bad == null) return;
|
||||
for (; c.bad;) {}
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 32] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 16] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 62] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
[for (; c.bad;) null];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 25] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 17] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 63] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
({for (; c.bad;) null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 22] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 18] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 64] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
({for (; c.bad;) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 24] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 19] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 65] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C17 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 20] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 10] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 66] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(int i) {}
|
||||
}
|
||||
|
||||
|
@ -301,189 +321,207 @@ conditionalExpressionCondition(C17 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad ? 1 : 2);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 10] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 20] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 66] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C18 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 21] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 26] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 67] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
doLoopCondition(C18 c) {
|
||||
if (c.bad == null) return;
|
||||
do {} while (c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 26] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 21] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 67] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C19 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 22] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 23] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 24] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 25] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 5] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 9] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 12] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 39] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 68] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 69] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 70] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 71] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
ifCondition(C19 c) {
|
||||
if (c.bad == null) return;
|
||||
if (c.bad) {}
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 22] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 68] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
[if (c.bad) null];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 12] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 23] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 69] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
({if (c.bad) null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 9] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 24] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 70] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
({if (c.bad) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 39] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 25] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 71] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C20 {
|
||||
bool? bad;
|
||||
// ^
|
||||
// [context 26] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 3] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 72] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
whileCondition(C20 c) {
|
||||
if (c.bad == null) return;
|
||||
while (c.bad) {}
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 26] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 72] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
}
|
||||
|
||||
class C21 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 27] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 17] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 73] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
assignmentRhs(C21 c, int i) {
|
||||
if (c.bad == null) return;
|
||||
i = c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 17] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 27] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 73] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C22 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 28] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 18] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 74] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
variableInitializer(C22 c) {
|
||||
if (c.bad == null) return;
|
||||
int i = c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 18] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 28] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 74] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C23 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 29] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 20] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 75] 'bad' refers to a property so it couldn't be promoted.
|
||||
final int x;
|
||||
final int y;
|
||||
C23.constructorInitializer(C23 c)
|
||||
: x = c.bad!,
|
||||
y = c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE
|
||||
// [analyzer 20] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 29] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 75] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C24 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 30] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 31] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 32] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 33] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 14] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 41] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 43] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 44] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 76] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 77] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 78] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 79] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
forVariableInitializer(C24 c) {
|
||||
if (c.bad == null) return;
|
||||
for (int i = c.bad; false;) {}
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 44] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 30] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 76] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
[for (int i = c.bad; false;) null];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 43] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 31] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 77] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
({for (int i = c.bad; false;) null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 41] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 32] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 78] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
({for (int i = c.bad; false;) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 14] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 33] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 79] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C25 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 34] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 35] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 36] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 37] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 4] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 8] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 11] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 80] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 81] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 82] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 83] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
forAssignmentInitializer(C25 c, int i) {
|
||||
if (c.bad == null) return;
|
||||
for (i = c.bad; false;) {}
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 34] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 80] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
[for (i = c.bad; false;) null];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 35] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 81] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
({for (i = c.bad; false;) null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 11] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 36] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 82] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
({for (i = c.bad; false;) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 8] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 37] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 83] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C26 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 38] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 45] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 84] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
compoundAssignmentRhs(C26 c) {
|
||||
|
@ -491,43 +529,47 @@ compoundAssignmentRhs(C26 c) {
|
|||
if (c.bad == null) return;
|
||||
n += c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 45] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 38] A value of type 'int?' can't be assigned to a variable of type 'num' because 'int?' is nullable and 'num' isn't.
|
||||
// [cfe 84] A value of type 'int?' can't be assigned to a variable of type 'num' because 'int?' is nullable and 'num' isn't.
|
||||
}
|
||||
|
||||
class C27 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 39] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 7] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 85] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
indexGet(C27 c, List<int> values) {
|
||||
if (c.bad == null) return;
|
||||
values[c.bad];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 7] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 39] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 85] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C28 {
|
||||
int? bad;
|
||||
// ^
|
||||
// [context 40] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 23] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 86] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
indexSet(C28 c, List<int> values) {
|
||||
if (c.bad == null) return;
|
||||
values[c.bad] = 0;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 23] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 40] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 86] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C29 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 19] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
}
|
||||
|
||||
indexSetCompound(C29 c, List<int> values) {
|
||||
|
@ -535,13 +577,15 @@ indexSetCompound(C29 c, List<int> values) {
|
|||
if (c.bad == null) return;
|
||||
values[c.bad] += 1;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 19] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C30 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 37] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
}
|
||||
|
||||
indexSetIfNull(C30 c, List<int?> values) {
|
||||
|
@ -549,13 +593,16 @@ indexSetIfNull(C30 c, List<int?> values) {
|
|||
if (c.bad == null) return;
|
||||
values[c.bad] ??= 1;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 37] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C31 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 31] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 35] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
}
|
||||
|
||||
indexSetPreIncDec(C31 c, List<int> values) {
|
||||
|
@ -563,18 +610,21 @@ indexSetPreIncDec(C31 c, List<int> values) {
|
|||
if (c.bad == null) return;
|
||||
++values[c.bad];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 31] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
--values[c.bad];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 35] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C32 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 15] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 34] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
}
|
||||
|
||||
indexSetPostIncDec(C32 c, List<int> values) {
|
||||
|
@ -582,12 +632,12 @@ indexSetPostIncDec(C32 c, List<int> values) {
|
|||
if (c.bad == null) return;
|
||||
values[c.bad]++;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 34] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
values[c.bad]--;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 15] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
|
|
@ -10,61 +10,62 @@ abstract class C {
|
|||
direct_assignment(int? i, int? j) {
|
||||
if (i == null) return;
|
||||
i = j;
|
||||
//^
|
||||
// [context 1] Variable 'i' could not be promoted due to an assignment.
|
||||
//^^^^^
|
||||
// [context 6] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 10] Variable 'i' could not be promoted due to an assignment.
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
//^
|
||||
// [cfe 1] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
compound_assignment(C? c, int i) {
|
||||
if (c == null) return;
|
||||
c += i;
|
||||
//^
|
||||
// [context 2] Variable 'c' could not be promoted due to an assignment.
|
||||
//^^^^^^
|
||||
// [context 7] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 11] Variable 'c' could not be promoted due to an assignment.
|
||||
c.cProperty;
|
||||
// ^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
//^
|
||||
// [cfe 2] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null.
|
||||
// [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 11] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null.
|
||||
}
|
||||
|
||||
via_postfix_op(C? c) {
|
||||
if (c == null) return;
|
||||
c++;
|
||||
//^
|
||||
// [context 3] Variable 'c' could not be promoted due to an assignment.
|
||||
//^^^
|
||||
// [context 4] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 12] Variable 'c' could not be promoted due to an assignment.
|
||||
c.cProperty;
|
||||
// ^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
//^
|
||||
// [cfe 3] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null.
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 12] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null.
|
||||
}
|
||||
|
||||
via_prefix_op(C? c) {
|
||||
if (c == null) return;
|
||||
++c;
|
||||
//^^^
|
||||
// [context 9] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
//^
|
||||
// [context 4] Variable 'c' could not be promoted due to an assignment.
|
||||
// [context 13] Variable 'c' could not be promoted due to an assignment.
|
||||
c.cProperty;
|
||||
// ^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
//^
|
||||
// [cfe 4] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null.
|
||||
// [analyzer 9] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 13] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null.
|
||||
}
|
||||
|
||||
via_for_each_statement(int? i, List<int?> list) {
|
||||
if (i == null) return;
|
||||
for (i in list) {
|
||||
// ^
|
||||
// [context 5] Variable 'i' could not be promoted due to an assignment.
|
||||
// [context 3] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 14] Variable 'i' could not be promoted due to an assignment.
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
//^
|
||||
// [cfe 5] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 14] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,42 +73,42 @@ via_for_each_list_element(int? i, List<int?> list) {
|
|||
if (i == null) return;
|
||||
[for (i in list) i.isEven];
|
||||
// ^
|
||||
// [context 6] Variable 'i' could not be promoted due to an assignment.
|
||||
// [context 8] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 15] Variable 'i' could not be promoted due to an assignment.
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 6] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 15] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
via_for_each_set_element(int? i, List<int?> list) {
|
||||
if (i == null) return;
|
||||
({for (i in list) i.isEven});
|
||||
// ^
|
||||
// [context 7] Variable 'i' could not be promoted due to an assignment.
|
||||
// [context 1] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 16] Variable 'i' could not be promoted due to an assignment.
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 16] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
via_for_each_map_key(int? i, List<int?> list) {
|
||||
if (i == null) return;
|
||||
({for (i in list) i.isEven: null});
|
||||
// ^
|
||||
// [context 8] Variable 'i' could not be promoted due to an assignment.
|
||||
// [context 2] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 17] Variable 'i' could not be promoted due to an assignment.
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 17] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
via_for_each_map_value(int? i, List<int?> list) {
|
||||
if (i == null) return;
|
||||
({for (i in list) null: i.isEven});
|
||||
// ^
|
||||
// [context 9] Variable 'i' could not be promoted due to an assignment.
|
||||
// [context 5] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 18] Variable 'i' could not be promoted due to an assignment.
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 18] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
|
|
@ -7,38 +7,40 @@ class C {
|
|||
if (this.i == null) return;
|
||||
this.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 1] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 6] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_property_via_explicit_this_parenthesized() {
|
||||
if ((this).i == null) return;
|
||||
(this).i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 2] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_property_by_implicit_this() {
|
||||
if (i == null) return;
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
||||
extension E on C {
|
||||
int? get i => null;
|
||||
// ^
|
||||
// [context 1] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 2] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 1] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 2] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 6] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 7] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 8] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 9] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 10] 'i' refers to a property so it couldn't be promoted.
|
||||
int? get j => null;
|
||||
}
|
||||
|
||||
|
@ -47,9 +49,8 @@ class D extends C {
|
|||
if (i == null) return;
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 4] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,9 +58,8 @@ get_property_via_prefixed_identifier(C c) {
|
|||
if (c.i == null) return;
|
||||
c.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 5] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_property_via_prefixed_identifier_mismatched_target(C c1, C c2) {
|
||||
|
@ -69,7 +69,6 @@ get_property_via_prefixed_identifier_mismatched_target(C c1, C c2) {
|
|||
c2.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
|
@ -80,6 +79,5 @@ get_property_via_prefixed_identifier_mismatched_property(C c) {
|
|||
c.j.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
|
|
@ -5,39 +5,42 @@
|
|||
class C {
|
||||
int? i;
|
||||
// ^
|
||||
// [context 1] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 2] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 6] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 1] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 2] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 6] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 7] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 8] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 9] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 10] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 11] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 12] 'i' refers to a property so it couldn't be promoted.
|
||||
int? j;
|
||||
|
||||
get_field_via_explicit_this() {
|
||||
if (this.i == null) return;
|
||||
this.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 1] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_field_via_explicit_this_parenthesized() {
|
||||
if ((this).i == null) return;
|
||||
(this).i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 2] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_field_by_implicit_this() {
|
||||
if (i == null) return;
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,18 +49,16 @@ class D extends C {
|
|||
if (super.i == null) return;
|
||||
super.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 4] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_field_by_implicit_super() {
|
||||
if (i == null) return;
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 5] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 11] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,9 +66,8 @@ get_field_via_prefixed_identifier(C c) {
|
|||
if (c.i == null) return;
|
||||
c.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 6] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 12] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_field_via_prefixed_identifier_mismatched_target(C c1, C c2) {
|
||||
|
@ -77,7 +77,6 @@ get_field_via_prefixed_identifier_mismatched_target(C c1, C c2) {
|
|||
c2.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
|
@ -88,6 +87,5 @@ get_field_via_prefixed_identifier_mismatched_property(C c) {
|
|||
c.j.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
|
|
@ -9,85 +9,93 @@
|
|||
|
||||
class C1 {
|
||||
List<int>? bad;
|
||||
// ^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 3] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 4] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 5] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 6] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 7] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 8] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 3] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 4] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 5] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 6] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 7] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 8] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 9] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 10] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 11] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 12] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 13] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 14] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 15] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 16] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
forStatement(C1 c) {
|
||||
if (c.bad == null) return;
|
||||
for (var x in c.bad) {}
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 1] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 9] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
||||
forElementInList(C1 c) {
|
||||
if (c.bad == null) return;
|
||||
[for (var x in c.bad) null];
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 2] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 10] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
||||
forElementInSet(C1 c) {
|
||||
if (c.bad == null) return;
|
||||
<dynamic>{for (var x in c.bad) null};
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 3] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 11] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
||||
forElementInMap(C1 c) {
|
||||
if (c.bad == null) return;
|
||||
<dynamic, dynamic>{for (var x in c.bad) null: null};
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 4] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 12] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
||||
forElementInAmbiguousSet_resolvableDuringParsing(C1 c) {
|
||||
if (c.bad == null) return;
|
||||
({for (var x in c.bad) null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 5] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 13] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
||||
forElementInAmbiguousMap_resolvableDuringParsing(C1 c) {
|
||||
if (c.bad == null) return;
|
||||
({for (var x in c.bad) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 6] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 14] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
||||
forElementInAmbiguousSet_notResolvableDuringParsing(C1 c, List list) {
|
||||
if (c.bad == null) return;
|
||||
({for (var x in c.bad) ...list});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 7] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 15] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
||||
forElementInAmbiguousMap_notResolvableDuringParsing(C1 c, Map map) {
|
||||
if (c.bad == null) return;
|
||||
({for (var x in c.bad) ...map});
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 8] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 16] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
|
|
@ -9,16 +9,17 @@
|
|||
|
||||
class C1 {
|
||||
List<int>? bad;
|
||||
// ^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
test(C1 c) sync* {
|
||||
if (c.bad == null) return;
|
||||
yield* c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer] COMPILE_TIME_ERROR.YIELD_OF_INVALID_TYPE
|
||||
// ^
|
||||
// [cfe 1] A value of type 'List<int>?' can't be assigned to a variable of type 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// [cfe 2] A value of type 'List<int>?' can't be assigned to a variable of type 'Iterable<dynamic>' because 'List<int>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
class C1 {
|
||||
C2? bad;
|
||||
// ^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 3] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 7] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
class C2 {
|
||||
|
@ -20,16 +21,17 @@ instance_method_invocation(C1 c) {
|
|||
if (c.bad == null) return;
|
||||
c.bad();
|
||||
//^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 1] Can't use an expression of type 'C2?' as a function because it's potentially null.
|
||||
// [cfe 7] Can't use an expression of type 'C2?' as a function because it's potentially null.
|
||||
}
|
||||
|
||||
class C3 {
|
||||
C4? ok;
|
||||
C5? bad;
|
||||
// ^
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 1] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 8] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
class C4 {}
|
||||
|
@ -50,15 +52,16 @@ extension_invocation_method(C3 c) {
|
|||
if (c.bad == null) return;
|
||||
c.bad();
|
||||
//^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 2] Can't use an expression of type 'C5?' as a function because it's potentially null.
|
||||
// [cfe 8] Can't use an expression of type 'C5?' as a function because it's potentially null.
|
||||
}
|
||||
|
||||
class C6 {
|
||||
C7? bad;
|
||||
// ^
|
||||
// [context 3] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 6] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 9] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
class C7 {
|
||||
|
@ -70,16 +73,17 @@ instance_getter_invocation(C6 c) {
|
|||
c.bad();
|
||||
//^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 3] Can't use an expression of type 'C7?' as a function because it's potentially null.
|
||||
// [cfe 9] Can't use an expression of type 'C7?' as a function because it's potentially null.
|
||||
}
|
||||
|
||||
class C8 {
|
||||
C9? ok;
|
||||
C10? bad;
|
||||
// ^
|
||||
// [context 4] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 4] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 10] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
class C9 {}
|
||||
|
@ -104,30 +108,32 @@ extension_invocation_getter(C8 c) {
|
|||
if (c.bad == null) return;
|
||||
c.bad();
|
||||
//^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 4] Can't use an expression of type 'C10?' as a function because it's potentially null.
|
||||
// [cfe 10] Can't use an expression of type 'C10?' as a function because it's potentially null.
|
||||
}
|
||||
|
||||
class C11 {
|
||||
void Function()? bad;
|
||||
// ^
|
||||
// [context 5] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 5] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 11] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
function_invocation(C11 c) {
|
||||
if (c.bad == null) return;
|
||||
c.bad();
|
||||
//^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 5] Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
||||
// [cfe 11] Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
||||
}
|
||||
|
||||
class C12 {
|
||||
C13? bad;
|
||||
// ^
|
||||
// [context 6] 'bad' refers to a property so it couldn't be promoted.
|
||||
// ^^^
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 12] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
class C13 {
|
||||
|
@ -141,7 +147,6 @@ instance_field_invocation(C12 c) {
|
|||
// https://github.com/dart-lang/sdk/issues/45552
|
||||
c.bad.foo();
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 6] Can't use an expression of type 'C13?' as a function because it's potentially null.
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 12] Can't use an expression of type 'C13?' as a function because it's potentially null.
|
||||
}
|
||||
|
|
|
@ -9,13 +9,18 @@
|
|||
class C {
|
||||
int? i;
|
||||
// ^
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 6] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 2] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 10] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 11] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 12] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 13] 'i' refers to a property so it couldn't be promoted.
|
||||
void Function()? f;
|
||||
// ^
|
||||
// [context 7] 'f' refers to a property so it couldn't be promoted.
|
||||
// [context 7] 'f' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 14] 'f' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
extension on int {
|
||||
|
@ -31,35 +36,34 @@ extension on int? {
|
|||
property_get_of_variable(int? i, int? j) {
|
||||
if (i == null) return;
|
||||
i = j;
|
||||
//^
|
||||
// [context 1] Variable 'i' could not be promoted due to an assignment.
|
||||
//^^^^^
|
||||
// [context 6] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 8] Variable 'i' could not be promoted due to an assignment.
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 1] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
extension_property_get_of_variable(int? i, int? j) {
|
||||
if (i == null) return;
|
||||
i = j;
|
||||
//^
|
||||
// [context 2] Variable 'i' could not be promoted due to an assignment.
|
||||
//^^^^^
|
||||
// [context 1] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write
|
||||
// [context 9] Variable 'i' could not be promoted due to an assignment.
|
||||
i.propertyOnNullableInt;
|
||||
i.propertyOnNonNullInt;
|
||||
// ^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 2] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 9] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
property_get_of_expression(C c) {
|
||||
if (c.i == null) return;
|
||||
c.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
extension_property_get_of_expression(C c) {
|
||||
|
@ -67,18 +71,16 @@ extension_property_get_of_expression(C c) {
|
|||
c.i.propertyOnNullableInt;
|
||||
c.i.propertyOnNonNullInt;
|
||||
// ^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 4] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 11] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
method_invocation(C c) {
|
||||
if (c.i == null) return;
|
||||
c.i.abs();
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 5] Method 'abs' cannot be called on 'int?' because it is potentially null.
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 12] Method 'abs' cannot be called on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
extension_method_invocation(C c) {
|
||||
|
@ -86,16 +88,14 @@ extension_method_invocation(C c) {
|
|||
c.i.methodOnNullableInt();
|
||||
c.i.methodOnNonNullInt();
|
||||
// ^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 6] Method 'methodOnNonNullInt' cannot be called on 'int?' because it is potentially null.
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 13] Method 'methodOnNonNullInt' cannot be called on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
call_invocation(C c) {
|
||||
if (c.f == null) return;
|
||||
c.f.call();
|
||||
// ^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 7] Method 'call' cannot be called on 'void Function()?' because it is potentially null.
|
||||
// [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 14] Method 'call' cannot be called on 'void Function()?' because it is potentially null.
|
||||
}
|
||||
|
|
|
@ -8,47 +8,63 @@
|
|||
|
||||
class C {
|
||||
List<int>? listQuestion;
|
||||
// ^
|
||||
// [context 1] 'listQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 5] 'listQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 11] 'listQuestion' refers to a property so it couldn't be promoted.
|
||||
// ^^^^^^^^^^^^
|
||||
// [context 7] 'listQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 9] 'listQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 15] 'listQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 17] 'listQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 21] 'listQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 27] 'listQuestion' refers to a property so it couldn't be promoted.
|
||||
Object? objectQuestion;
|
||||
// ^
|
||||
// [context 4] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 8] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 9] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 10] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 14] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 15] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// ^^^^^^^^^^^^^^
|
||||
// [context 1] 'objectQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 6] 'objectQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 10] 'objectQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 11] 'objectQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 12] 'objectQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 16] 'objectQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 20] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 24] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 25] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 26] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 30] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 31] 'objectQuestion' refers to a property so it couldn't be promoted.
|
||||
Set<int>? setQuestion;
|
||||
// ^
|
||||
// [context 2] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 6] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 12] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 16] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
// ^^^^^^^^^^^
|
||||
// [context 4] 'setQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 5] 'setQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 8] 'setQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 14] 'setQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 18] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 22] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 28] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 32] 'setQuestion' refers to a property so it couldn't be promoted.
|
||||
Map<int, int>? mapQuestion;
|
||||
// ^
|
||||
// [context 3] 'mapQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 7] 'mapQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 13] 'mapQuestion' refers to a property so it couldn't be promoted.
|
||||
// ^^^^^^^^^^^
|
||||
// [context 2] 'mapQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 3] 'mapQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 13] 'mapQuestion' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 19] 'mapQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 23] 'mapQuestion' refers to a property so it couldn't be promoted.
|
||||
// [context 29] 'mapQuestion' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
list_from_list_question(C c) {
|
||||
if (c.listQuestion == null) return;
|
||||
return [...c.listQuestion];
|
||||
// ^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 1] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 17] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
list_from_set_question(C c) {
|
||||
if (c.setQuestion == null) return;
|
||||
return [...c.setQuestion];
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 2] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 18] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
list_from_map_question(C c) {
|
||||
|
@ -56,9 +72,9 @@ list_from_map_question(C c) {
|
|||
return [...c.mapQuestion];
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NOT_ITERABLE_SPREAD
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 3] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 19] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe] Unexpected type 'Map<int, int>?' of a spread. Expected 'dynamic' or an Iterable.
|
||||
}
|
||||
|
||||
|
@ -67,9 +83,9 @@ list_from_object_question(C c) {
|
|||
return [...c.objectQuestion];
|
||||
// ^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NOT_ITERABLE_SPREAD
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 16] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 4] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 20] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe] Unexpected type 'Object?' of a spread. Expected 'dynamic' or an Iterable.
|
||||
}
|
||||
|
||||
|
@ -77,27 +93,27 @@ set_from_list_question(C c) {
|
|||
if (c.listQuestion == null) return;
|
||||
return {...c.listQuestion};
|
||||
// ^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 9] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 5] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 21] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
set_from_set_question(C c) {
|
||||
if (c.setQuestion == null) return;
|
||||
return {...c.setQuestion};
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 6] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 22] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
set_from_map_question(C c) {
|
||||
if (c.mapQuestion == null) return;
|
||||
return {...c.mapQuestion};
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 7] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 23] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
set_from_object_question_type_disambiguate_by_entry(C c) {
|
||||
|
@ -106,9 +122,9 @@ set_from_object_question_type_disambiguate_by_entry(C c) {
|
|||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER
|
||||
// ^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 8] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 24] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe] Unexpected type 'Object?' of a spread. Expected 'dynamic' or an Iterable.
|
||||
}
|
||||
|
||||
|
@ -118,9 +134,9 @@ set_from_object_question_type_disambiguate_by_previous_spread(C c) {
|
|||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER
|
||||
// ^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 12] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 9] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map.
|
||||
// [cfe 25] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map.
|
||||
}
|
||||
|
||||
set_from_object_question_type_disambiguate_by_literal_args(C c) {
|
||||
|
@ -128,9 +144,9 @@ set_from_object_question_type_disambiguate_by_literal_args(C c) {
|
|||
return <int>{...c.objectQuestion};
|
||||
// ^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NOT_ITERABLE_SPREAD
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 10] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 26] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe] Unexpected type 'Object?' of a spread. Expected 'dynamic' or an Iterable.
|
||||
}
|
||||
|
||||
|
@ -138,27 +154,27 @@ map_from_list_question(C c) {
|
|||
if (c.listQuestion == null) return;
|
||||
return {...c.listQuestion};
|
||||
// ^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 15] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 11] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 27] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
map_from_set_question(C c) {
|
||||
if (c.setQuestion == null) return;
|
||||
return {...c.setQuestion};
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 14] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 12] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 28] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
map_from_map_question(C c) {
|
||||
if (c.mapQuestion == null) return;
|
||||
return {...c.mapQuestion};
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 13] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 13] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 29] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
}
|
||||
|
||||
map_from_object_question_type_disambiguate_by_key_value_pair(C c) {
|
||||
|
@ -167,9 +183,9 @@ map_from_object_question_type_disambiguate_by_key_value_pair(C c) {
|
|||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER
|
||||
// ^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 10] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 14] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map.
|
||||
// [cfe 30] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map.
|
||||
}
|
||||
|
||||
map_from_object_question_type_disambiguate_by_previous_spread(C c) {
|
||||
|
@ -178,9 +194,9 @@ map_from_object_question_type_disambiguate_by_previous_spread(C c) {
|
|||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER
|
||||
// ^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 11] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 15] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map.
|
||||
// [cfe 31] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map.
|
||||
}
|
||||
|
||||
map_from_set_question_type_disambiguate_by_literal_args(C c) {
|
||||
|
@ -192,8 +208,8 @@ map_from_set_question_type_disambiguate_by_literal_args(C c) {
|
|||
return <int, int>{...c.setQuestion};
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NOT_MAP_SPREAD
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 16] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe 32] An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// [cfe] Unexpected type 'Set<int>?' of a map spread entry. Expected 'dynamic' or a Map.
|
||||
}
|
||||
|
|
|
@ -5,39 +5,42 @@
|
|||
class C {
|
||||
int? get i => null;
|
||||
// ^
|
||||
// [context 1] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 2] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 6] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 1] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 2] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 3] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 4] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 5] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 6] 'i' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 7] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 8] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 9] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 10] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 11] 'i' refers to a property so it couldn't be promoted.
|
||||
// [context 12] 'i' refers to a property so it couldn't be promoted.
|
||||
int? get j => null;
|
||||
|
||||
get_property_via_explicit_this() {
|
||||
if (this.i == null) return;
|
||||
this.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 1] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_property_via_explicit_this_parenthesized() {
|
||||
if ((this).i == null) return;
|
||||
(this).i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 2] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_property_by_implicit_this() {
|
||||
if (i == null) return;
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,18 +49,16 @@ class D extends C {
|
|||
if (super.i == null) return;
|
||||
super.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 4] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_property_by_implicit_super() {
|
||||
if (i == null) return;
|
||||
i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 5] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 11] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,9 +66,8 @@ get_property_via_prefixed_identifier(C c) {
|
|||
if (c.i == null) return;
|
||||
c.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 6] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [cfe 12] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
get_property_via_prefixed_identifier_mismatched_target(C c1, C c2) {
|
||||
|
@ -77,7 +77,6 @@ get_property_via_prefixed_identifier_mismatched_target(C c1, C c2) {
|
|||
c2.i.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
|
@ -88,6 +87,5 @@ get_property_via_prefixed_identifier_mismatched_property(C c) {
|
|||
c.j.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ extension on int? {
|
|||
if (this == null) return;
|
||||
this.isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [context 2] 'this' can't be promoted. See http://dart.dev/go/non-promo-this
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,8 @@ extension on int? {
|
|||
if (this == null) return;
|
||||
isEven;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [context 1] 'this' can't be promoted. See http://dart.dev/go/non-promo-this
|
||||
// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue