Skip to content

Commit f56df4a

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Add support for double literals
Change-Id: I08ea12bb0213272b192d063fd3699b2495912077 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106140 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent fa885b3 commit f56df4a

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

pkg/nnbd_migration/lib/src/graph_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ class GraphBuilder extends GeneralizingAstVisitor<DecoratedType> {
278278

279279
@override
280280
DecoratedType visitDoubleLiteral(DoubleLiteral node) {
281-
throw new UnimplementedError('TODO(brianwilkerson)');
281+
return DecoratedType(node.staticType, _graph.never);
282282
}
283283

284284
@override

pkg/nnbd_migration/test/migration_visitor_test.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,15 @@ int f(bool b, int i) {
447447
assertConditional(nullable_conditional, nullable_i, always);
448448
}
449449

450+
test_doubleLiteral() async {
451+
await analyze('''
452+
double f() {
453+
return 1.0;
454+
}
455+
''');
456+
assertNoUpstreamNullability(decoratedTypeAnnotation('double').node);
457+
}
458+
450459
test_functionDeclaration_expression_body() async {
451460
await analyze('''
452461
int/*1*/ f(int/*2*/ i) => i/*3*/;
@@ -833,7 +842,7 @@ void f(int y) {
833842
hard: true);
834843
}
835844

836-
test_intLiteral() async {
845+
test_integerLiteral() async {
837846
await analyze('''
838847
int f() {
839848
return 0;

0 commit comments

Comments
 (0)