Skip library directives when building edges
Change-Id: I43602f5cfc7455e83b408ccb7ee8adfba0e26d64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107194
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index d690038..b0eba9d 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -465,6 +465,12 @@
}
@override
+ DecoratedType visitLibraryDirective(LibraryDirective node) {
+ // skip directives
+ return null;
+ }
+
+ @override
DecoratedType visitListLiteral(ListLiteral node) {
var listType = node.staticType as InterfaceType;
if (node.typeArguments == null) {
diff --git a/pkg/nnbd_migration/test/edge_builder_test.dart b/pkg/nnbd_migration/test/edge_builder_test.dart
index 72cbff6..234340e9 100644
--- a/pkg/nnbd_migration/test/edge_builder_test.dart
+++ b/pkg/nnbd_migration/test/edge_builder_test.dart
@@ -1047,6 +1047,13 @@
assertNoUpstreamNullability(decoratedTypeAnnotation('bool').node);
}
+ test_libraryDirective() async {
+ await analyze('''
+library foo;
+''');
+ // Passes if no exceptions are thrown.
+ }
+
@failingTest
test_listLiteral_noTypeArgument_noNullableElements() async {
// Failing because we're not yet handling collection literals without a