Add support for symbol literals
Change-Id: I273b2290b8d4d2e0948fac1962d02efc70e7813e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106163
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/nnbd_migration/lib/src/graph_builder.dart b/pkg/nnbd_migration/lib/src/graph_builder.dart
index 401f33f..5014606 100644
--- a/pkg/nnbd_migration/lib/src/graph_builder.dart
+++ b/pkg/nnbd_migration/lib/src/graph_builder.dart
@@ -454,12 +454,6 @@
}
@override
- DecoratedType visitNamedExpression(NamedExpression node) {
- throw new UnimplementedError('TODO(brianwilkerson)');
-// return node.expression.accept(this);
- }
-
- @override
DecoratedType visitNode(AstNode node) {
if (listener != null) {
try {
@@ -517,11 +511,6 @@
}
@override
- DecoratedType visitRethrowExpression(RethrowExpression node) {
- throw new UnimplementedError('TODO(brianwilkerson)');
- }
-
- @override
DecoratedType visitReturnStatement(ReturnStatement node) {
if (node.expression == null) {
_checkAssignment(_currentFunctionType.returnType, _nullType, null);
@@ -563,7 +552,7 @@
@override
DecoratedType visitSymbolLiteral(SymbolLiteral node) {
- throw new UnimplementedError('TODO(brianwilkerson)');
+ return DecoratedType(node.staticType, _graph.never);
}
@override
diff --git a/pkg/nnbd_migration/test/migration_visitor_test.dart b/pkg/nnbd_migration/test/migration_visitor_test.dart
index c156218..e738dc5 100644
--- a/pkg/nnbd_migration/test/migration_visitor_test.dart
+++ b/pkg/nnbd_migration/test/migration_visitor_test.dart
@@ -1216,6 +1216,15 @@
assertNoUpstreamNullability(decoratedTypeAnnotation('String').node);
}
+ test_symbolLiteral() async {
+ await analyze('''
+Symbol f() {
+ return #symbol;
+}
+''');
+ assertNoUpstreamNullability(decoratedTypeAnnotation('Symbol').node);
+ }
+
test_thisExpression() async {
await analyze('''
class C {