Version 2.13.0-196.0.dev
Merge commit '1cffb93ad7e66e49aa6987bdd836b158ca6761b7' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 32b1b05..530baf1 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -9707,14 +9707,17 @@
r"""Try removing the keyword 'var', or replacing it with the name of the return type.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(String name, String string)>
- templateVariableCouldBeNullDueToWrite =
- const Template<Message Function(String name, String string)>(
- messageTemplate:
- r"""Variable '#name' could be null due to an intervening write.""",
- tipTemplate:
- r"""Try null checking the variable after the write. See #string""",
- withArguments: _withArgumentsVariableCouldBeNullDueToWrite);
+const Template<
+ Message Function(
+ String name,
+ String
+ string)> templateVariableCouldBeNullDueToWrite = const Template<
+ Message Function(String name, String string)>(
+ messageTemplate:
+ r"""Variable '#name' could not be promoted due to an assignment.""",
+ tipTemplate:
+ r"""Try null checking the variable after the assignment. See #string""",
+ withArguments: _withArgumentsVariableCouldBeNullDueToWrite);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name, String string)>
@@ -9731,8 +9734,9 @@
if (string.isEmpty) throw 'No string provided';
return new Message(codeVariableCouldBeNullDueToWrite,
message:
- """Variable '${name}' could be null due to an intervening write.""",
- tip: """Try null checking the variable after the write. See ${string}""",
+ """Variable '${name}' could not be promoted due to an assignment.""",
+ tip:
+ """Try null checking the variable after the assignment. See ${string}""",
arguments: {'name': name, 'string': string});
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 47f6905..bb494fd 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -3555,8 +3555,8 @@
Expression writeExpression, NonPromotionReason reason) {
return DiagnosticMessageImpl(
filePath: source.fullName,
- message: "Variable '$variableName' could be null due to an intervening "
- "write. See ${reason.documentationLink}",
+ message: "Variable '$variableName' could not be promoted due to an "
+ "assignment. See ${reason.documentationLink}",
offset: writeExpression.offset,
length: writeExpression.length);
}
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 384cb20..05f2d16 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -4655,8 +4655,8 @@
analyzerCode: ParserErrorCode.MULTIPLE_VARIANCE_MODIFIERS
VariableCouldBeNullDueToWrite:
- template: "Variable '#name' could be null due to an intervening write."
- tip: "Try null checking the variable after the write. See #string"
+ template: "Variable '#name' could not be promoted due to an assignment."
+ tip: "Try null checking the variable after the assignment. See #string"
FieldNotPromoted:
template: "'#name' refers to a property so it couldn't be promoted."
diff --git a/tests/language/why_not_promoted/assignment_error_test.dart b/tests/language/why_not_promoted/assignment_error_test.dart
index 86ba93d..13c21ae 100644
--- a/tests/language/why_not_promoted/assignment_error_test.dart
+++ b/tests/language/why_not_promoted/assignment_error_test.dart
@@ -11,7 +11,7 @@
if (i == null) return;
i = j;
//^
-// [context 1] Variable 'i' could be null due to an intervening write.
+// [context 1] Variable 'i' could not be promoted due to an assignment.
i.isEven;
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
@@ -23,7 +23,7 @@
if (c == null) return;
c += i;
//^
-// [context 2] Variable 'c' could be null due to an intervening write.
+// [context 2] Variable 'c' could not be promoted due to an assignment.
c.cProperty;
// ^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
@@ -35,7 +35,7 @@
if (c == null) return;
c++;
//^
-// [context 3] Variable 'c' could be null due to an intervening write.
+// [context 3] Variable 'c' could not be promoted due to an assignment.
c.cProperty;
// ^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
@@ -47,7 +47,7 @@
if (c == null) return;
++c;
//^
- // [context 4] Variable 'c' could be null due to an intervening write.
+ // [context 4] Variable 'c' could not be promoted due to an assignment.
c.cProperty;
// ^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
@@ -59,7 +59,7 @@
if (i == null) return;
for (i in list) {
// ^
- // [context 5] Variable 'i' could be null due to an intervening write.
+ // [context 5] Variable 'i' could not be promoted due to an assignment.
i.isEven;
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
@@ -72,7 +72,7 @@
if (i == null) return;
[for (i in list) i.isEven];
// ^
- // [context 6] Variable 'i' could be null due to an intervening write.
+ // [context 6] Variable 'i' could not be promoted due to an assignment.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// ^
@@ -83,7 +83,7 @@
if (i == null) return;
({for (i in list) i.isEven});
// ^
- // [context 7] Variable 'i' could be null due to an intervening write.
+ // [context 7] Variable 'i' could not be promoted due to an assignment.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// ^
@@ -94,7 +94,7 @@
if (i == null) return;
({for (i in list) i.isEven: null});
// ^
- // [context 8] Variable 'i' could be null due to an intervening write.
+ // [context 8] Variable 'i' could not be promoted due to an assignment.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// ^
@@ -105,7 +105,7 @@
if (i == null) return;
({for (i in list) null: i.isEven});
// ^
- // [context 9] Variable 'i' could be null due to an intervening write.
+ // [context 9] Variable 'i' could not be promoted due to an assignment.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// ^
diff --git a/tests/language/why_not_promoted/nullable_method_call_error_test.dart b/tests/language/why_not_promoted/nullable_method_call_error_test.dart
index 70e8bbe..be1bba1 100644
--- a/tests/language/why_not_promoted/nullable_method_call_error_test.dart
+++ b/tests/language/why_not_promoted/nullable_method_call_error_test.dart
@@ -32,7 +32,7 @@
if (i == null) return;
i = j;
//^
-// [context 1] Variable 'i' could be null due to an intervening write.
+// [context 1] Variable 'i' could not be promoted due to an assignment.
i.isEven;
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
@@ -44,7 +44,7 @@
if (i == null) return;
i = j;
//^
-// [context 2] Variable 'i' could be null due to an intervening write.
+// [context 2] Variable 'i' could not be promoted due to an assignment.
i.propertyOnNullableInt;
i.propertyOnNonNullInt;
// ^^^^^^^^^^^^^^^^^^^^
diff --git a/tools/VERSION b/tools/VERSION
index 13bcfa2..b182322 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 13
PATCH 0
-PRERELEASE 195
+PRERELEASE 196
PRERELEASE_PATCH 0
\ No newline at end of file