Skip to content

Commit 25a8f54

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Deprecate V1 in dart/element/type_provider.dart
Change-Id: Ibc83526e6c05536f75030a8b5fee81daa24b6282 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412982 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 877d87a commit 25a8f54

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

pkg/analyzer/lib/dart/element/type_provider.dart

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: analyzer_use_new_elements
6-
75
import 'package:analyzer/dart/element/element.dart';
86
import 'package:analyzer/dart/element/element2.dart';
97
import 'package:analyzer/dart/element/type.dart';
@@ -15,6 +13,7 @@ import 'package:meta/meta.dart';
1513
/// Clients may not extend, implement or mix-in this class.
1614
abstract class TypeProvider {
1715
/// Return the element representing the built-in class `bool`.
16+
@Deprecated('Use boolElement2 instead')
1817
ClassElement get boolElement;
1918

2019
/// Return the element representing the built-in class `bool`.
@@ -31,6 +30,7 @@ abstract class TypeProvider {
3130
InterfaceType get deprecatedType;
3231

3332
/// Return the element representing the built-in class `double`.
33+
@Deprecated('Use doubleElement2 instead')
3434
ClassElement get doubleElement;
3535

3636
/// Return the element representing the built-in class `double`.
@@ -45,6 +45,7 @@ abstract class TypeProvider {
4545

4646
/// Return the element representing the built-in type `Enum`, or `null` if
4747
/// the SDK does not have definition of `Enum`.
48+
@Deprecated('Use enumElement2 instead')
4849
ClassElement? get enumElement;
4950

5051
/// Return the element representing the built-in type `Enum`, or `null` if
@@ -63,6 +64,7 @@ abstract class TypeProvider {
6364
InterfaceType get futureDynamicType;
6465

6566
/// Return the element representing the built-in class `Future`.
67+
@Deprecated('Use futureElement2 instead')
6668
ClassElement get futureElement;
6769

6870
/// Return the element representing the built-in class `Future`.
@@ -73,6 +75,7 @@ abstract class TypeProvider {
7375
InterfaceType get futureNullType;
7476

7577
/// Return the element representing the built-in class `FutureOr`.
78+
@Deprecated('Use futureOrElement2 instead')
7679
ClassElement get futureOrElement;
7780

7881
/// Return the element representing the built-in class `FutureOr`.
@@ -83,6 +86,7 @@ abstract class TypeProvider {
8386
InterfaceType get futureOrNullType;
8487

8588
/// Return the element representing the built-in class `int`.
89+
@Deprecated('Use intElement2 instead')
8690
ClassElement get intElement;
8791

8892
/// Return the element representing the built-in class `int`.
@@ -96,6 +100,7 @@ abstract class TypeProvider {
96100
InterfaceType get iterableDynamicType;
97101

98102
/// Return the element representing the built-in class `Iterable`.
103+
@Deprecated('Use iterableElement2 instead')
99104
ClassElement get iterableElement;
100105

101106
/// Return the element representing the built-in class `Iterable`.
@@ -106,13 +111,15 @@ abstract class TypeProvider {
106111
InterfaceType get iterableObjectType;
107112

108113
/// Return the element representing the built-in class `List`.
114+
@Deprecated('Use listElement2 instead')
109115
ClassElement get listElement;
110116

111117
/// Return the element representing the built-in class `List`.
112118
@experimental
113119
ClassElement2 get listElement2;
114120

115121
/// Return the element representing the built-in class `Map`.
122+
@Deprecated('Use mapElement2 instead')
116123
ClassElement get mapElement;
117124

118125
/// Return the element representing the built-in class `Map`.
@@ -126,6 +133,7 @@ abstract class TypeProvider {
126133
NeverType get neverType;
127134

128135
/// Return the element representing the built-in class `Null`.
136+
@Deprecated('Use nullElement2 instead')
129137
ClassElement get nullElement;
130138

131139
/// Return the element representing the built-in class `Null`.
@@ -136,6 +144,7 @@ abstract class TypeProvider {
136144
InterfaceType get nullType;
137145

138146
/// Return the element representing the built-in class `num`.
147+
@Deprecated('Use numElement2 instead')
139148
ClassElement get numElement;
140149

141150
/// Return the element representing the built-in class `num`.
@@ -146,6 +155,7 @@ abstract class TypeProvider {
146155
InterfaceType get numType;
147156

148157
/// Return the element representing the built-in class `Object`.
158+
@Deprecated('Use objectElement2 instead')
149159
ClassElement get objectElement;
150160

151161
/// Return the element representing the built-in class `Object`.
@@ -159,6 +169,7 @@ abstract class TypeProvider {
159169
InterfaceType get objectType;
160170

161171
/// Return the element representing the built-in class `Record`.
172+
@Deprecated('Use recordElement2 instead')
162173
ClassElement get recordElement;
163174

164175
/// Return the element representing the built-in class `Record`.
@@ -169,6 +180,7 @@ abstract class TypeProvider {
169180
InterfaceType get recordType;
170181

171182
/// Return the element representing the built-in class `Set`.
183+
@Deprecated('Use setElement2 instead')
172184
ClassElement get setElement;
173185

174186
/// Return the element representing the built-in class `Set`.
@@ -182,13 +194,15 @@ abstract class TypeProvider {
182194
InterfaceType get streamDynamicType;
183195

184196
/// Return the element representing the built-in class `Stream`.
197+
@Deprecated('Use streamElement2 instead')
185198
ClassElement get streamElement;
186199

187200
/// Return the element representing the built-in class `Stream`.
188201
@experimental
189202
ClassElement2 get streamElement2;
190203

191204
/// Return the element representing the built-in class `String`.
205+
@Deprecated('Use stringElement2 instead')
192206
ClassElement get stringElement;
193207

194208
/// Return the element representing the built-in class `String`.
@@ -199,6 +213,7 @@ abstract class TypeProvider {
199213
InterfaceType get stringType;
200214

201215
/// Return the element representing the built-in class `Symbol`.
216+
@Deprecated('Use symbolElement2 instead')
202217
ClassElement get symbolElement;
203218

204219
/// Return the element representing the built-in class `Symbol`.
@@ -223,6 +238,7 @@ abstract class TypeProvider {
223238
InterfaceType futureType(DartType valueType);
224239

225240
/// Return `true` if [element] cannot be extended, implemented, or mixed in.
241+
@Deprecated('Use isNonSubtypableClass2() instead')
226242
bool isNonSubtypableClass(InterfaceElement element);
227243

228244
/// Return `true` if [element] cannot be extended, implemented, or mixed in.

pkg/analyzer/lib/src/dart/constant/evaluation.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ class ConstantEvaluationEngine {
452452
return null;
453453
}
454454
var typeProvider = constructor.library.typeProvider;
455-
if (constructor.enclosingElement3 == typeProvider.symbolElement) {
455+
if (constructor.enclosingElement3.asElement2 ==
456+
typeProvider.symbolElement2) {
456457
// The dart:core.Symbol has a const factory constructor that redirects
457458
// to dart:_internal.Symbol. That in turn redirects to an external
458459
// const constructor, which we won't be able to evaluate.

0 commit comments

Comments
 (0)