Files
sdk/pkg/front_end/parser_testcases/nnbd/issue_40834_01.dart
T
Jens Johansen 47d462e8b1 [parser] Better handling of nullable types vs conditional expressions
Fixes #40834

Change-Id: I2fdad5a383c1873b1dd782b70e2f1e3ab8664b40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137960
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-03 09:49:57 +00:00

11 lines
347 B
Dart

class Foo {
String? x;
int y;
Foo(Object? o) : x = o as String?, y = 0;
Foo.a(dynamic o) : y = o is String ? o.length : null, x = null;
Foo.b(dynamic o) : y = o is String? ? o.length : null, x = null;
Foo.c(dynamic o) : y = o as String ? o.length : null, x = null;
Foo.d(dynamic o) : y = o as String? ? o.length : null, x = null;
}