Skip to content

Commit 723bb0e

Browse files
vsmenoncommit-bot@chromium.org
authored andcommitted
[dartdevc] make nullable_inference_test resilient to const refactor
This test now appears to pass with and without --constant-update-2018. Change-Id: I9f2f49f6dc5187d5a09bc502f5460089448043e4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108820 Reviewed-by: Mark Zhou <[email protected]> Reviewed-by: Nicholas Shahan <[email protected]> Commit-Queue: Vijay Menon <[email protected]>
1 parent f521f38 commit 723bb0e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/dev_compiler/test/nullable_inference_test.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,14 @@ Future expectNotNull(String code, String expectedNotNull) async {
470470
var component = await kernelCompile(code);
471471
var collector = NotNullCollector();
472472
component.accept(collector);
473-
var actualNotNull =
474-
collector.notNullExpressions.map((e) => e.toString()).join(', ');
473+
var actualNotNull = collector.notNullExpressions
474+
// ConstantExpressions print the table offset - we want to compare
475+
// against the underlying constant value instead.
476+
.map((e) => (e is ConstantExpression ? e.constant : e).toString())
477+
// Filter out our own NotNull annotations. The library prefix changes
478+
// per test, so just filter on the suffix.
479+
.where((s) => !s.endsWith('::_NotNull {}'))
480+
.join(', ');
475481
expect(actualNotNull, equals(expectedNotNull));
476482
}
477483

0 commit comments

Comments
 (0)