Sort context messages by offset from low to high.

Change-Id: Ibedaff82eb8d5e3b6740c69b34736514289e93d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319060
Reviewed-by: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
Konstantin Shcheglov 2023-08-08 17:11:59 +00:00
parent fe7778291b
commit ed0544a43a
3 changed files with 13 additions and 13 deletions

View file

@ -100,7 +100,7 @@ class ExpectedError {
if (result != 0) {
return result;
}
return second.offset - first.offset;
return first.offset - second.offset;
});
if (contextMessages.length != expectedContextMessages.length) {
return false;

View file

@ -3492,12 +3492,12 @@ main() {
124,
10,
contextMessages: [
ExpectedContextMessage(testFile.path, 84, 1,
text:
"The evaluated constructor 'A' is called by 'B' and 'B' is defined here."),
ExpectedContextMessage(testFile.path, 31, 14,
text:
"The exception is 'The assertion in this constant expression failed.' and occurs here."),
ExpectedContextMessage(testFile.path, 84, 1,
text:
"The evaluated constructor 'A' is called by 'B' and 'B' is defined here."),
],
),
]);
@ -3540,12 +3540,12 @@ const b = const B();
101,
9,
contextMessages: [
ExpectedContextMessage(testFile.path, 74, 1,
text:
"The evaluated constructor 'A' is called by 'B' and 'B' is defined here."),
ExpectedContextMessage(testFile.path, 23, 19,
text:
"The exception is 'The assertion in this constant expression failed.' and occurs here."),
ExpectedContextMessage(testFile.path, 74, 1,
text:
"The evaluated constructor 'A' is called by 'B' and 'B' is defined here."),
],
),
]);

View file

@ -83,12 +83,12 @@ const f = const D('0.0');
106,
14,
contextMessages: [
ExpectedContextMessage('/home/test/lib/test.dart', 90, 1,
text:
"The exception is 'A value of type 'String' can't be assigned to a parameter of type 'double' in a const constructor.' and occurs here."),
ExpectedContextMessage('/home/test/lib/test.dart', 77, 1,
text:
"The evaluated constructor 'C' is called by 'D' and 'D' is defined here."),
ExpectedContextMessage('/home/test/lib/test.dart', 90, 1,
text:
"The exception is 'A value of type 'String' can't be assigned to a parameter of type 'double' in a const constructor.' and occurs here."),
],
),
]);
@ -126,12 +126,12 @@ main() {
124,
10,
contextMessages: [
ExpectedContextMessage(testFile.path, 84, 1,
text:
"The evaluated constructor 'A' is called by 'B' and 'B' is defined here."),
ExpectedContextMessage(testFile.path, 31, 14,
text:
"The exception is 'The assertion in this constant expression failed.' and occurs here."),
ExpectedContextMessage(testFile.path, 84, 1,
text:
"The evaluated constructor 'A' is called by 'B' and 'B' is defined here."),
],
),
]);