Remove unused hasPromotedTypeVariable().
Change-Id: Ia8c40e6675ad9fc6eaeb02772cbe8a9b470b89d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/type_demotion.dart b/pkg/analyzer/lib/src/dart/element/type_demotion.dart
index 37757e7..064cb13 100644
--- a/pkg/analyzer/lib/src/dart/element/type_demotion.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_demotion.dart
@@ -5,7 +5,6 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/dart/element/type_visitor.dart';
import 'package:analyzer/src/dart/element/replacement_visitor.dart';
import 'package:analyzer/src/dart/element/type.dart';
@@ -22,13 +21,6 @@
}
}
-/// Returns `true` if type contains a promoted type variable.
-bool hasPromotedTypeVariable(DartType type) {
- return type.accept(
- const _HasPromotedTypeVariableVisitor(),
- );
-}
-
/// Visitor that replaces all promoted type variables the type variable itself
/// and/or replaces all legacy types with non-nullable types.
///
@@ -70,41 +62,3 @@
);
}
}
-
-/// Visitor that returns `true` if a type contains a promoted type variable.
-class _HasPromotedTypeVariableVisitor extends UnifyingTypeVisitor<bool> {
- const _HasPromotedTypeVariableVisitor();
-
- @override
- bool visitDartType(DartType type) => false;
-
- @override
- bool visitFunctionType(FunctionType type) {
- if (type.returnType.accept(this)) {
- return true;
- }
-
- for (var parameter in type.parameters) {
- if (parameter.type.accept(this)) {
- return true;
- }
- }
-
- return false;
- }
-
- @override
- bool visitInterfaceType(InterfaceType type) {
- for (var typeArgument in type.typeArguments) {
- if (typeArgument.accept(this)) {
- return true;
- }
- }
- return false;
- }
-
- @override
- bool visitTypeParameterType(TypeParameterType type) {
- return (type as TypeParameterTypeImpl).promotedBound != null;
- }
-}