Skip to content

Commit

Permalink
Remove null safety badge (#3295)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough committed Jan 14, 2023
1 parent 263ea61 commit fcbadcd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 50 deletions.
2 changes: 1 addition & 1 deletion lib/src/element_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class GenericTypeAliasElementType extends TypeParameterElementType {
extension on DartType {
/// The dartdoc nullability suffix for this type in [library].
String nullabilitySuffixWithin(Library library) {
if (library.isNullSafety && !isVoid && !isBottom) {
if (!isVoid && !isBottom) {
/// If a legacy type appears inside the public interface of a Null
/// safety library, we pretend it is nullable for the purpose of
/// documentation (since star-types are not supposed to be public).
Expand Down
14 changes: 0 additions & 14 deletions lib/src/generator/templates.runtime_renderers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5261,13 +5261,6 @@ class _Renderer_FeatureSet extends RendererBase<FeatureSet> {
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.hasFeatureSet == true,
),
'isNullSafety': Property(
getValue: (CT_ c) => c.isNullSafety,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.isNullSafety == true,
),
'library': Property(
getValue: (CT_ c) => c.library,
renderVariable:
Expand Down Expand Up @@ -7826,13 +7819,6 @@ class _Renderer_Library extends RendererBase<Library> {
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.isInSdk == true,
),
'isNullSafety': Property(
getValue: (CT_ c) => c.isNullSafety,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.isNullSafety == true,
),
'isPublic': Property(
getValue: (CT_ c) => c.isPublic,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down
13 changes: 1 addition & 12 deletions lib/src/model/feature_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,7 @@ mixin FeatureSet {

/// A list of language features that both apply to this [ModelElement] and
/// make sense to display in context.
Iterable<LanguageFeature> get displayedLanguageFeatures sync* {
// TODO(jcollins-g): Implement mixed-mode handling and the tagging of
// legacy interfaces.
if (isNullSafety) {
yield LanguageFeature(
'Null safety', packageGraph.rendererFactory.languageFeatureRenderer);
}
}
Iterable<LanguageFeature> get displayedLanguageFeatures => const [];

bool get hasFeatureSet => displayedLanguageFeatures.isNotEmpty;

// TODO(jcollins-g): This is an approximation and not strictly true for
// inheritance/reexports.
bool get isNullSafety => library.isNullSafety;
}
8 changes: 2 additions & 6 deletions lib/src/model/language_feature.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@

import 'package:dartdoc/src/render/language_feature_renderer.dart';

const Map<String, String> _featureDescriptions = {
'Null safety': 'Supports the null safety language feature.',
};
const Map<String, String> _featureDescriptions = {};

const Map<String, String> _featureUrls = {
'Null safety': 'https://dart.dev/null-safety',
};
const Map<String, String> _featureUrls = {};

/// An abstraction for a language feature; used to render tags to notify
/// the user that the documentation should be specially interpreted.
Expand Down
11 changes: 0 additions & 11 deletions lib/src/model/library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,6 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
@override
Scope get scope => element.scope;

/// Whether this library is in a package configured to be treated as using
/// null safety and itself uses null safety.
bool get _allowsNullSafety => element.isNonNullableByDefault;

/// Whether this library should be documented as using null safety.
///
/// A library may use null safety but not be documented that way.
@override
bool get isNullSafety =>
config.enableExperiment.contains('non-nullable') && _allowsNullSafety;

bool get isInSdk => element.isInSdk;

/// [allModelElements] resolved to their original names.
Expand Down
6 changes: 0 additions & 6 deletions test/end2end/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,6 @@ void main() {
equals(''));
});

test('isNullSafety is set correctly for libraries', () {
expect(lateFinalWithoutInitializer.isNullSafety, isTrue);
});

test('method parameters with required', () {
var m1 = b.instanceMethods.firstWhere((m) => m.name == 'm1');
var p1 = m1.parameters.firstWhere((p) => p.name == 'p1');
Expand Down Expand Up @@ -416,7 +412,6 @@ void main() {
test('complex nullable elements are detected and rendered correctly', () {
var complexNullableMembers = nullableElements.allClasses
.firstWhere((c) => c.name == 'ComplexNullableMembers');
expect(complexNullableMembers.isNullSafety, isTrue);
expect(
complexNullableMembers.nameWithGenerics,
equals(
Expand All @@ -430,7 +425,6 @@ void main() {
.firstWhere((f) => f.name == 'methodWithNullables');
var operatorStar = nullableMembers.publicInstanceOperators
.firstWhere((f) => f.name == 'operator *');
expect(nullableMembers.isNullSafety, isTrue);
expect(
methodWithNullables.linkedParams,
equals(
Expand Down

0 comments on commit fcbadcd

Please sign in to comment.