mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:30:32 +00:00
Flow analysis: additional "why not promoted" test cases.
These test cases already work properly, but they weren't previously covered by tests. Bug: https://github.com/dart-lang/sdk/issues/44898 Change-Id: I4fc6506230af203a361631afc542e0db08bd6f27 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196106 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
ba3e7a60e3
commit
b6fbee21d9
|
@ -452,3 +452,26 @@ explicitExtensionInvocation(C33 c) {
|
|||
/*notPromoted(propertyNotPromoted(target: member:C33.bad, type: int?))*/ bad)
|
||||
.f();
|
||||
}
|
||||
|
||||
class C34 {
|
||||
int? bad;
|
||||
C34(int value);
|
||||
}
|
||||
|
||||
class D34 extends C34 {
|
||||
int other;
|
||||
D34(C34 c)
|
||||
: other = c.bad!,
|
||||
super(c.
|
||||
/*notPromoted(propertyNotPromoted(target: member:C34.bad, type: int?))*/ bad);
|
||||
}
|
||||
|
||||
class C35 {
|
||||
int? bad;
|
||||
}
|
||||
|
||||
indexSetRhs(C35 c, List<int> x) {
|
||||
if (c.bad == null) return;
|
||||
x[0] = c.
|
||||
/*notPromoted(propertyNotPromoted(target: member:C35.bad, type: int?))*/ bad;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
class C1 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 22] '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.
|
||||
// [context 21] '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) {}
|
||||
}
|
||||
|
||||
|
@ -18,16 +18,16 @@ required_unnamed(C1 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 22] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 21] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 48] 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 C2 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 39] '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.
|
||||
// [context 43] '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([int i = 0]) {}
|
||||
}
|
||||
|
||||
|
@ -35,16 +35,16 @@ optional_unnamed(C2 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 39] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 43] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 49] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 51] 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 6] '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.
|
||||
// [context 9] '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.
|
||||
f({required int i}) {}
|
||||
}
|
||||
|
||||
|
@ -52,16 +52,16 @@ required_named(C3 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(i: c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 9] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 50] 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 C4 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 15] '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.
|
||||
// [context 17] '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.
|
||||
f({int i = 0}) {}
|
||||
}
|
||||
|
||||
|
@ -69,16 +69,16 @@ optional_named(C4 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(i: c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 15] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 17] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 51] 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 C5 {
|
||||
List<int>? bad;
|
||||
// ^^^
|
||||
// [context 37] '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.
|
||||
// [context 39] '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.
|
||||
f<T>(List<T> x) {}
|
||||
}
|
||||
|
||||
|
@ -86,16 +86,16 @@ type_inferred(C5 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 37] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 39] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 52] 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 54] 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 4] '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.
|
||||
// [context 5] '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.
|
||||
C6(int i);
|
||||
}
|
||||
|
||||
|
@ -103,16 +103,16 @@ C6? constructor_with_implicit_new(C6 c) {
|
|||
if (c.bad == null) return null;
|
||||
return C6(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 53] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 55] 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 25] '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.
|
||||
// [context 56] 'bad' refers to a property so it couldn't be promoted.
|
||||
C7(int i);
|
||||
}
|
||||
|
||||
|
@ -122,23 +122,23 @@ C7? constructor_with_explicit_new(C7 c) {
|
|||
// ^^^^^
|
||||
// [analyzer 25] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 54] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 56] 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 32] '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 35] '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.
|
||||
}
|
||||
|
||||
userDefinableBinaryOpRhs(C8 c) {
|
||||
if (c.bad == null) return;
|
||||
1 + c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer 32] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 35] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 55] A value of type 'int?' can't be assigned to a variable of type 'num' because 'int?' is nullable and 'num' isn't.
|
||||
// [cfe 57] 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 {
|
||||
|
@ -180,10 +180,10 @@ equalRhs(C10 c, D10 d) {
|
|||
class C11 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 13] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 18] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 56] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 57] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 15] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 19] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 58] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 59] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(bool b) {}
|
||||
}
|
||||
|
||||
|
@ -191,23 +191,23 @@ andOperand(C11 c, bool b) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad && b);
|
||||
// ^^^^^
|
||||
// [analyzer 18] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 19] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
c.f(b && c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 13] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 15] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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 C12 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 5] '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 58] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 59] '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 37] '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.
|
||||
// [context 61] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(bool b) {}
|
||||
}
|
||||
|
||||
|
@ -215,51 +215,51 @@ orOperand(C12 c, bool b) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad || b);
|
||||
// ^^^^^
|
||||
// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
c.f(b || c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 36] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 37] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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 C13 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 2] '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.
|
||||
// [context 3] '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.
|
||||
}
|
||||
|
||||
assertStatementCondition(C13 c) {
|
||||
if (c.bad == null) return;
|
||||
assert(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C14 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 8] '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.
|
||||
// [context 10] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 63] 'bad' refers to a property so it couldn't be promoted.
|
||||
C14.assertInitializerCondition(C14 c)
|
||||
: bad = c.bad!,
|
||||
assert(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 10] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C15 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 47] '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 49] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 64] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(bool b) {}
|
||||
}
|
||||
|
||||
|
@ -267,53 +267,53 @@ notOperand(C15 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(!c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 47] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 49] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C16 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 9] '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 12] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 16] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 17] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 19] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [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 20] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 65] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 66] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 67] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 68] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
forLoopCondition(C16 c) {
|
||||
if (c.bad == null) return;
|
||||
for (; c.bad;) {}
|
||||
// ^^^^^
|
||||
// [analyzer 9] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 12] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
[for (; c.bad;) null];
|
||||
// ^^^^^
|
||||
// [analyzer 17] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 20] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
({for (; c.bad;) null});
|
||||
// ^^^^^
|
||||
// [analyzer 19] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
({for (; c.bad;) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer 16] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
({for (; c.bad;) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer 11] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C17 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 46] '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.
|
||||
// [context 33] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 69] 'bad' refers to a property so it couldn't be promoted.
|
||||
f(int i) {}
|
||||
}
|
||||
|
||||
|
@ -321,38 +321,38 @@ conditionalExpressionCondition(C17 c) {
|
|||
if (c.bad == null) return;
|
||||
c.f(c.bad ? 1 : 2);
|
||||
// ^^^^^
|
||||
// [analyzer 46] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 33] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C18 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 7] '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 8] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 70] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
doLoopCondition(C18 c) {
|
||||
if (c.bad == null) return;
|
||||
do {} while (c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C19 {
|
||||
bool? bad;
|
||||
// ^^^
|
||||
// [context 11] '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 13] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 23] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 28] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [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 30] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 71] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 72] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 73] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 74] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
ifCondition(C19 c) {
|
||||
|
@ -361,167 +361,167 @@ ifCondition(C19 c) {
|
|||
// ^^^^^
|
||||
// [analyzer 23] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
[if (c.bad) null];
|
||||
// ^^^^^
|
||||
// [analyzer 28] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 30] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
({if (c.bad) null});
|
||||
// ^^^^^
|
||||
// [analyzer 11] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 28] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [cfe 73] 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 12] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 13] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [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.
|
||||
// [cfe 74] 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 21] '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.
|
||||
// [context 22] '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.
|
||||
}
|
||||
|
||||
whileCondition(C20 c) {
|
||||
if (c.bad == null) return;
|
||||
while (c.bad) {}
|
||||
// ^^^^^
|
||||
// [analyzer 21] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// [analyzer 22] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
|
||||
// ^
|
||||
// [cfe 73] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
|
||||
// [cfe 75] 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 45] '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.
|
||||
// [context 46] '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.
|
||||
}
|
||||
|
||||
assignmentRhs(C21 c, int i) {
|
||||
if (c.bad == null) return;
|
||||
i = c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer 45] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 46] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C22 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 43] '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.
|
||||
// [context 44] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 77] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
variableInitializer(C22 c) {
|
||||
if (c.bad == null) return;
|
||||
int i = c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer 43] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 44] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C23 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 24] '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 26] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 78] '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 24] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE
|
||||
// [analyzer 26] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C24 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 3] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 30] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 33] '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 34] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [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 36] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 38] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 79] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [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.
|
||||
}
|
||||
|
||||
forVariableInitializer(C24 c) {
|
||||
if (c.bad == null) return;
|
||||
for (int i = c.bad; false;) {}
|
||||
// ^^^^^
|
||||
// [analyzer 34] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 36] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
[for (int i = c.bad; false;) null];
|
||||
// ^^^^^
|
||||
// [analyzer 33] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 38] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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 (int i = c.bad; false;) null});
|
||||
// ^^^^^
|
||||
// [analyzer 30] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 34] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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 (int i = c.bad; false;) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer 3] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 4] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
}
|
||||
|
||||
class C25 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 35] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 31] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 40] '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 44] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [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 45] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 83] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 84] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 85] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 86] '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 35] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 31] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
[for (i = c.bad; false;) null];
|
||||
// ^^^^^
|
||||
// [analyzer 44] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [analyzer 45] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [cfe 84] 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 40] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [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.
|
||||
// [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.
|
||||
({for (i = c.bad; false;) null: null});
|
||||
// ^^^^^
|
||||
// [analyzer 41] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 84] 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 C26 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 26] '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.
|
||||
// [context 27] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 87] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
compoundAssignmentRhs(C26 c) {
|
||||
|
@ -529,119 +529,119 @@ compoundAssignmentRhs(C26 c) {
|
|||
if (c.bad == null) return;
|
||||
n += c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer 26] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 27] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 85] A value of type 'int?' can't be assigned to a variable of type 'num' because 'int?' is nullable and 'num' isn't.
|
||||
// [cfe 87] 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 38] '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.
|
||||
// [context 42] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 88] '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 38] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 42] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [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.
|
||||
// [cfe 88] 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 31] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 87] '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 89] '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 31] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 7] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 87] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 89] 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 14] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 88] '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 90] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
indexSetCompound(C29 c, List<int> values) {
|
||||
if (c.bad == null) return;
|
||||
values[c.bad] += 1;
|
||||
// ^^^^^
|
||||
// [analyzer 14] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 18] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 88] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 90] 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 27] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 89] '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 91] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
indexSetIfNull(C30 c, List<int?> values) {
|
||||
if (c.bad == null) return;
|
||||
values[c.bad] ??= 1;
|
||||
// ^^^^^
|
||||
// [analyzer 27] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 29] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 89] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 91] 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 1] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 20] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 90] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 91] '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 92] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 93] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
indexSetPreIncDec(C31 c, List<int> values) {
|
||||
if (c.bad == null) return;
|
||||
++values[c.bad];
|
||||
// ^^^^^
|
||||
// [analyzer 20] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 14] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 90] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 92] 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 1] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 91] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 93] 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 29] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 42] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 92] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 93] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 32] '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. See http://dart.dev/go/non-promo-property
|
||||
// [context 94] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 95] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
indexSetPostIncDec(C32 c, List<int> values) {
|
||||
if (c.bad == null) return;
|
||||
values[c.bad]++;
|
||||
// ^^^^^
|
||||
// [analyzer 29] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 32] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 92] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 94] 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 42] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [analyzer 48] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 93] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 95] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
extension E33 on int {
|
||||
|
@ -651,15 +651,50 @@ extension E33 on int {
|
|||
class C33 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 10] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 94] 'bad' refers to a property so it couldn't be promoted.
|
||||
// [context 24] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 96] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
explicitExtensionInvocation(C33 c) {
|
||||
if (c.bad == null) return;
|
||||
E33(c.bad).f();
|
||||
// ^^^^^
|
||||
// [analyzer 10] COMPILE_TIME_ERROR.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE
|
||||
// [analyzer 24] COMPILE_TIME_ERROR.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 94] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
// [cfe 96] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C34 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 47] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 97] 'bad' refers to a property so it couldn't be promoted.
|
||||
C34(int value);
|
||||
}
|
||||
|
||||
class D34 extends C34 {
|
||||
int other;
|
||||
D34(C34 c)
|
||||
: other = c.bad!,
|
||||
super(c.bad);
|
||||
// ^^^^^
|
||||
// [analyzer 47] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// ^
|
||||
// [cfe 97] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
||||
class C35 {
|
||||
int? bad;
|
||||
// ^^^
|
||||
// [context 2] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
|
||||
// [context 98] 'bad' refers to a property so it couldn't be promoted.
|
||||
}
|
||||
|
||||
indexSetRhs(C35 c, List<int> x) {
|
||||
if (c.bad == null) return;
|
||||
x[0] = c.bad;
|
||||
// ^^^^^
|
||||
// [analyzer 2] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe 98] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue