Skip to content

Commit 812b9c9

Browse files
jensjohaCommit Bot
authored and
Commit Bot
committed
[CFE] Fix weekly bot #103
Change-Id: I214fb61b97885ea8a2219b3deef3e05a72adcb49 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254162 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent db6a10c commit 812b9c9

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3242,10 +3242,16 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
32423242
});
32433243
}
32443244
}
3245+
Uri firstUri = uri!;
3246+
Uri secondUri = otherUri!;
3247+
if (firstUri.toString().compareTo(secondUri.toString()) > 0) {
3248+
firstUri = secondUri;
3249+
secondUri = uri;
3250+
}
32453251
if (isExport) {
32463252
Template<Message Function(String name, Uri uri, Uri uri2)> template =
32473253
templateDuplicatedExport;
3248-
Message message = template.withArguments(name, uri!, otherUri!);
3254+
Message message = template.withArguments(name, firstUri, secondUri);
32493255
addProblem(message, charOffset, noLength, fileUri);
32503256
}
32513257
Template<Message Function(String name, Uri uri, Uri uri2)> builderTemplate =
@@ -3256,8 +3262,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
32563262
name,
32573263
// TODO(ahe): We should probably use a context object here
32583264
// instead of including URIs in this message.
3259-
uri!,
3260-
otherUri!);
3265+
firstUri,
3266+
secondUri);
32613267
// We report the error lazily (setting suppressMessage to false) because the
32623268
// spec 18.1 states that 'It is not an error if N is introduced by two or
32633269
// more imports but never referred to.'

pkg/front_end/test/fasta/testing/suite.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,31 @@ class Strategy extends EquivalenceStrategy {
17901790
return _isMixinOrCloneReference(visitor, node.interfaceTargetReference,
17911791
other.interfaceTargetReference, 'interfaceTargetReference');
17921792
}
1793+
1794+
@override
1795+
bool checkLibrary_problemsAsJson(
1796+
EquivalenceVisitor visitor, Library node, Library other) {
1797+
List<String>? a = node.problemsAsJson;
1798+
if (a != null) {
1799+
a = a.map(_rewriteJsonMap).toList();
1800+
}
1801+
List<String>? b = other.problemsAsJson;
1802+
if (b != null) {
1803+
b = b.map(_rewriteJsonMap).toList();
1804+
}
1805+
return visitor.checkLists(a, b, visitor.checkValues, 'problemsAsJson');
1806+
}
1807+
1808+
String _rewriteJsonMap(String s) {
1809+
// Several things can change, e.g.
1810+
// * unserializableExports (when from dill) causes the message code to
1811+
// become "unspecified" from usage of `templateUnspecified`)
1812+
// * Order of things (and for instance which line it's reported on) can
1813+
// change depending on order, e.g. duplicate names in exports upon
1814+
// recompile of one of the exported libraries.
1815+
Map<String, dynamic> decoded = jsonDecode(s);
1816+
return decoded["uri"];
1817+
}
17931818
}
17941819

17951820
class FuzzAstVisitorSorterChunk {

0 commit comments

Comments
 (0)