Skip to content

Commit 7da89da

Browse files
[analysis_server] Add nullability assertions to token list API
Easy way to not have to support it today, but not have to worry about it being buggy in the future. Change-Id: I4f60bcf459c770614faf566b670744ab59c1a7ea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163125 Auto-Submit: Mike Fairhurst <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent ec821fd commit 7da89da

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/analysis_server/lib/src/services/completion/token_details/token_detail_builder.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class TokenDetailBuilder {
115115
} else if (type is InterfaceType) {
116116
Element element = type.element;
117117
if (element == null || element.isSynthetic) {
118+
assert(false, "untested branch may print nullable types wrong");
119+
// TODO: test this, use the the library's nullability (not tracked yet).
118120
buffer.write(type.getDisplayString(withNullability: false));
119121
} else {
120122
// String uri = element.library.source.uri.toString();
@@ -132,7 +134,9 @@ class TokenDetailBuilder {
132134
}
133135
}
134136
} else {
135-
// Handle `void` and `dynamic`.
137+
// Handle `void` and `dynamic`. Nullability doesn't affect this.
138+
assert(type.getDisplayString(withNullability: false) ==
139+
type.getDisplayString(withNullability: true));
136140
buffer.write(type.getDisplayString(withNullability: false));
137141
}
138142
}

0 commit comments

Comments
 (0)