File tree Expand file tree Collapse file tree 6 files changed +46
-2
lines changed
Expand file tree Collapse file tree 6 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -1559,7 +1559,15 @@ class _UnitResynthesizer extends UnitResynthesizer with UnitResynthesizerMixin {
15591559 }
15601560 switch (linkedReference.kind) {
15611561 case ReferenceKind .classOrEnum:
1562- element = new ClassElementHandle (summaryResynthesizer, location);
1562+ if (locationComponents.length == 3 &&
1563+ locationComponents[0 ] == 'dart:core' &&
1564+ locationComponents[1 ] == 'dart:core' &&
1565+ locationComponents[2 ] == 'Never' ) {
1566+ element = NeverElementImpl .instance;
1567+ type = BottomTypeImpl .instance;
1568+ } else {
1569+ element = new ClassElementHandle (summaryResynthesizer, location);
1570+ }
15631571 isDeclarableType = true ;
15641572 break ;
15651573 case ReferenceKind .constructor:
Original file line number Diff line number Diff line change @@ -516,7 +516,17 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
516516 b.references = unlinkedReferences;
517517 b.typedefs = typedefs;
518518 b.variables = variables;
519+
519520 b.publicNamespace = computePublicNamespace (compilationUnit);
521+ if (isCoreLibrary) {
522+ b.publicNamespace.names.add (
523+ UnlinkedPublicNameBuilder (
524+ name: 'Never' ,
525+ kind: ReferenceKind .classOrEnum,
526+ ),
527+ );
528+ }
529+
520530 _computeApiSignature (b);
521531 return b;
522532 }
Original file line number Diff line number Diff line change @@ -866,7 +866,8 @@ class LinkedUnitContext {
866866
867867 var kind = linkedType.kind;
868868 if (kind == LinkedNodeTypeKind .bottom) {
869- return BottomTypeImpl .instance;
869+ var nullabilitySuffix = _nullabilitySuffix (linkedType.nullabilitySuffix);
870+ return BottomTypeImpl .instance.withNullability (nullabilitySuffix);
870871 } else if (kind == LinkedNodeTypeKind .dynamic_) {
871872 return DynamicTypeImpl .instance;
872873 } else if (kind == LinkedNodeTypeKind .function) {
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ class LinkingBundleContext {
8080 if (type.isBottom) {
8181 return LinkedNodeTypeBuilder (
8282 kind: LinkedNodeTypeKind .bottom,
83+ nullabilitySuffix: _nullabilitySuffix (type),
8384 );
8485 } else if (type.isDynamic) {
8586 return LinkedNodeTypeBuilder (
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ class NamedTypeBuilder extends TypeBuilder {
8282 var substitution = Substitution .fromPairs (parameters, arguments);
8383 _type = substitution.substituteType (rawType);
8484 }
85+ } else if (element is NeverElementImpl ) {
86+ _type = element.type.withNullability (nullabilitySuffix);
8587 } else if (element is TypeParameterElement ) {
8688 _type = TypeParameterTypeImpl (element);
8789 } else {
Original file line number Diff line number Diff line change @@ -9758,6 +9758,28 @@ dynamic v;
97589758''' );
97599759 }
97609760
9761+ test_type_never_disableNnbd () async {
9762+ featureSet = disableNnbd;
9763+ var library = await checkLibrary ('Never d;' );
9764+ checkElementText (
9765+ library,
9766+ r'''
9767+ Never* d;
9768+ ''' ,
9769+ annotateNullability: true );
9770+ }
9771+
9772+ test_type_never_enableNnbd () async {
9773+ featureSet = enableNnbd;
9774+ var library = await checkLibrary ('Never d;' );
9775+ checkElementText (
9776+ library,
9777+ r'''
9778+ Never d;
9779+ ''' ,
9780+ annotateNullability: true );
9781+ }
9782+
97619783 test_type_param_generic_function_type_nullability_legacy () async {
97629784 featureSet = disableNnbd;
97639785 var library = await checkLibrary ('''
You can’t perform that action at this time.
0 commit comments