mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Fix a null safety migration bug in update_errors.dart.
It was assigning a List<String> to List<String?> which is allowed due to (unsound) covariance but would then fail at runtime when null was assigned to a list element. Change-Id: Ia893998e8866067b54cfa354b9c4e13d76b6d9ea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253303 Auto-Submit: Bob Nystrom <rnystrom@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com> Commit-Queue: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
parent
d50903739c
commit
6a8c81205a
|
@ -29,7 +29,7 @@ String updateErrorExpectations(String source, List<StaticError> errors,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String?> lines = source.split("\n");
|
var lines = List<String?>.of(source.split("\n"));
|
||||||
|
|
||||||
// Keep track of the indentation on any existing expectation markers. If
|
// Keep track of the indentation on any existing expectation markers. If
|
||||||
// found, it will try to preserve that indentation.
|
// found, it will try to preserve that indentation.
|
||||||
|
@ -116,7 +116,7 @@ String updateErrorExpectations(String source, List<StaticError> errors,
|
||||||
error.length != previousLength)) {
|
error.length != previousLength)) {
|
||||||
// If the error can't fit in a line comment, or no source location is
|
// If the error can't fit in a line comment, or no source location is
|
||||||
// specified, use an explicit location.
|
// specified, use an explicit location.
|
||||||
if (error.column <= 2 || error.length == 0) {
|
if (error.column <= 2) {
|
||||||
if (error.length == 0) {
|
if (error.length == 0) {
|
||||||
result.add("$comment [error column "
|
result.add("$comment [error column "
|
||||||
"${error.column}]");
|
"${error.column}]");
|
||||||
|
|
|
@ -400,7 +400,7 @@ x
|
||||||
makeError(line: 1, column: 1, length: 0, cfeError: "Foo"),
|
makeError(line: 1, column: 1, length: 0, cfeError: "Foo"),
|
||||||
], expected: """
|
], expected: """
|
||||||
x
|
x
|
||||||
// [error column 1, length 0]
|
// [error column 1]
|
||||||
// [cfe] Foo""");
|
// [cfe] Foo""");
|
||||||
|
|
||||||
contextMessages();
|
contextMessages();
|
||||||
|
|
Loading…
Reference in a new issue