Get non-nullable DartType in _typeStr().
Change-Id: I40a5ed56079a6c3908c1a7cdf7cd796015660eef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236303
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index 317d7c5..18026d6 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -1333,9 +1333,8 @@
return '{$entriesStr}';
}
- /// TODO(scheglov) Make [type] non-nullable?
- String? _typeStr(DartType? type) {
- return type?.getDisplayString(withNullability: true);
+ String? _typeStr(DartType type) {
+ return type.getDisplayString(withNullability: true);
}
void _withIndent(void Function() f) {
@@ -1535,8 +1534,12 @@
void _writeType(String name, DartType? type) {
if (_withResolution) {
- var typeStr = _typeStr(type);
- _writelnWithIndent('$name: $typeStr');
+ if (type != null) {
+ var typeStr = _typeStr(type);
+ _writelnWithIndent('$name: $typeStr');
+ } else {
+ _writelnWithIndent('$name: null');
+ }
}
}