Fix Never? in two ways: print ? in diagnostics, and don't set on element.type
Change-Id: I3f846f18c2c52d459c6876de108e9228f1082747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 9dc88d7..de53916 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -81,7 +81,9 @@
*/
BottomTypeImpl._(this.nullabilitySuffix)
: super(new NeverElementImpl(), "Never") {
- (element as NeverElementImpl).type = this;
+ if (nullabilitySuffix == NullabilitySuffix.none) {
+ (element as NeverElementImpl).type = this;
+ }
}
@override
@@ -2985,7 +2987,7 @@
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix);
void _appendNullability(StringBuffer buffer) {
- if (isDynamic || isBottom || isVoid) {
+ if (isDynamic || isVoid) {
// These types don't have nullability variations, so don't append
// anything.
return;