Version 2.16.0-95.0.dev
Merge commit 'ad75cd627ba3dbe5ced3a997a89e312e7a2ddfc9' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2852bed..185379d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -49,7 +49,13 @@
#### Linter
-Updated the Linter to `1.15.0`, which includes changes that
+Updated the Linter to `1.16.0`, which includes changes that
+- improves docs for `prefer_initializing_formals`.
+- updates `secure_pubspec_urls` to check `issue_tracker` and
+ `repository` entries.
+- adds new lint: `conditional_uri_does_not_exist`.
+- improves performance for
+ `missing_whitespace_between_adjacent_strings`.
- adds new lint: `avoid_final_parameters`.
- adds new lint: `no_leading_underscores_for_library_prefixes`.
- adds new lint: `no_leading_underscores_for_local_identifiers`.
diff --git a/DEPS b/DEPS
index 4925dd5..62ab94b 100644
--- a/DEPS
+++ b/DEPS
@@ -123,7 +123,7 @@
"intl_tag": "0.17.0-nullsafety",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_rev": "7e00f893440a72de0637970325e4ea44bd1e8c8e",
- "linter_tag": "1.15.0",
+ "linter_tag": "1.16.0",
"lints_tag": "f9670df2a66e0ec12eb51554e70c1cbf56c8f5d0",
"logging_rev": "575781ef196e4fed4fb737e38fb4b73d62727187",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
diff --git a/pkg/_fe_analyzer_shared/lib/src/base/errors.dart b/pkg/_fe_analyzer_shared/lib/src/base/errors.dart
index eb92d87..bcaa62b 100644
--- a/pkg/_fe_analyzer_shared/lib/src/base/errors.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/base/errors.dart
@@ -50,17 +50,14 @@
this.hasPublishedDocs = false,
this.isUnresolvedIdentifier: false,
required this.name,
- @Deprecated('Please use problemMessage') String? message,
- String? problemMessage,
+ required String problemMessage,
required this.uniqueName,
}) : _correctionMessage = correctionMessage,
- _problemMessage = problemMessage ?? message ?? 'NO MESSAGE',
+ _problemMessage = problemMessage,
// ignore: unnecessary_null_comparison
assert(hasPublishedDocs != null),
// ignore: unnecessary_null_comparison
- assert(isUnresolvedIdentifier != null),
- assert((message == null) != (problemMessage == null),
- 'Either problemMessage or message must be provided (not both)');
+ assert(isUnresolvedIdentifier != null);
/**
* The template used to create the correction to be displayed for this error,
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index ab7cbeb..111aa02 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -536,7 +536,7 @@
return;
}
// Do sort.
- var sorter = MemberSorter(code, unit);
+ var sorter = MemberSorter(code, unit, result.lineInfo);
var edits = sorter.sort();
var fileEdit = SourceFileEdit(file, fileStamp, edits: edits);
server.sendResponse(EditSortMembersResult(fileEdit).toResponse(request.id));
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart
index d832d06..a4c2286 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart
@@ -61,7 +61,7 @@
));
}
- final sorter = MemberSorter(code, unit);
+ final sorter = MemberSorter(code, unit, result.lineInfo);
final edits = sorter.sort();
if (edits.isEmpty) {
diff --git a/pkg/analysis_server/lib/src/services/correction/sort_members.dart b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
index 93e103a..9908244 100644
--- a/pkg/analysis_server/lib/src/services/correction/sort_members.dart
+++ b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
@@ -3,9 +3,12 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/src/services/correction/organize_imports.dart';
+import 'package:analysis_server/src/utilities/extensions/range_factory.dart';
import 'package:analysis_server/src/utilities/strings.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/source/line_info.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
+import 'package:analyzer_plugin/utilities/range_factory.dart';
/// Sorter for unit/class members.
class MemberSorter {
@@ -45,11 +48,14 @@
final CompilationUnit unit;
+ final LineInfo lineInfo;
+
String code;
String endOfLine = '\n';
- MemberSorter(this.initialCode, this.unit) : code = initialCode {
+ MemberSorter(this.initialCode, this.unit, this.lineInfo)
+ : code = initialCode {
endOfLine = getEOL(code);
}
@@ -136,8 +142,9 @@
throw StateError('Unsupported class of member: ${member.runtimeType}');
}
var item = _PriorityItem.forName(isStatic, name, kind);
- var offset = member.offset;
- var length = member.length;
+ var nodeRange = range.nodeWithComments(lineInfo, member);
+ var offset = nodeRange.offset;
+ var length = nodeRange.length;
var text = code.substring(offset, offset + length);
members.add(_MemberInfo(item, name, offset, length, text));
}
@@ -212,8 +219,9 @@
throw StateError('Unsupported class of member: ${member.runtimeType}');
}
var item = _PriorityItem.forName(false, name, kind);
- var offset = member.offset;
- var length = member.length;
+ var nodeRange = range.nodeWithComments(lineInfo, member);
+ var offset = nodeRange.offset;
+ var length = nodeRange.length;
var text = code.substring(offset, offset + length);
members.add(_MemberInfo(item, name, offset, length, text));
}
diff --git a/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart b/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart
index 4b8451a..be632dc 100644
--- a/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart
+++ b/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart
@@ -9,15 +9,15 @@
import 'package:analyzer_plugin/utilities/range_factory.dart';
extension RangeFactoryExtensions on RangeFactory {
- /// Return a source range that covers the given [item] in the containing
+ /// Return a source range that covers the given [node] in the containing
/// [list]. This includes a leading or trailing comma, as appropriate, and any
/// leading or trailing comments. The [lineInfo] is used to differentiate
- /// trailing comments (on the same line as the end of the item) from leading
- /// comments (on lines between the start of the item and the preceding comma).
+ /// trailing comments (on the same line as the end of the node) from leading
+ /// comments (on lines between the start of the node and the preceding comma).
///
- /// Throws an `ArgumentError` if the [item] is not an element of the [list].
+ /// Throws an `ArgumentError` if the [node] is not an element of the [list].
SourceRange nodeInListWithComments<T extends AstNode>(
- LineInfo lineInfo, NodeList<T> list, T item) {
+ LineInfo lineInfo, NodeList<T> list, T node) {
// TODO(brianwilkerson) Improve the name and signature of this method and
// make it part of the API of either `RangeFactory` or
// `DartFileEditBuilder`. The implementation currently assumes that the
@@ -28,24 +28,24 @@
// TODO(brianwilkerson) Consider adding a `separator` parameter so that we
// can handle things like statements in a block.
if (list.length == 1) {
- if (list[0] != item) {
- throw ArgumentError('The item must be in the list.');
+ if (list[0] != node) {
+ throw ArgumentError('The node must be in the list.');
}
// If there's only one item in the list, then delete everything including
// any leading or trailing comments, including any trailing comma.
- var leadingComment = _leadingComment(lineInfo, item.beginToken);
- var trailingComment = _trailingComment(lineInfo, item.endToken, true);
+ var leadingComment = _leadingComment(lineInfo, node.beginToken);
+ var trailingComment = _trailingComment(lineInfo, node.endToken, true);
return startEnd(leadingComment, trailingComment);
}
- final index = list.indexOf(item);
+ final index = list.indexOf(node);
if (index < 0) {
- throw ArgumentError('The item must be in the list.');
+ throw ArgumentError('The node must be in the list.');
}
if (index == 0) {
// If this is the first item in the list, then delete everything from the
// leading comment for this item to the leading comment for the next item.
// This will include the comment after this item.
- var thisLeadingComment = _leadingComment(lineInfo, item.beginToken);
+ var thisLeadingComment = _leadingComment(lineInfo, node.beginToken);
var nextLeadingComment = _leadingComment(lineInfo, list[1].beginToken);
return startStart(thisLeadingComment, nextLeadingComment);
} else {
@@ -56,7 +56,7 @@
_trailingComment(lineInfo, list[index - 1].endToken, false);
var previousHasTrailingComment = previousTrailingComment is CommentToken;
var thisTrailingComment =
- _trailingComment(lineInfo, item.endToken, previousHasTrailingComment);
+ _trailingComment(lineInfo, node.endToken, previousHasTrailingComment);
if (!previousHasTrailingComment && thisTrailingComment is CommentToken) {
// But if this item has a trailing comment and the previous didn't, then
// we'd be deleting both commas, which would leave invalid code. We
@@ -67,6 +67,24 @@
}
}
+ /// Return a source range that covers the given [node] from the start of
+ /// any leading comment token (excluding any token considered a trailing
+ /// comment for the previous node) or the start of the node itself if there
+ /// are none, up until the end of the trailing comment token or the end of the
+ /// node itself if there are none.
+ SourceRange nodeWithComments(LineInfo lineInfo, AstNode node) {
+ // If the node is the first thing in the unit, leading comments are treated
+ // as headers and should never be included in the range.
+ final isFirstItem = node.beginToken == node.root.beginToken;
+
+ var thisLeadingComment = isFirstItem
+ ? node.beginToken
+ : _leadingComment(lineInfo, node.beginToken);
+ var thisTrailingComment = _trailingComment(lineInfo, node.endToken, false);
+
+ return startEnd(thisLeadingComment, thisTrailingComment);
+ }
+
/// Return the comment token immediately following the [token] if it is on the
/// same line as the [token], or the [token] if there is no comment after the
/// [token] or if the comment is on a different line than the [token]. If
@@ -94,7 +112,11 @@
/// the same line as the first non-comment token before the [token]. Return
/// the [token] if there is no such comment.
Token _leadingComment(LineInfo lineInfo, Token token) {
- var previousLine = lineInfo.getLocation(token.previous!.offset).lineNumber;
+ var previous = token.previous;
+ if (previous == null || previous.type == TokenType.EOF) {
+ return token.precedingComments ?? token;
+ }
+ var previousLine = lineInfo.getLocation(previous.offset).lineNumber;
Token? comment = token.precedingComments;
while (comment != null) {
var commentLine = lineInfo.getLocation(comment.offset).lineNumber;
diff --git a/pkg/analysis_server/test/services/correction/sort_members_test.dart b/pkg/analysis_server/test/services/correction/sort_members_test.dart
index e434168..f5062c7 100644
--- a/pkg/analysis_server/test/services/correction/sort_members_test.dart
+++ b/pkg/analysis_server/test/services/correction/sort_members_test.dart
@@ -4,6 +4,7 @@
import 'package:analysis_server/src/services/correction/sort_members.dart';
import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/source/line_info.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -18,6 +19,8 @@
@reflectiveTest
class SortMembersTest extends AbstractSingleUnitTest {
+ LineInfo? lineInfo;
+
Future<void> test_classMembers_accessor() async {
await _parseTestUnit(r'''
class A {
@@ -308,6 +311,34 @@
''');
}
+ Future<void> test_classMembers_trailingComments() async {
+ await _parseTestUnit(r'''
+class A { // classA
+ // instanceA
+ int instanceA; // instanceA
+ // A()
+ A(); // A()
+ // staticA
+ static int staticA; // staticA
+ // static_b
+ static int static_b; // static_b
+}
+''');
+ // validate change
+ _assertSort(r'''
+class A { // classA
+ // staticA
+ static int staticA; // staticA
+ // static_b
+ static int static_b; // static_b
+ // instanceA
+ int instanceA; // instanceA
+ // A()
+ A(); // A()
+}
+''');
+ }
+
Future<void> test_directives() async {
await _parseTestUnit(r'''
library lib;
@@ -916,8 +947,40 @@
''');
}
+ Future<void> test_unitMembers_trailingComments() async {
+ await _parseTestUnit(r'''
+// Header
+class B {} // B
+// A
+class A {} // A
+// C
+class C {} // C
+// b
+var b; // b
+// a
+var a; // a
+// c
+var c; // c
+''');
+ // validate change
+ _assertSort(r'''
+// Header
+// a
+var a; // a
+// b
+var b; // b
+// c
+var c; // c
+// A
+class A {} // A
+class B {} // B
+// C
+class C {} // C
+''');
+ }
+
void _assertSort(String expectedCode) {
- var sorter = MemberSorter(testCode, testUnit);
+ var sorter = MemberSorter(testCode, testUnit, lineInfo!);
var edits = sorter.sort();
var result = SourceEdit.applySequence(testCode, edits);
expect(result, expectedCode);
@@ -926,6 +989,7 @@
Future<void> _parseTestUnit(String code) async {
addTestSource(code);
var result = session.getParsedUnit(testFile) as ParsedUnitResult;
+ lineInfo = result.lineInfo;
testUnit = result.unit;
}
}
diff --git a/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart b/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart
index d4bf8fd..259d5ea 100644
--- a/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart
+++ b/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart
@@ -15,6 +15,7 @@
defineReflectiveSuite(() {
defineReflectiveTests(RangeFactory_NodeInListTest);
defineReflectiveTests(RangeFactory_NodeInListWithCommentsTest);
+ defineReflectiveTests(RangeFactory_NodeWithCommentsTest);
});
}
@@ -26,11 +27,54 @@
return invocation.argumentList.arguments;
}
- void _assertRange(int index, SourceRange expectedRange) {
+ void _assertArgumentRange(int index, SourceRange expectedRange) {
var list = _argumentList;
expect(range.nodeInListWithComments(testUnit.lineInfo!, list, list[index]),
expectedRange);
}
+
+ void _assertClassMemberRanges(Map<int, SourceRange> expectedRanges) {
+ var class_ = findNode.classDeclaration('class');
+ var list = class_.members;
+ for (var entry in expectedRanges.entries) {
+ expect(range.nodeWithComments(testUnit.lineInfo!, list[entry.key]),
+ entry.value);
+ }
+ }
+
+ void _assertUnitRanges(Map<int, SourceRange> expectedRanges) {
+ var list = testUnit.declarations;
+ for (var entry in expectedRanges.entries) {
+ expect(range.nodeWithComments(testUnit.lineInfo!, list[entry.key]),
+ entry.value);
+ }
+ }
+
+ /// Create a [SourceRange] for the positions start/end before the supplied
+ /// search strings.
+ SourceRange _range({
+ String? startsBefore,
+ String? startsAfter,
+ String? endsBefore,
+ String? endsAfter,
+ }) {
+ expect(startsBefore == null, isNot(startsAfter == null),
+ reason: 'Specify exactly one of startsBefore/startsAfter');
+ expect(endsBefore == null, isNot(endsAfter == null),
+ reason: 'Specify exactly one of endsBefore/endsAfter');
+
+ final offset = startsBefore != null
+ ? testCode.indexOf(startsBefore)
+ : testCode.indexOf(startsAfter!) + startsAfter.length;
+ final end = endsBefore != null
+ ? testCode.indexOf(endsBefore)
+ : testCode.indexOf(endsAfter!) + endsAfter.length;
+
+ assert(offset > -1);
+ assert(end > -1);
+
+ return SourceRange(offset, end - offset);
+ }
}
/// Copied from `analyzer_plugin/test/utilities/range_factory_test.dart` in
@@ -46,7 +90,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(0, SourceRange(15, 6));
+ _assertArgumentRange(0, SourceRange(15, 6));
}
Future<void> test_argumentList_first_positional() async {
@@ -56,7 +100,7 @@
}
void g(int a, int b) {}
''');
- _assertRange(0, SourceRange(15, 3));
+ _assertArgumentRange(0, SourceRange(15, 3));
}
Future<void> test_argumentList_last_named() async {
@@ -66,7 +110,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(1, SourceRange(19, 6));
+ _assertArgumentRange(1, SourceRange(19, 6));
}
Future<void> test_argumentList_last_positional() async {
@@ -76,7 +120,7 @@
}
void g(int a, int b) {}
''');
- _assertRange(1, SourceRange(16, 3));
+ _assertArgumentRange(1, SourceRange(16, 3));
}
Future<void> test_argumentList_middle_named() async {
@@ -86,7 +130,7 @@
}
void g({int? a, int? b, int? c}) {}
''');
- _assertRange(1, SourceRange(19, 6));
+ _assertArgumentRange(1, SourceRange(19, 6));
}
Future<void> test_argumentList_middle_positional() async {
@@ -96,7 +140,7 @@
}
void g(int a, int b, int c) {}
''');
- _assertRange(1, SourceRange(16, 3));
+ _assertArgumentRange(1, SourceRange(16, 3));
}
Future<void> test_argumentList_only_named() async {
@@ -106,7 +150,7 @@
}
void g({int? a}) {}
''');
- _assertRange(0, SourceRange(15, 4));
+ _assertArgumentRange(0, SourceRange(15, 4));
}
Future<void> test_argumentList_only_named_trailingComma() async {
@@ -116,7 +160,7 @@
}
void g({int? a}) {}
''');
- _assertRange(0, SourceRange(15, 5));
+ _assertArgumentRange(0, SourceRange(15, 5));
}
Future<void> test_argumentList_only_positional() async {
@@ -126,7 +170,7 @@
}
void g(int a) {}
''');
- _assertRange(0, SourceRange(15, 1));
+ _assertArgumentRange(0, SourceRange(15, 1));
}
Future<void> test_argumentList_only_positional_trailingComma() async {
@@ -136,7 +180,7 @@
}
void g(int a) {}
''');
- _assertRange(0, SourceRange(15, 2));
+ _assertArgumentRange(0, SourceRange(15, 2));
}
}
@@ -154,7 +198,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(0, SourceRange(20, 36));
+ _assertArgumentRange(0, SourceRange(20, 36));
}
Future<void> test_argumentList_first_named_leadingComment() async {
@@ -169,7 +213,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(0, SourceRange(20, 25));
+ _assertArgumentRange(0, SourceRange(20, 25));
}
Future<void> test_argumentList_first_named_trailingComment() async {
@@ -183,7 +227,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(0, SourceRange(20, 21));
+ _assertArgumentRange(0, SourceRange(20, 21));
}
Future<void> test_argumentList_last_named_leadingAndTrailingComment() async {
@@ -197,7 +241,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(1, SourceRange(36, 36));
+ _assertArgumentRange(1, SourceRange(36, 36));
}
Future<void> test_argumentList_last_named_leadingComment() async {
@@ -211,7 +255,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(1, SourceRange(36, 25));
+ _assertArgumentRange(1, SourceRange(36, 25));
}
Future<void> test_argumentList_last_named_trailingComment() async {
@@ -224,7 +268,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(1, SourceRange(36, 21));
+ _assertArgumentRange(1, SourceRange(36, 21));
}
Future<void>
@@ -239,7 +283,7 @@
}
void g({int? a, int? b}) {}
''');
- _assertRange(1, SourceRange(36, 21));
+ _assertArgumentRange(1, SourceRange(36, 21));
}
Future<void>
@@ -256,7 +300,7 @@
}
void g({int? a, int? b, int? c}) {}
''');
- _assertRange(1, SourceRange(36, 36));
+ _assertArgumentRange(1, SourceRange(36, 36));
}
Future<void> test_argumentList_middle_named_leadingComment() async {
@@ -272,7 +316,7 @@
}
void g({int? a, int? b, int? c}) {}
''');
- _assertRange(1, SourceRange(36, 25));
+ _assertArgumentRange(1, SourceRange(36, 25));
}
Future<void> test_argumentList_middle_named_trailingComment() async {
@@ -287,7 +331,7 @@
}
void g({int? a, int? b, int? c}) {}
''');
- _assertRange(1, SourceRange(36, 21));
+ _assertArgumentRange(1, SourceRange(36, 21));
}
Future<void>
@@ -302,7 +346,7 @@
}
void g({int? a, int? b, int? c}) {}
''');
- _assertRange(1, SourceRange(25, 21));
+ _assertArgumentRange(1, SourceRange(25, 21));
}
Future<void> test_argumentList_only_named_leadingAndTrailingComment() async {
@@ -315,7 +359,7 @@
}
void g({int? a}) {}
''');
- _assertRange(0, SourceRange(20, 31));
+ _assertArgumentRange(0, SourceRange(20, 31));
}
Future<void> test_argumentList_only_named_leadingComment() async {
@@ -328,7 +372,7 @@
}
void g({int? a}) {}
''');
- _assertRange(0, SourceRange(20, 20));
+ _assertArgumentRange(0, SourceRange(20, 20));
}
Future<void> test_argumentList_only_named_trailingComment() async {
@@ -340,6 +384,501 @@
}
void g({int? a}) {}
''');
- _assertRange(0, SourceRange(20, 16));
+ _assertArgumentRange(0, SourceRange(20, 16));
+ }
+}
+
+@reflectiveTest
+class RangeFactory_NodeWithCommentsTest extends BaseRangeFactoryTest {
+ Future<void> test_class_multiple_leading() async {
+ await resolveTestCode('''
+class A {
+ // 1
+ int foo = 1;
+ // 2
+ int bar = 2;
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '= 1;'),
+ 1: _range(startsBefore: '// 2', endsAfter: '= 2;'),
+ });
+ }
+
+ Future<void> test_class_multiple_leadingAndTrailing() async {
+ await resolveTestCode('''
+class A {
+ // 2
+ int foo = 1; // 3
+ // 4
+ int bar = 1; // 5
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 5'),
+ });
+ }
+
+ Future<void>
+ test_class_multiple_leadingAndTrailing_withClassBraceTrailing() async {
+ await resolveTestCode('''
+class A { // 1
+ // 2
+ int foo = 1; // 3
+ // 4
+ int bar = 1; // 5
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 5'),
+ });
+ }
+
+ Future<void> test_class_multiple_trailing() async {
+ await resolveTestCode('''
+class A {
+ int foo = 1; // 1
+ int bar = 2; // 2
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 1'),
+ 1: _range(startsBefore: 'int bar', endsAfter: '// 2'),
+ });
+ }
+
+ Future<void> test_class_single_field_leading() async {
+ await resolveTestCode('''
+class A {
+ // 1
+ int foo = 1;
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '= 1;'),
+ });
+ }
+
+ Future<void> test_class_single_field_leadingAndTrailing() async {
+ await resolveTestCode('''
+class A {
+ // 1
+ int foo = 1; // 2
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '; // 2'),
+ });
+ }
+
+ Future<void>
+ test_class_single_field_leadingAndTrailing_withClassBraceTrailing() async {
+ await resolveTestCode('''
+class A { // 1
+ // 2
+ int foo = 1; // 3
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ });
+ }
+
+ Future<void> test_class_single_field_trailing() async {
+ await resolveTestCode('''
+class A {
+ int foo = 1; // 1
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 1'),
+ });
+ }
+
+ Future<void> test_class_single_method_leading() async {
+ await resolveTestCode('''
+class A {
+ // 1
+ foo() {}
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '{}'),
+ });
+ }
+
+ Future<void> test_class_single_method_leadingAndTrailing() async {
+ await resolveTestCode('''
+class A {
+ // foo
+ foo() {} // foo
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// foo', endsAfter: '} // foo'),
+ });
+ }
+
+ Future<void>
+ test_class_single_method_leadingAndTrailing_withClassBraceTrailing() async {
+ await resolveTestCode('''
+class A { // 1
+ // 2
+ foo() {} // 3
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ });
+ }
+
+ Future<void> test_class_single_method_trailing() async {
+ await resolveTestCode('''
+class A {
+ foo() {} // 1
+}
+''');
+ _assertClassMemberRanges({
+ 0: _range(startsBefore: 'foo()', endsAfter: '// 1'),
+ });
+ }
+
+ Future<void> test_topLevel_fileHeader_dartDoc() async {
+ await resolveTestCode('''
+// Copyright (c) ...
+// ...
+
+/// 1
+int foo = 1; // 2
+
+/// 3
+int bar = 1; // 4
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '/// 1', endsAfter: '// 2'),
+ 1: _range(startsBefore: '/// 3', endsAfter: '// 4'),
+ });
+ }
+
+ Future<void> test_topLevel_fileHeader_noDartDoc() async {
+ await resolveTestCode('''
+// Copyright (c) ...
+// ...
+
+int foo = 1; // 2
+
+int bar = 1; // 4
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 2'),
+ 1: _range(startsBefore: 'int bar', endsAfter: '// 4'),
+ });
+ }
+
+ Future<void> test_topLevel_languageVersion_dartDoc() async {
+ await resolveTestCode('''
+// @dart = 2.8
+
+/// 1
+int foo = 1; // 2
+
+/// 3
+int bar = 1; // 4
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '/// 1', endsAfter: '// 2'),
+ 1: _range(startsBefore: '/// 3', endsAfter: '// 4'),
+ });
+ }
+
+ Future<void> test_topLevel_languageVersion_noDartDoc() async {
+ await resolveTestCode('''
+// @dart = 2.8
+
+int foo = 1; // 2
+
+int bar = 1; // 4
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 2'),
+ 1: _range(startsBefore: 'int bar', endsAfter: '// 4'),
+ });
+ }
+
+ Future<void> test_topLevel_multiple_leading() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+int foo = 1;
+
+// 2
+int bar = 2;
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '= 1;'),
+ 1: _range(startsBefore: '// 2', endsAfter: '= 2;'),
+ });
+ }
+
+ Future<void> test_topLevel_multiple_leadingAndTrailing() async {
+ await resolveTestCode('''
+import '';
+
+// 2
+int foo = 1; // 3
+
+// 4
+int bar = 1; // 5
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 5'),
+ });
+ }
+
+ Future<void> test_topLevel_multiple_mixedComents() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+// 2
+int foo = 1; // 3
+
+// 4
+// 5
+int bar = 1; // 6
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 6'),
+ });
+ }
+
+ Future<void> test_topLevel_multiple_trailing() async {
+ await resolveTestCode('''
+int foo = 1; // 1
+int bar = 2; // 2
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 1'),
+ 1: _range(startsBefore: 'int bar', endsAfter: '// 2'),
+ });
+ }
+
+ Future<void> test_topLevel_noTrailingNewline_leading() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+int foo = 1;
+
+// 2
+int bar = 2;''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '= 1;'),
+ 1: _range(startsBefore: '// 2', endsAfter: '= 2;'),
+ });
+ }
+
+ Future<void> test_topLevel_noTrailingNewline_leadingAndTrailing() async {
+ await resolveTestCode('''
+import '';
+
+// 2
+int foo = 1; // 3
+
+// 4
+int bar = 1; // 5''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 5'),
+ });
+ }
+
+ Future<void>
+ test_topLevel_noTrailingNewline_leadingAndTrailing_withClassBraceTrailing() async {
+ await resolveTestCode('''
+import '';
+
+// 2
+int foo = 1; // 3
+
+// 4
+int bar = 1; // 5''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 5'),
+ });
+ }
+
+ Future<void> test_topLevel_noTrailingNewline_trailing() async {
+ await resolveTestCode('''
+import '';
+
+int foo = 1; // 1
+int bar = 2; // 2''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 1'),
+ 1: _range(startsBefore: 'int bar', endsAfter: '// 2'),
+ });
+ }
+
+ Future<void> test_topLevel_single_field_leading() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+int foo = 1;
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '= 1;'),
+ });
+ }
+
+ Future<void> test_topLevel_single_field_leadingAndTrailing() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+int foo = 1; // 2
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '// 2'),
+ });
+ }
+
+ Future<void>
+ test_topLevel_single_field_leadingAndTrailing_withClassBraceTrailing() async {
+ await resolveTestCode('''
+import '';
+
+// 2
+int foo = 1; // 3
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ });
+ }
+
+ Future<void> test_topLevel_single_field_trailing() async {
+ await resolveTestCode('''
+import '';
+
+int foo = 1; // 1
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 1'),
+ });
+ }
+
+ Future<void> test_topLevel_single_method_leading() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+foo() {}
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '{}'),
+ });
+ }
+
+ Future<void> test_topLevel_single_method_leadingAndTrailing() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+foo() {} // 2
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '// 2'),
+ });
+ }
+
+ Future<void>
+ test_topLevel_single_method_leadingAndTrailing_withClassBraceTrailing() async {
+ await resolveTestCode('''
+import '';
+
+// 1
+foo() {} // 2
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '// 2'),
+ });
+ }
+
+ Future<void> test_topLevel_single_method_trailing() async {
+ await resolveTestCode('''
+foo() {} // 1
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: 'foo()', endsAfter: '// 1'),
+ });
+ }
+
+ Future<void> test_topLevel_withDirectives_leading() async {
+ await resolveTestCode('''
+import 'dart:async';
+
+// 1
+int foo = 1;
+
+// 2
+int bar = 2;
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 1', endsAfter: '= 1;'),
+ 1: _range(startsBefore: '// 2', endsAfter: '= 2;'),
+ });
+ }
+
+ Future<void> test_topLevel_withDirectives_leadingAndTrailing() async {
+ await resolveTestCode('''
+import 'dart:async';
+
+// 2
+int foo = 1; // 3
+
+// 4
+int bar = 1; // 5
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 5'),
+ });
+ }
+
+ Future<void>
+ test_topLevel_withDirectives_leadingAndTrailing_withClassBraceTrailing() async {
+ await resolveTestCode('''
+import 'dart:async';
+
+// 2
+int foo = 1; // 3
+
+// 4
+int bar = 1; // 5
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: '// 2', endsAfter: '// 3'),
+ 1: _range(startsBefore: '// 4', endsAfter: '// 5'),
+ });
+ }
+
+ Future<void> test_topLevel_withDirectives_trailing() async {
+ await resolveTestCode('''
+import 'dart:async';
+
+int foo = 1; // 1
+int bar = 2; // 2
+''');
+ _assertUnitRanges({
+ 0: _range(startsBefore: 'int foo', endsAfter: '// 1'),
+ 1: _range(startsBefore: 'int bar', endsAfter: '// 2'),
+ });
}
}
diff --git a/pkg/analysis_server/test/verify_sorted_test.dart b/pkg/analysis_server/test/verify_sorted_test.dart
index 9033b16..bcde125 100644
--- a/pkg/analysis_server/test/verify_sorted_test.dart
+++ b/pkg/analysis_server/test/verify_sorted_test.dart
@@ -143,7 +143,7 @@
if (errors.isNotEmpty) {
fail('Errors found when parsing $path');
}
- var sorter = MemberSorter(code, unit);
+ var sorter = MemberSorter(code, unit, result.lineInfo);
var edits = sorter.sort();
if (edits.isNotEmpty) {
fail('Unsorted file $path');
diff --git a/pkg/analysis_server_client/test/verify_sorted_test.dart b/pkg/analysis_server_client/test/verify_sorted_test.dart
index f4f4c57..8380e74 100644
--- a/pkg/analysis_server_client/test/verify_sorted_test.dart
+++ b/pkg/analysis_server_client/test/verify_sorted_test.dart
@@ -65,7 +65,7 @@
if (errors.isNotEmpty) {
fail('Errors found when parsing $path');
}
- var sorter = MemberSorter(code, unit);
+ var sorter = MemberSorter(code, unit, result.lineInfo);
var edits = sorter.sort();
if (edits.isNotEmpty) {
fail('Unsorted file $path');
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index a0dc0ba..a38bdd2 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,22 @@
+## 3.0.0 (Not yet released - breaking changes)
+* Removed deprecated `DartType.aliasElement/aliasArguments`.
+* Removed deprecated constructors from `FeatureSet`.
+* Removed `UnitElementResult.signature` - unused by clients.
+* Removed deprecated `AnalysisError.withNamedArguments`.
+* Removed deprecated `ErrorReporter.reportErrorMessage`.
+* Removed deprecated `ResourceProvider.getModificationTimes()`.
+* Removed deprecated `MemoryResourceProvider.newDummyLink()`.
+* Removed deprecated `MemoryResourceProvider.updateFile()`.
+* Removed deprecated `Resource.parent`.
+* Removed deprecated `ResultState` and `AnalysisResult.state`.
+* Removed deprecated `summary_file_builder` library.
+* Removed deprecated `message` and `correction` from `ErrorCode`.
+* Removed deprecated `lookUp` methods from `InterfaceType`.
+* Removed deprecated `InterfaceType.getSmartLeastUpperBound`.
+* Removed deprecated `path` and `uri` from `AnalysisResult`.
+* Removed deprecated methods from `AnalysisSession`.
+* Removed `TypeName` and corresponding methods.
+
## 2.8.0
* Deprecations and renames for `getXyz` methods in `AnalysisDriver`.
* Removed uppercase named constants from `double` in mock SDK.
diff --git a/pkg/analyzer/lib/dart/analysis/features.dart b/pkg/analyzer/lib/dart/analysis/features.dart
index 91c3a30..2ac11df 100644
--- a/pkg/analyzer/lib/dart/analysis/features.dart
+++ b/pkg/analyzer/lib/dart/analysis/features.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/analysis/experiments.dart';
-import 'package:meta/meta.dart';
import 'package:pub_semver/pub_semver.dart';
/// Information about a single language feature whose presence or absence
@@ -74,23 +73,6 @@
/// An unordered collection of [Feature] objects.
abstract class FeatureSet {
- /// Computes a set of features for use in a unit test. Computes the set of
- /// features enabled in [sdkVersion], plus any specified [additionalFeatures].
- ///
- /// If [sdkVersion] is not supplied (or is `null`), then the current set of
- /// enabled features is used as the starting point.
- @visibleForTesting
- factory FeatureSet.forTesting(
- {String sdkVersion, List<Feature> additionalFeatures}) =
- // ignore: invalid_use_of_visible_for_testing_member
- ExperimentStatus.forTesting;
-
- /// Computes the set of features implied by the given set of experimental
- /// enable flags.
- @Deprecated("Use 'fromEnableFlags2' instead")
- factory FeatureSet.fromEnableFlags(List<String> flags) =
- ExperimentStatus.fromStrings;
-
/// Computes the set of features implied by the given set of experimental
/// enable flags.
factory FeatureSet.fromEnableFlags2({
diff --git a/pkg/analyzer/lib/dart/analysis/results.dart b/pkg/analyzer/lib/dart/analysis/results.dart
index a6f1df5..97198d9 100644
--- a/pkg/analyzer/lib/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/dart/analysis/results.dart
@@ -15,20 +15,8 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisResult {
- /// The absolute and normalized path of the file that was analyzed.
- @Deprecated('Use FileResult.path instead')
- String get path;
-
/// Return the session used to compute this result.
AnalysisSession get session;
-
- /// The state of the results.
- @Deprecated('Check for specific Result subtypes instead')
- ResultState get state;
-
- /// The absolute URI of the file that was analyzed.
- @Deprecated('Use FileResult.uri instead')
- Uri get uri;
}
/// An analysis result that includes the errors computed during analysis.
@@ -87,11 +75,9 @@
LineInfo get lineInfo;
/// The absolute and normalized path of the file that was analyzed.
- @override
String get path;
/// The absolute URI of the file that was analyzed.
- @override
Uri get uri;
}
@@ -254,31 +240,6 @@
CompilationUnit get unit;
}
-/// An indication of whether an analysis result is valid, and if not why.
-@Deprecated('Check for specific Result subtypes instead')
-enum ResultState {
- /// An indication that analysis could not be performed because the path
- /// represents a file of a type that cannot be analyzed.
- INVALID_FILE_TYPE,
-
- /// An indication that analysis could not be performed because the path does
- /// not represent a file. It might represent something else, such as a
- /// directory, or it might not represent anything.
- @Deprecated("Check 'get exists' flag instead")
- NOT_A_FILE,
-
- /// An indication that analysis could not be performed because the path does
- /// not represent the corresponding URI.
- ///
- /// This usually happens in Bazel workspaces, when a URI is resolved to
- /// a generated file, but there is also a writable file to which this URI
- /// would be resolved, if there were no generated file.
- NOT_FILE_OF_URI,
-
- /// An indication that analysis completed normally and the results are valid.
- VALID
-}
-
/// The result of computing all of the errors contained in a single file, both
/// syntactic and semantic.
///
@@ -353,18 +314,6 @@
abstract class UnitElementResult implements SomeUnitElementResult, FileResult {
/// The element of the file.
CompilationUnitElement get element;
-
- /// The signature of the library containing the [element]. This is the same
- /// signature returned by the method [AnalysisSession.getUnitElementSignature]
- /// when given the path to the compilation unit represented by the [element].
- ///
- /// The signature is based on the APIs of the files of the library (including
- /// the file itself), and the transitive closure of files imported and
- /// exported by the library. If the signature of a file has not changed, then
- /// there have been no changes that would cause any files that depend on it
- /// to need to be re-analyzed.
- @Deprecated('This field is not used by clients and will be removed')
- String get signature;
}
/// The type of [InvalidResult] returned when something is wrong, but we
diff --git a/pkg/analyzer/lib/dart/analysis/session.dart b/pkg/analyzer/lib/dart/analysis/session.dart
index ade0e8e..dc14b0a 100644
--- a/pkg/analyzer/lib/dart/analysis/session.dart
+++ b/pkg/analyzer/lib/dart/analysis/session.dart
@@ -37,71 +37,32 @@
/// a result state indicating the nature of the problem.
Future<SomeErrorsResult> getErrors(String path);
- /// Return a future that will complete with information about the errors
- /// contained in the file with the given absolute, normalized [path].
- ///
- /// If the file cannot be analyzed by this session, then the result will have
- /// a result state indicating the nature of the problem.
- @Deprecated('Use getErrors() instead')
- Future<SomeErrorsResult> getErrors2(String path);
-
/// Return information about the file at the given absolute, normalized
/// [path].
SomeFileResult getFile(String path);
- /// Return information about the file at the given absolute, normalized
- /// [path].
- @Deprecated('Use getFile() instead')
- SomeFileResult getFile2(String path);
-
/// Return a future that will complete with information about the library
/// element representing the library with the given [uri].
Future<SomeLibraryElementResult> getLibraryByUri(String uri);
- /// Return a future that will complete with information about the library
- /// element representing the library with the given [uri].
- @Deprecated('Use getLibraryByUri() instead')
- Future<SomeLibraryElementResult> getLibraryByUri2(String uri);
-
/// Return information about the results of parsing units of the library file
/// with the given absolute, normalized [path].
SomeParsedLibraryResult getParsedLibrary(String path);
/// Return information about the results of parsing units of the library file
- /// with the given absolute, normalized [path].
- @Deprecated('Use getParsedLibrary() instead')
- SomeParsedLibraryResult getParsedLibrary2(String path);
-
- /// Return information about the results of parsing units of the library file
/// with the given library [element].
SomeParsedLibraryResult getParsedLibraryByElement(LibraryElement element);
- /// Return information about the results of parsing units of the library file
- /// with the given library [element].
- @Deprecated('Use getParsedLibraryByElement() instead')
- SomeParsedLibraryResult getParsedLibraryByElement2(LibraryElement element);
-
/// Return information about the results of parsing the file with the given
/// absolute, normalized [path].
SomeParsedUnitResult getParsedUnit(String path);
- /// Return information about the results of parsing the file with the given
- /// absolute, normalized [path].
- @Deprecated('Use getParsedUnit() instead')
- SomeParsedUnitResult getParsedUnit2(String path);
-
/// Return a future that will complete with information about the results of
/// resolving all of the files in the library with the given absolute,
/// normalized [path].
Future<SomeResolvedLibraryResult> getResolvedLibrary(String path);
/// Return a future that will complete with information about the results of
- /// resolving all of the files in the library with the given absolute,
- /// normalized [path].
- @Deprecated('Use getResolvedLibrary() instead')
- Future<SomeResolvedLibraryResult> getResolvedLibrary2(String path);
-
- /// Return a future that will complete with information about the results of
/// resolving all of the files in the library with the library [element].
///
/// Throw [ArgumentError] if the [element] was not produced by this session.
@@ -109,32 +70,13 @@
LibraryElement element);
/// Return a future that will complete with information about the results of
- /// resolving all of the files in the library with the library [element].
- ///
- /// Throw [ArgumentError] if the [element] was not produced by this session.
- @Deprecated('Use getResolvedLibraryByElement() instead')
- Future<SomeResolvedLibraryResult> getResolvedLibraryByElement2(
- LibraryElement element);
-
- /// Return a future that will complete with information about the results of
/// resolving the file with the given absolute, normalized [path].
Future<SomeResolvedUnitResult> getResolvedUnit(String path);
/// Return a future that will complete with information about the results of
- /// resolving the file with the given absolute, normalized [path].
- @Deprecated('Use getResolvedUnit() instead')
- Future<SomeResolvedUnitResult> getResolvedUnit2(String path);
-
- /// Return a future that will complete with information about the results of
/// building the element model for the file with the given absolute,
/// normalized [path].
Future<SomeUnitElementResult> getUnitElement(String path);
-
- /// Return a future that will complete with information about the results of
- /// building the element model for the file with the given absolute,
- /// normalized [path].
- @Deprecated('Use getUnitElement() instead')
- Future<SomeUnitElementResult> getUnitElement2(String path);
}
/// The exception thrown by an [AnalysisSession] if a result is requested that
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index bf9af56..6e7d50d 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -592,9 +592,6 @@
R? visitTypeLiteral(TypeLiteral node);
- @Deprecated('Override visitNamedType instead')
- R? visitTypeName(TypeName node);
-
R? visitTypeParameter(TypeParameter node);
R? visitTypeParameterList(TypeParameterList node);
@@ -907,10 +904,6 @@
SimpleIdentifier get name;
/// Return the name of the superclass of the class being declared.
- @Deprecated('Use superclass2 instead')
- TypeName get superclass;
-
- /// Return the name of the superclass of the class being declared.
NamedType get superclass2;
/// Return the type parameters for the class, or `null` if the class does not
@@ -1337,10 +1330,6 @@
Token? get period;
/// Return the name of the type defining the constructor.
- @Deprecated('Use type2 instead')
- TypeName get type;
-
- /// Return the name of the type defining the constructor.
NamedType get type2;
}
@@ -1734,10 +1723,6 @@
Token get extendsKeyword;
/// Return the name of the class that is being extended.
- @Deprecated('Use superclass2 instead')
- TypeName get superclass;
-
- /// Return the name of the class that is being extended.
NamedType get superclass2;
}
@@ -2635,10 +2620,6 @@
Token get implementsKeyword;
/// Return the list of the interfaces that are being implemented.
- @Deprecated('Use interfaces2 instead')
- NodeList<TypeName> get interfaces;
-
- /// Return the list of the interfaces that are being implemented.
NodeList<NamedType> get interfaces2;
}
@@ -3491,10 +3472,6 @@
Token get onKeyword;
/// Return the list of the classes are superclass constraints for the mixin.
- @Deprecated('Use superclassConstraints2 instead')
- NodeList<TypeName> get superclassConstraints;
-
- /// Return the list of the classes are superclass constraints for the mixin.
NodeList<NamedType> get superclassConstraints2;
}
@@ -4376,21 +4353,8 @@
abstract class TypeLiteral implements Expression, CommentReferableExpression {
/// The type represented by this literal.
NamedType get type;
-
- /// The type represented by this literal.
- @Deprecated('Use namedType instead')
- TypeName get typeName;
}
-/// The name of a type, which can optionally include type arguments.
-///
-/// typeName ::=
-/// [Identifier] typeArguments?
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Use NamedType instead')
-abstract class TypeName implements NamedType {}
-
/// A type parameter.
///
/// typeParameter ::=
@@ -4591,10 +4555,6 @@
/// Clients may not extend, implement or mix-in this class.
abstract class WithClause implements AstNode {
/// Return the names of the mixins that were specified.
- @Deprecated('Use mixinTypes2 instead')
- NodeList<TypeName> get mixinTypes;
-
- /// Return the names of the mixins that were specified.
NodeList<NamedType> get mixinTypes2;
/// Return the token representing the 'with' keyword.
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index 29187a7..45c0d49 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -968,13 +968,6 @@
/// Returns a newly created type literal.
TypeLiteral typeLiteral({required NamedType typeName});
- /// Returns a newly created type name. The [typeArguments] can be `null` if
- /// there are no type arguments. The [question] can be `null` if there is no
- /// question mark.
- @Deprecated('Use namedType() instead')
- TypeName typeName(Identifier name, TypeArgumentList? typeArguments,
- {Token? question});
-
/// Returns a newly created type parameter. Either or both of the [comment]
/// and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
diff --git a/pkg/analyzer/lib/dart/ast/visitor.dart b/pkg/analyzer/lib/dart/ast/visitor.dart
index 65551ac..a77a83e 100644
--- a/pkg/analyzer/lib/dart/ast/visitor.dart
+++ b/pkg/analyzer/lib/dart/ast/visitor.dart
@@ -453,8 +453,7 @@
R? visitNamedExpression(NamedExpression node) => visitExpression(node);
@override
- // ignore: deprecated_member_use_from_same_package
- R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+ R? visitNamedType(NamedType node) => visitNode(node);
R? visitNamespaceDirective(NamespaceDirective node) =>
visitUriBasedDirective(node);
@@ -603,10 +602,6 @@
@override
R? visitTypeLiteral(TypeLiteral node) => visitExpression(node);
- @Deprecated('Override visitNamedType instead')
- @override
- R? visitTypeName(TypeName node) => visitNode(node);
-
@override
R? visitTypeParameter(TypeParameter node) => visitNode(node);
@@ -1151,8 +1146,8 @@
@override
R? visitNamedType(NamedType node) {
- // ignore: deprecated_member_use_from_same_package
- return visitTypeName(node as TypeName);
+ node.visitChildren(this);
+ return null;
}
@override
@@ -1378,13 +1373,6 @@
return null;
}
- @Deprecated('Override visitNamedType instead')
- @override
- R? visitTypeName(TypeName node) {
- node.visitChildren(this);
- return null;
- }
-
@override
R? visitTypeParameter(TypeParameter node) {
node.visitChildren(this);
@@ -1697,8 +1685,7 @@
R? visitNamedExpression(NamedExpression node) => null;
@override
- // ignore: deprecated_member_use_from_same_package
- R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+ R? visitNamedType(NamedType node) => null;
@override
R? visitNativeClause(NativeClause node) => null;
@@ -1813,10 +1800,6 @@
@override
R? visitTypeLiteral(TypeLiteral node) => null;
- @Deprecated('Override visitNamedType instead')
- @override
- R? visitTypeName(TypeName node) => null;
-
@override
R? visitTypeParameter(TypeParameter node) => null;
@@ -2112,8 +2095,7 @@
R? visitNamedExpression(NamedExpression node) => _throw(node);
@override
- // ignore: deprecated_member_use_from_same_package
- R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+ R? visitNamedType(NamedType node) => _throw(node);
@override
R? visitNativeClause(NativeClause node) => _throw(node);
@@ -2230,10 +2212,6 @@
@override
R? visitTypeLiteral(TypeLiteral node) => _throw(node);
- @Deprecated('Override visitNamedType instead')
- @override
- R? visitTypeName(TypeName node) => _throw(node);
-
@override
R? visitTypeParameter(TypeParameter node) => _throw(node);
@@ -3248,15 +3226,6 @@
return result;
}
- @Deprecated('Override visitNamedType instead')
- @override
- T? visitTypeName(TypeName node) {
- stopwatch.start();
- T? result = _baseVisitor.visitTypeName(node);
- stopwatch.stop();
- return result;
- }
-
@override
T? visitTypeParameter(TypeParameter node) {
stopwatch.start();
@@ -3601,8 +3570,7 @@
R? visitNamedExpression(NamedExpression node) => visitNode(node);
@override
- // ignore: deprecated_member_use_from_same_package
- R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+ R? visitNamedType(NamedType node) => visitNode(node);
@override
R? visitNativeClause(NativeClause node) => visitNode(node);
@@ -3725,10 +3693,6 @@
@override
R? visitTypeLiteral(TypeLiteral node) => visitNode(node);
- @Deprecated('Override visitNamedType instead')
- @override
- R? visitTypeName(TypeName node) => visitNode(node);
-
@override
R? visitTypeParameter(TypeParameter node) => visitNode(node);
diff --git a/pkg/analyzer/lib/dart/element/type.dart b/pkg/analyzer/lib/dart/element/type.dart
index 2ff16e0..923cc3f 100644
--- a/pkg/analyzer/lib/dart/element/type.dart
+++ b/pkg/analyzer/lib/dart/element/type.dart
@@ -22,7 +22,6 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type_visitor.dart';
-import 'package:analyzer/src/dart/element/type.dart' show InterfaceTypeImpl;
/// The type associated with elements in the element model.
///
@@ -33,16 +32,6 @@
/// Otherwise return `null`.
InstantiatedTypeAliasElement? get alias;
- /// If this type is an instantiation of a type alias, return the type
- /// arguments used for the instantiation. Otherwise return `null`.
- @Deprecated('Use alias instead')
- List<DartType>? get aliasArguments;
-
- /// If this type is an instantiation of a type alias, return it.
- /// Otherwise return `null`.
- @Deprecated('Use alias instead')
- TypeAliasElement? get aliasElement;
-
/// Return the name of this type as it should appear when presented to users
/// in contexts such as error messages.
///
@@ -337,23 +326,6 @@
/// </blockquote>
ConstructorElement? lookUpConstructor(String? name, LibraryElement library);
- /// Return the element representing the getter that results from looking up
- /// the getter with the given [name] in this class with respect to the given
- /// [library], or `null` if the look up fails. The behavior of this method is
- /// defined by the Dart Language Specification in section 12.15.1:
- /// <blockquote>
- /// The result of looking up getter (respectively setter) <i>m</i> in class
- /// <i>C</i> with respect to library <i>L</i> is:
- /// * If <i>C</i> declares an instance getter (respectively setter) named
- /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- /// superclass <i>S</i>, then the result of the lookup is the result of
- /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
- /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
- /// </blockquote>
- @Deprecated('Use lookupGetter2 instead')
- PropertyAccessorElement? lookUpGetter(String name, LibraryElement library);
-
/// Return the getter with the given [name].
///
/// If [concrete] is `true`, then the concrete implementation is returned,
@@ -372,93 +344,6 @@
bool recoveryStatic = false,
});
- /// Return the element representing the getter that results from looking up
- /// the getter with the given [name] in the superclass of this class with
- /// respect to the given [library], or `null` if the look up fails. The
- /// behavior of this method is defined by the Dart Language Specification in
- /// section 12.15.1:
- /// <blockquote>
- /// The result of looking up getter (respectively setter) <i>m</i> in class
- /// <i>C</i> with respect to library <i>L</i> is:
- /// * If <i>C</i> declares an instance getter (respectively setter) named
- /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- /// superclass <i>S</i>, then the result of the lookup is the result of
- /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
- /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
- /// </blockquote>
- @Deprecated('Use lookupGetter2 instead')
- PropertyAccessorElement? lookUpGetterInSuperclass(
- String name, LibraryElement? library);
-
- /// Look up the member with the given [name] in this type and all extended
- /// and mixed in classes, and by default including [thisType]. If the search
- /// fails, this will then search interfaces.
- ///
- /// Return the element representing the member that was found, or `null` if
- /// there is no getter with the given name.
- ///
- /// The [library] determines if a private member name is visible, and does not
- /// need to be supplied for public names.
- @Deprecated('Use lookupGetter2 instead')
- PropertyAccessorElement? lookUpInheritedGetter(String name,
- {LibraryElement? library, bool thisType = true});
-
- /// Look up the member with the given [name] in this type and all extended
- /// and mixed in classes, starting from this type. If the search fails,
- /// search interfaces.
- ///
- /// Return the element representing the member that was found, or `null` if
- /// there is no getter with the given name.
- ///
- /// The [library] determines if a private member name is visible, and does not
- /// need to be supplied for public names.
- @Deprecated('Use lookupGetter2 and/or lookupMethod2 instead')
- ExecutableElement? lookUpInheritedGetterOrMethod(String name,
- {LibraryElement? library});
-
- /// Look up the member with the given [name] in this type and all extended
- /// and mixed in classes, and by default including [thisType]. If the search
- /// fails, this will then search interfaces.
- ///
- /// Return the element representing the member that was found, or `null` if
- /// there is no getter with the given name.
- ///
- /// The [library] determines if a private member name is visible, and does not
- /// need to be supplied for public names.
- @Deprecated('Use lookupMethod2 instead')
- MethodElement? lookUpInheritedMethod(String name,
- {LibraryElement? library, bool thisType = true});
-
- /// Look up the member with the given [name] in this type and all extended
- /// and mixed in classes, and by default including [thisType]. If the search
- /// fails, this will then search interfaces.
- ///
- /// Return the element representing the member that was found, or `null` if
- /// there is no getter with the given name.
- ///
- /// The [library] determines if a private member name is visible, and does not
- /// need to be supplied for public names.
- @Deprecated('Use lookupSetter2 instead')
- PropertyAccessorElement? lookUpInheritedSetter(String name,
- {LibraryElement? library, bool thisType = true});
-
- /// Return the element representing the method that results from looking up
- /// the method with the given [name] in this class with respect to the given
- /// [library], or `null` if the look up fails. The behavior of this method is
- /// defined by the Dart Language Specification in section 12.15.1:
- /// <blockquote>
- /// The result of looking up method <i>m</i> in class <i>C</i> with respect to
- /// library <i>L</i> is:
- /// * If <i>C</i> declares an instance method named <i>m</i> that is
- /// accessible to <i>L</i>, then that method is the result of the lookup.
- /// Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the
- /// lookup is the result of looking up method <i>m</i> in <i>S</i> with
- /// respect to <i>L</i> Otherwise, we say that the lookup has failed.
- /// </blockquote>
- @Deprecated('Use lookupMethod2 instead')
- MethodElement? lookUpMethod(String name, LibraryElement library);
-
/// Return the method with the given [name].
///
/// If [concrete] is `true`, then the concrete implementation is returned,
@@ -477,41 +362,6 @@
bool recoveryStatic = false,
});
- /// Return the element representing the method that results from looking up
- /// the method with the given [name] in the superclass of this class with
- /// respect to the given [library], or `null` if the look up fails. The
- /// behavior of this method is defined by the Dart Language Specification in
- /// section 12.15.1:
- /// <blockquote>
- /// The result of looking up method <i>m</i> in class <i>C</i> with respect to
- /// library <i>L</i> is:
- /// * If <i>C</i> declares an instance method named <i>m</i> that is
- /// accessible to <i>L</i>, then that method is the result of the lookup.
- /// Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the
- /// * lookup is the result of looking up method <i>m</i> in <i>S</i> with
- /// respect to <i>L</i>.
- /// * Otherwise, we say that the lookup has failed.
- /// </blockquote>
- @Deprecated('Use lookupMethod2 instead')
- MethodElement? lookUpMethodInSuperclass(String name, LibraryElement library);
-
- /// Return the element representing the setter that results from looking up
- /// the setter with the given [name] in this class with respect to the given
- /// [library], or `null` if the look up fails. The behavior of this method is
- /// defined by the Dart Language Specification in section 12.16:
- /// <blockquote>
- /// The result of looking up getter (respectively setter) <i>m</i> in class
- /// <i>C</i> with respect to library <i>L</i> is:
- /// * If <i>C</i> declares an instance getter (respectively setter) named
- /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- /// superclass <i>S</i>, then the result of the lookup is the result of
- /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
- /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
- /// </blockquote>
- @Deprecated('Use lookupSetter2 instead')
- PropertyAccessorElement? lookUpSetter(String name, LibraryElement library);
-
/// Return the setter with the given [name].
///
/// If [concrete] is `true`, then the concrete implementation is returned,
@@ -529,36 +379,6 @@
bool inherited = false,
bool recoveryStatic = false,
});
-
- /// Return the element representing the setter that results from looking up
- /// the setter with the given [name] in the superclass of this class with
- /// respect to the given [library], or `null` if the look up fails. The
- /// behavior of this method is defined by the Dart Language Specification in
- /// section 12.16:
- /// <blockquote>
- /// The result of looking up getter (respectively setter) <i>m</i> in class
- /// <i>C</i> with respect to library <i>L</i> is:
- /// * If <i>C</i> declares an instance getter (respectively setter) named
- /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- /// superclass <i>S</i>, then the result of the lookup is the result of
- /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
- /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
- /// </blockquote>
- @Deprecated('Use lookupSetter2 instead')
- PropertyAccessorElement? lookUpSetterInSuperclass(
- String name, LibraryElement library);
-
- /// Returns a "smart" version of the "least upper bound" of the given types.
- ///
- /// If these types have the same element and differ only in terms of the type
- /// arguments, attempts to find a compatible set of type arguments.
- ///
- /// Otherwise, returns the same result as [DartType.getLeastUpperBound].
- @Deprecated('Use TypeSystem.leastUpperBound instead')
- static InterfaceType getSmartLeastUpperBound(
- InterfaceType first, InterfaceType second) =>
- InterfaceTypeImpl.getSmartLeastUpperBound(first, second);
}
/// The type `Never` represents the uninhabited bottom type.
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index b4924ce..80ccf01 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -1024,21 +1024,6 @@
url: null);
}
- /// Initialize a newly created analysis error. The error is associated with
- /// the given [source] and is located at the given [offset] with the given
- /// [length]. The error will have the given [errorCode] and the map of
- /// [arguments] will be used to complete the message and correction. If any
- /// [contextMessages] are provided, they will be recorded with the error.
- ///
- /// Deprecated - no analyzer errors use named arguments anymore. Please use
- /// `AnalysisError()`.
- @deprecated
- AnalysisError.withNamedArguments(Source source, int offset, int length,
- ErrorCode errorCode, Map<String, dynamic> arguments,
- {List<DiagnosticMessage> contextMessages = const []})
- : this(source, offset, length, errorCode,
- _translateNamedArguments(arguments), contextMessages);
-
@override
List<DiagnosticMessage> get contextMessages => _contextMessages;
@@ -1137,20 +1122,4 @@
}
return errors.toList();
}
-
- static Null _translateNamedArguments(Map<String, dynamic> arguments) {
- // All analyzer errors now use positional arguments, so if this method is
- // being called, either no arguments were provided to the
- // AnalysisError.withNamedArguments constructor, or the client was
- // developed against an older version of the analyzer that used named
- // arguments. In either case, we'll make a best effort translation of named
- // arguments to positional ones. In the case where some arguments were
- // provided, we have an assertion to alert the developer that they may not
- // get correct results.
- assert(
- arguments.isEmpty,
- 'AnalysisError.withNamedArguments is no longer supported. Making a '
- 'best effort translation to positional arguments. Please use '
- 'AnalysisError() instead.');
- }
}
diff --git a/pkg/analyzer/lib/error/listener.dart b/pkg/analyzer/lib/error/listener.dart
index 6209775..807499c 100644
--- a/pkg/analyzer/lib/error/listener.dart
+++ b/pkg/analyzer/lib/error/listener.dart
@@ -4,7 +4,6 @@
import 'dart:collection';
-import 'package:_fe_analyzer_shared/src/messages/codes.dart' show Message;
import 'package:analyzer/dart/ast/ast.dart'
show AstNode, ConstructorDeclaration;
import 'package:analyzer/dart/ast/token.dart';
@@ -125,19 +124,6 @@
errorCode, token.offset, token.length, arguments, messages);
}
- /// Report an error with the given [errorCode] and [message]. The location of
- /// the error is specified by the given [offset] and [length].
- ///
- /// Deprecated - the [Message] type assumes named arguments, and no analyzer
- /// errors use named arguments anymore. Please use other methods of
- /// [ErrorReporter].
- @deprecated
- void reportErrorMessage(
- ErrorCode errorCode, int offset, int length, Message message) {
- _errorListener.onError(AnalysisError.withNamedArguments(
- _source, offset, length, errorCode, message.arguments));
- }
-
/// Report an error with the given [errorCode] and [arguments]. The [node] is
/// used to compute the location of the error. The arguments are expected to
/// contain two or more types. Convert the types into strings by using the
diff --git a/pkg/analyzer/lib/file_system/file_system.dart b/pkg/analyzer/lib/file_system/file_system.dart
index 52bb3d7..0a2bd5d 100644
--- a/pkg/analyzer/lib/file_system/file_system.dart
+++ b/pkg/analyzer/lib/file_system/file_system.dart
@@ -127,11 +127,6 @@
/// Return `true` if this resource exists.
bool get exists;
- /// Return the [Folder] that contains this resource, or `null` if this
- /// resource is a root folder.
- @Deprecated('Use parent2 instead')
- Folder? get parent;
-
/// Return the [Folder] that contains this resource, possibly itself if this
/// resource is a root folder.
Folder get parent2;
@@ -196,13 +191,6 @@
/// A folder may or may not exist at this location.
Folder getFolder(String path);
- /// Complete with a list of modification times for the given [sources].
- ///
- /// If the file of a source is not managed by this provider, return `null`.
- /// If the file a source does not exist, return `-1`.
- @Deprecated('Not used by clients')
- Future<List<int?>> getModificationTimes(List<Source> sources);
-
/// Return the [Resource] that corresponds to the given [path].
///
/// The [path] must be absolute and normalized.
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index ce09cee..21ffb07 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -22,8 +22,7 @@
final pathos.Context _pathContext;
- MemoryResourceProvider(
- {pathos.Context? context, @deprecated bool isWindows = false})
+ MemoryResourceProvider({pathos.Context? context})
: _pathContext = context ??= pathos.style == pathos.Style.windows
// On Windows, ensure that the current drive matches
// the drive inserted by MemoryResourceProvider.convertPath
@@ -106,20 +105,6 @@
return _MemoryFolder(this, path);
}
- @Deprecated('Not used by clients')
- @override
- Future<List<int>> getModificationTimes(List<Source> sources) async {
- return sources.map((source) {
- String path = source.fullName;
- var file = getFile(path);
- try {
- return file.modificationStamp;
- } on FileSystemException {
- return -1;
- }
- }).toList();
- }
-
@override
Resource getResource(String path) {
_ensureAbsoluteAndNormalized(path);
@@ -148,17 +133,6 @@
_notifyWatchers(path, ChangeType.MODIFY);
}
- /// Create a resource representing a dummy link (that is, a File object which
- /// appears in its parent directory, but whose `exists` property is false)
- @Deprecated('Not used by clients')
- File newDummyLink(String path) {
- _ensureAbsoluteAndNormalized(path);
- newFolder(pathContext.dirname(path));
- _MemoryDummyLink link = _MemoryDummyLink(this, path);
- _notifyWatchers(path, ChangeType.ADD);
- return link;
- }
-
File newFile(
String path,
String content, [
@@ -202,18 +176,6 @@
_pathToLinkedPath[path] = target;
}
- @Deprecated('Not used by clients')
- File updateFile(String path, String content, [int? stamp]) {
- _ensureAbsoluteAndNormalized(path);
- newFolder(pathContext.dirname(path));
- _pathToData[path] = _FileData(
- bytes: utf8.encode(content) as Uint8List,
- timeStamp: stamp ?? nextStamp++,
- );
- _notifyWatchers(path, ChangeType.MODIFY);
- return _MemoryFile(this, path);
- }
-
/// Write a representation of the file system on the given [sink].
void writeOn(StringSink sink) {
List<String> paths = _pathToData.keys.toList();
@@ -360,81 +322,6 @@
final List<String> childNames = [];
}
-/// An in-memory implementation of [File] which acts like a symbolic link to a
-/// non-existent file.
-class _MemoryDummyLink extends _MemoryResource implements File {
- _MemoryDummyLink(MemoryResourceProvider provider, String path)
- : super(provider, path);
-
- @override
- Stream<WatchEvent> get changes {
- throw FileSystemException(path, "File does not exist");
- }
-
- @override
- bool get exists => false;
-
- @override
- int get lengthSync {
- throw FileSystemException(path, 'File could not be read');
- }
-
- @override
- int get modificationStamp {
- throw FileSystemException(path, "File does not exist");
- }
-
- @override
- File copyTo(Folder parentFolder) {
- throw FileSystemException(path, 'File could not be copied');
- }
-
- @override
- Source createSource([Uri? uri]) {
- throw FileSystemException(path, 'File could not be read');
- }
-
- @override
- void delete() {
- throw FileSystemException(path, 'File could not be deleted');
- }
-
- @override
- bool isOrContains(String path) {
- return path == this.path;
- }
-
- @override
- Uint8List readAsBytesSync() {
- throw FileSystemException(path, 'File could not be read');
- }
-
- @override
- String readAsStringSync() {
- throw FileSystemException(path, 'File could not be read');
- }
-
- @override
- File renameSync(String newPath) {
- throw FileSystemException(path, 'File could not be renamed');
- }
-
- @override
- File resolveSymbolicLinksSync() {
- return throw FileSystemException(path, "File does not exist");
- }
-
- @override
- void writeAsBytesSync(List<int> bytes) {
- throw FileSystemException(path, 'File could not be written');
- }
-
- @override
- void writeAsStringSync(String content) {
- throw FileSystemException(path, 'File could not be written');
- }
-}
-
/// An in-memory implementation of [File].
class _MemoryFile extends _MemoryResource implements File {
_MemoryFile(MemoryResourceProvider provider, String path)
@@ -699,16 +586,6 @@
@override
int get hashCode => path.hashCode;
- @Deprecated('Use parent2 instead')
- @override
- Folder? get parent {
- String parentPath = provider.pathContext.dirname(path);
- if (parentPath == path) {
- return null;
- }
- return provider.getFolder(parentPath);
- }
-
@override
Folder get parent2 {
String parentPath = provider.pathContext.dirname(path);
diff --git a/pkg/analyzer/lib/file_system/overlay_file_system.dart b/pkg/analyzer/lib/file_system/overlay_file_system.dart
index 559d80e..00d6da8 100644
--- a/pkg/analyzer/lib/file_system/overlay_file_system.dart
+++ b/pkg/analyzer/lib/file_system/overlay_file_system.dart
@@ -40,16 +40,6 @@
Folder getFolder(String path) =>
_OverlayFolder(this, baseProvider.getFolder(path));
- @Deprecated('Not used by clients')
- @override
- Future<List<int>> getModificationTimes(List<Source> sources) async {
- return sources.map((source) {
- String path = source.fullName;
- return _overlays[path]?.modificationStamp ??
- baseProvider.getFile(path).modificationStamp;
- }).toList();
- }
-
@override
Resource getResource(String path) {
if (hasOverlay(path)) {
@@ -354,16 +344,6 @@
@override
int get hashCode => path.hashCode;
- @Deprecated('Use parent2 instead')
- @override
- Folder? get parent {
- Folder? parent = _resource.parent;
- if (parent == null) {
- return null;
- }
- return _OverlayFolder(provider, parent);
- }
-
@override
Folder get parent2 {
var parent = _resource.parent2;
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index 3f16df1..bc4791d 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -32,27 +32,6 @@
: null;
}
-/// Return modification times for every file path in [paths].
-///
-/// If a path is `null`, the modification time is also `null`.
-///
-/// If any exception happens, the file is considered as a not existing and
-/// `-1` is its modification time.
-List<int?> _pathsToTimes(List<String?> paths) {
- return paths.map((path) {
- if (path != null) {
- try {
- io.File file = io.File(path);
- return file.lastModifiedSync().millisecondsSinceEpoch;
- } catch (_) {
- return -1;
- }
- } else {
- return null;
- }
- }).toList();
-}
-
/// A `dart:io` based implementation of [ResourceProvider].
class PhysicalResourceProvider implements ResourceProvider {
static final PhysicalResourceProvider INSTANCE = PhysicalResourceProvider();
@@ -78,13 +57,6 @@
return _PhysicalFolder(io.Directory(path));
}
- @Deprecated('Not used by clients')
- @override
- Future<List<int?>> getModificationTimes(List<Source> sources) async {
- List<String> paths = sources.map((source) => source.fullName).toList();
- return _pathsToTimes(paths);
- }
-
@override
Resource getResource(String path) {
_ensureAbsoluteAndNormalized(path);
@@ -356,16 +328,6 @@
@override
int get hashCode => path.hashCode;
- @Deprecated('Use parent2 instead')
- @override
- Folder? get parent {
- String parentPath = pathContext.dirname(path);
- if (parentPath == path) {
- return null;
- }
- return _PhysicalFolder(io.Directory(parentPath));
- }
-
@override
Folder get parent2 {
String parentPath = pathContext.dirname(path);
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index f632148..88c2ab5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -779,7 +779,7 @@
units.add(unitResult);
}
- return ParsedLibraryResultImpl(currentSession, path, file.uri, units);
+ return ParsedLibraryResultImpl(currentSession, units);
}
/// Return a [ParsedLibraryResult] for the library with the given [uri].
@@ -1547,8 +1547,6 @@
return ResolvedLibraryResultImpl(
currentSession,
- library.path,
- library.uri,
resolvedUnits.first.libraryElement,
resolvedUnits,
);
@@ -1579,7 +1577,6 @@
file.uri,
file.lineInfo,
file.isPart,
- library.transitiveSignature,
element,
);
});
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
index 7d99407..b00f8df 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
@@ -51,37 +51,6 @@
return ExperimentStatus.latestLanguageVersion();
}
- /// Computes a set of features for use in a unit test. Computes the set of
- /// features enabled in [sdkVersion], plus any specified [additionalFeatures].
- ///
- /// If [sdkVersion] is not supplied (or is `null`), then the current set of
- /// enabled features is used as the starting point.
- @visibleForTesting
- factory ExperimentStatus.forTesting(
- // ignore:avoid_unused_constructor_parameters
- {String? sdkVersion,
- List<Feature> additionalFeatures = const []}) {
- var explicitFlags = decodeExplicitFlags([]);
- for (var feature in additionalFeatures) {
- explicitFlags.enabled[(feature as ExperimentalFeature).index] = true;
- }
-
- var sdkLanguageVersion = currentVersion;
- var flags = restrictEnableFlagsToVersion(
- sdkLanguageVersion: sdkLanguageVersion,
- explicitEnabledFlags: explicitFlags.enabled,
- explicitDisabledFlags: explicitFlags.disabled,
- version: sdkLanguageVersion,
- );
-
- return ExperimentStatus._(
- sdkLanguageVersion,
- explicitFlags.enabled,
- explicitFlags.disabled,
- flags,
- );
- }
-
factory ExperimentStatus.fromStorage(Uint8List encoded) {
var byteIndex = 0;
@@ -121,19 +90,6 @@
/// Always succeeds, even if the input flags are invalid. Expired and
/// unrecognized flags are ignored, conflicting flags are resolved in favor of
/// the flag appearing last.
- factory ExperimentStatus.fromStrings(List<String> flags) {
- return ExperimentStatus.fromStrings2(
- sdkLanguageVersion: currentVersion,
- flags: flags,
- );
- }
-
- /// Decodes the strings given in [flags] into a representation of the set of
- /// experiments that should be enabled.
- ///
- /// Always succeeds, even if the input flags are invalid. Expired and
- /// unrecognized flags are ignored, conflicting flags are resolved in favor of
- /// the flag appearing last.
factory ExperimentStatus.fromStrings2({
required Version sdkLanguageVersion,
required List<String> flags,
diff --git a/pkg/analyzer/lib/src/dart/analysis/results.dart b/pkg/analyzer/lib/src/dart/analysis/results.dart
index a8184db..e799e6d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/results.dart
@@ -16,15 +16,7 @@
@override
final AnalysisSession session;
- @Deprecated('Use FileResult.path instead')
- @override
- final String path;
-
- @Deprecated('Use FileResult.uri instead')
- @override
- final Uri uri;
-
- AnalysisResultImpl(this.session, this.path, this.uri);
+ AnalysisResultImpl(this.session);
}
class ElementDeclarationResultImpl implements ElementDeclarationResult {
@@ -55,28 +47,20 @@
class FileResultImpl extends AnalysisResultImpl implements FileResult {
@override
+ final String path;
+
+ @override
+ final Uri uri;
+
+ @override
final LineInfo lineInfo;
@override
final bool isPart;
FileResultImpl(
- AnalysisSession session, String path, Uri uri, this.lineInfo, this.isPart)
- : super(session, path, uri);
-
- @override
- // TODO(scheglov) Convert into a field.
- // ignore: deprecated_member_use_from_same_package, unnecessary_overrides
- String get path => super.path;
-
- @Deprecated('Check for specific Result subtypes instead')
- @override
- ResultState get state => ResultState.VALID;
-
- @override
- // TODO(scheglov) Convert into a field.
- // ignore: deprecated_member_use_from_same_package, unnecessary_overrides
- Uri get uri => super.uri;
+ AnalysisSession session, this.path, this.uri, this.lineInfo, this.isPart)
+ : super(session);
}
class LibraryElementResultImpl implements LibraryElementResult {
@@ -91,15 +75,7 @@
@override
final List<ParsedUnitResult> units;
- ParsedLibraryResultImpl(
- AnalysisSession session, String path, Uri uri, this.units)
- : super(session, path, uri);
-
- @Deprecated('Check for specific Result subtypes instead')
- @override
- ResultState get state {
- return ResultState.VALID;
- }
+ ParsedLibraryResultImpl(AnalysisSession session, this.units) : super(session);
@override
ElementDeclarationResult? getElementDeclaration(Element element) {
@@ -145,10 +121,6 @@
ParsedUnitResultImpl(AnalysisSession session, String path, Uri uri,
this.content, LineInfo lineInfo, bool isPart, this.unit, this.errors)
: super(session, path, uri, lineInfo, isPart);
-
- @Deprecated('Check for specific Result subtypes instead')
- @override
- ResultState get state => ResultState.VALID;
}
class ParseStringResultImpl implements ParseStringResult {
@@ -217,15 +189,8 @@
@override
final List<ResolvedUnitResult> units;
- ResolvedLibraryResultImpl(
- AnalysisSession session, String path, Uri uri, this.element, this.units)
- : super(session, path, uri);
-
- @Deprecated('Check for specific Result subtypes instead')
- @override
- ResultState get state {
- return ResultState.VALID;
- }
+ ResolvedLibraryResultImpl(AnalysisSession session, this.element, this.units)
+ : super(session);
@override
TypeProvider get typeProvider => element.typeProvider;
@@ -292,10 +257,6 @@
return unit.declaredElement!.library;
}
- @Deprecated('Check for specific Result subtypes instead')
- @override
- ResultState get state => ResultState.VALID;
-
@override
TypeProvider get typeProvider => libraryElement.typeProvider;
@@ -306,18 +267,11 @@
class UnitElementResultImpl extends FileResultImpl
implements UnitElementResult {
@override
- final String signature;
-
- @override
final CompilationUnitElement element;
UnitElementResultImpl(AnalysisSession session, String path, Uri uri,
- LineInfo lineInfo, bool isPart, this.signature, this.element)
+ LineInfo lineInfo, bool isPart, this.element)
: super(session, path, uri, lineInfo, isPart);
-
- @Deprecated('Check for specific Result subtypes instead')
- @override
- ResultState get state => ResultState.VALID;
}
class _DeclarationByElementLocator extends GeneralizingAstVisitor<void> {
diff --git a/pkg/analyzer/lib/src/dart/analysis/session.dart b/pkg/analyzer/lib/src/dart/analysis/session.dart
index 6376bc1..32eeaca 100644
--- a/pkg/analyzer/lib/src/dart/analysis/session.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/session.dart
@@ -60,48 +60,24 @@
return _driver.getErrors(path);
}
- @Deprecated('Use getErrors() instead')
- @override
- Future<SomeErrorsResult> getErrors2(String path) {
- return getErrors(path);
- }
-
@override
SomeFileResult getFile(String path) {
_checkConsistency();
return _driver.getFileSync(path);
}
- @Deprecated('Use getFile() instead')
- @override
- SomeFileResult getFile2(String path) {
- return getFile(path);
- }
-
@override
Future<SomeLibraryElementResult> getLibraryByUri(String uri) {
_checkConsistency();
return _driver.getLibraryByUri(uri);
}
- @Deprecated('Use getLibraryByUri() instead')
- @override
- Future<SomeLibraryElementResult> getLibraryByUri2(String uri) {
- return getLibraryByUri(uri);
- }
-
@override
SomeParsedLibraryResult getParsedLibrary(String path) {
_checkConsistency();
return _driver.getParsedLibrary(path);
}
- @Deprecated('Use getParsedLibrary() instead')
- @override
- SomeParsedLibraryResult getParsedLibrary2(String path) {
- return getParsedLibrary(path);
- }
-
@override
SomeParsedLibraryResult getParsedLibraryByElement(LibraryElement element) {
_checkConsistency();
@@ -113,36 +89,18 @@
return _driver.getParsedLibraryByUri(element.source.uri);
}
- @Deprecated('Use getParsedLibraryByElement() instead')
- @override
- SomeParsedLibraryResult getParsedLibraryByElement2(LibraryElement element) {
- return getParsedLibraryByElement(element);
- }
-
@override
SomeParsedUnitResult getParsedUnit(String path) {
_checkConsistency();
return _driver.parseFileSync(path);
}
- @Deprecated('Use getParsedUnit() instead')
- @override
- SomeParsedUnitResult getParsedUnit2(String path) {
- return getParsedUnit(path);
- }
-
@override
Future<SomeResolvedLibraryResult> getResolvedLibrary(String path) {
_checkConsistency();
return _driver.getResolvedLibrary(path);
}
- @Deprecated('Use getResolvedLibrary() instead')
- @override
- Future<SomeResolvedLibraryResult> getResolvedLibrary2(String path) {
- return getResolvedLibrary(path);
- }
-
@override
Future<SomeResolvedLibraryResult> getResolvedLibraryByElement(
LibraryElement element,
@@ -158,38 +116,18 @@
return _driver.getResolvedLibraryByUri(element.source.uri);
}
- @Deprecated('Use getResolvedLibraryByElement() instead')
- @override
- Future<SomeResolvedLibraryResult> getResolvedLibraryByElement2(
- LibraryElement element,
- ) {
- return getResolvedLibraryByElement(element);
- }
-
@override
Future<SomeResolvedUnitResult> getResolvedUnit(String path) {
_checkConsistency();
return _driver.getResult(path);
}
- @Deprecated('Use getResolvedUnit() instead')
- @override
- Future<SomeResolvedUnitResult> getResolvedUnit2(String path) {
- return getResolvedUnit(path);
- }
-
@override
Future<SomeUnitElementResult> getUnitElement(String path) {
_checkConsistency();
return _driver.getUnitElement(path);
}
- @Deprecated('Use getUnitElement() instead')
- @override
- Future<SomeUnitElementResult> getUnitElement2(String path) {
- return getUnitElement(path);
- }
-
/// Check to see that results from this session will be consistent, and throw
/// an [InconsistentAnalysisException] if they might not be.
void _checkConsistency() {
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 176f6e4..b78a8e8 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -1709,10 +1709,6 @@
@override
bool get isAbstract => abstractKeyword != null;
- @Deprecated('Use superclass2 instead')
- @override
- NamedTypeImpl get superclass => _superclass;
-
set superclass(NamedType superclass) {
_superclass = _becomeParentOf(superclass as NamedTypeImpl);
}
@@ -2654,10 +2650,6 @@
_name = _becomeParentOf(name as SimpleIdentifierImpl?);
}
- @Deprecated('Use type2 instead')
- @override
- NamedTypeImpl get type => _type;
-
set type(NamedType type) {
_type = _becomeParentOf(type as NamedTypeImpl);
}
@@ -3725,10 +3717,6 @@
@override
Token get endToken => _superclass.endToken;
- @Deprecated('Use superclass2 instead')
- @override
- NamedTypeImpl get superclass => _superclass;
-
set superclass(NamedType name) {
_superclass = _becomeParentOf(name as NamedTypeImpl);
}
@@ -5857,10 +5845,6 @@
@override
Token get endToken => _interfaces.endToken!;
- @Deprecated('Use interfaces2 instead')
- @override
- NodeList<TypeName> get interfaces => _DelegatingTypeNameList(_interfaces);
-
@override
NodeListImpl<NamedType> get interfaces2 => _interfaces;
@@ -7516,7 +7500,7 @@
/// typeName ::=
/// [Identifier] typeArguments? '?'?
/// ignore: deprecated_member_use_from_same_package
-class NamedTypeImpl extends TypeAnnotationImpl implements TypeName {
+class NamedTypeImpl extends TypeAnnotationImpl implements NamedType {
/// The name of the type.
IdentifierImpl _name;
@@ -8066,11 +8050,6 @@
@override
Token get endToken => _superclassConstraints.endToken!;
- @Deprecated('Use superclassConstraints2 instead')
- @override
- NodeList<TypeName> get superclassConstraints =>
- _DelegatingTypeNameList(_superclassConstraints);
-
@override
NodeListImpl<NamedType> get superclassConstraints2 => _superclassConstraints;
@@ -10587,10 +10566,6 @@
@override
NamedTypeImpl get type => _typeName;
- @Deprecated('Use namedType instead')
- @override
- NamedTypeImpl get typeName => _typeName;
-
set typeName(NamedTypeImpl value) {
_typeName = _becomeParentOf(value);
}
@@ -11171,10 +11146,6 @@
@override
Token get endToken => _mixinTypes.endToken!;
- @Deprecated('Use mixinTypes2 instead')
- @override
- NodeList<TypeName> get mixinTypes => _DelegatingTypeNameList(_mixinTypes);
-
@override
NodeListImpl<NamedType> get mixinTypes2 => _mixinTypes;
@@ -11247,77 +11218,6 @@
}
}
-/// Implementation of `NodeList<TypeName>` that delegates.
-@Deprecated('Use NamedType instead')
-class _DelegatingTypeNameList
- with ListMixin<TypeName>
- implements NodeList<TypeName> {
- final NodeListImpl<NamedType> _delegate;
-
- _DelegatingTypeNameList(this._delegate);
-
- @override
- Token? get beginToken {
- return _delegate.beginToken;
- }
-
- @override
- Token? get endToken {
- return _delegate.endToken;
- }
-
- @override
- int get length => _delegate.length;
-
- @override
- set length(int newLength) {
- _delegate.length = newLength;
- }
-
- @override
- AstNodeImpl get owner => _delegate.owner;
-
- @override
- TypeName operator [](int index) {
- return _delegate[index] as TypeName;
- }
-
- @override
- void operator []=(int index, TypeName node) {
- _delegate[index] = node;
- }
-
- @override
- void accept(AstVisitor visitor) {
- _delegate.accept(visitor);
- }
-
- @override
- void add(NamedType node) {
- _delegate.add(node);
- }
-
- @override
- void addAll(Iterable<TypeName> nodes) {
- _delegate.addAll(nodes);
- }
-
- @override
- void clear() {
- _delegate.clear();
- }
-
- @override
- void insert(int index, TypeName node) {
- _delegate.insert(index, node);
- }
-
- @override
- TypeName removeAt(int index) {
- return _delegate.removeAt(index) as TypeName;
- }
-}
-
/// An indication of the resolved kind of a [SetOrMapLiteral].
enum _SetOrMapKind {
/// Indicates that the literal represents a map.
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index e1f0415..4fed3a0 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -1327,14 +1327,6 @@
TypeLiteralImpl typeLiteral({required NamedType typeName}) =>
TypeLiteralImpl(typeName as NamedTypeImpl);
- @Deprecated('Use namedType() instead')
- @override
- NamedTypeImpl typeName(Identifier name, TypeArgumentList? typeArguments,
- {Token? question}) =>
- NamedTypeImpl(
- name as IdentifierImpl, typeArguments as TypeArgumentListImpl?,
- question: question);
-
@override
TypeParameterImpl typeParameter(
Comment? comment,
diff --git a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
index d31ae43..7b52a19 100644
--- a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
@@ -1043,12 +1043,6 @@
_visitNode(node.type);
}
- @Deprecated('Override visitNamedType instead')
- @override
- void visitTypeName(TypeName node) {
- throw StateError('Should not be invoked');
- }
-
@override
void visitTypeParameter(TypeParameter node) {
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 6e0840d..405d684 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -1200,12 +1200,6 @@
return isEqualNodes(node.type, other.type);
}
- @Deprecated('Override visitNamedType instead')
- @override
- bool visitTypeName(TypeName node) {
- throw StateError('Should not be invoked');
- }
-
@override
bool visitTypeParameter(TypeParameter node) {
TypeParameter other = _other as TypeParameter;
@@ -2931,11 +2925,6 @@
}
@override
- bool visitTypeName(covariant NamedTypeImpl node) {
- throw StateError('Should not be invoked');
- }
-
- @override
bool visitTypeParameter(covariant TypeParameterImpl node) {
if (identical(node.name, _oldNode)) {
node.name = _newNode as SimpleIdentifier;
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index bb33038..bbfa073 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:collection';
-
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
@@ -706,17 +704,6 @@
return ConstructorMember.from(constructorElement, this);
}
- @deprecated
- @override
- PropertyAccessorElement? lookUpGetter(
- String getterName, LibraryElement? library) {
- var element = getGetter(getterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- return lookUpGetterInSuperclass(getterName, library);
- }
-
@override
PropertyAccessorElement? lookUpGetter2(
String name,
@@ -756,211 +743,6 @@
return null;
}
- @deprecated
- @override
- PropertyAccessorElement? lookUpGetterInSuperclass(
- String getterName, LibraryElement? library) {
- for (InterfaceType mixin in mixins.reversed) {
- var element = mixin.getGetter(getterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- for (InterfaceType constraint in superclassConstraints) {
- var element = constraint.getGetter(getterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- HashSet<ClassElement> visitedClasses = HashSet<ClassElement>();
- var supertype = superclass;
- var supertypeElement = supertype?.element;
- while (supertype != null &&
- supertypeElement != null &&
- !visitedClasses.contains(supertypeElement)) {
- visitedClasses.add(supertypeElement);
- var element = supertype.getGetter(getterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- for (InterfaceType mixin in supertype.mixins.reversed) {
- element = mixin.getGetter(getterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- supertype = supertype.superclass;
- supertypeElement = supertype?.element;
- }
- return null;
- }
-
- @deprecated
- @override
- PropertyAccessorElement? lookUpInheritedGetter(String name,
- {LibraryElement? library, bool thisType = true}) {
- PropertyAccessorElement? result;
- if (thisType) {
- result = lookUpGetter(name, library);
- } else {
- result = lookUpGetterInSuperclass(name, library);
- }
- if (result != null) {
- return result;
- }
- return _lookUpMemberInInterfaces(this, false, library,
- HashSet<ClassElement>(), (InterfaceType t) => t.getGetter(name));
- }
-
- @deprecated
- @override
- ExecutableElement? lookUpInheritedGetterOrMethod(String name,
- {LibraryElement? library}) {
- var result = lookUpGetter(name, library) ?? lookUpMethod(name, library);
-
- if (result != null) {
- return result;
- }
- return _lookUpMemberInInterfaces(
- this,
- false,
- library,
- HashSet<ClassElement>(),
- (InterfaceType t) => t.getGetter(name) ?? t.getMethod(name));
- }
-
- @deprecated
- ExecutableElement? lookUpInheritedMember(String name, LibraryElement library,
- {bool concrete = false,
- bool forSuperInvocation = false,
- int? startMixinIndex,
- bool setter = false,
- bool thisType = false}) {
- HashSet<ClassElement> visitedClasses = HashSet<ClassElement>();
-
- /// TODO(scheglov) Remove [includeSupers]. It is used only to work around
- /// the problem with Flutter code base (using old super-mixins).
- ExecutableElement? lookUpImpl(InterfaceType? type,
- {bool acceptAbstract = false,
- bool includeType = true,
- bool inMixin = false,
- int? startMixinIndex}) {
- if (type == null || !visitedClasses.add(type.element)) {
- return null;
- }
-
- if (includeType) {
- ExecutableElement? result;
- if (setter) {
- result = type.getSetter(name);
- } else {
- result = type.getMethod(name);
- result ??= type.getGetter(name);
- }
- if (result != null && result.isAccessibleIn(library)) {
- if (!concrete || acceptAbstract || !result.isAbstract) {
- return result;
- }
- }
- }
-
- if (!inMixin || acceptAbstract) {
- var mixins = type.mixins;
- startMixinIndex ??= mixins.length;
- for (var i = startMixinIndex - 1; i >= 0; i--) {
- var result = lookUpImpl(
- mixins[i],
- acceptAbstract: acceptAbstract,
- inMixin: true,
- );
- if (result != null) {
- return result;
- }
- }
- }
-
- // We were not able to find the concrete dispatch target.
- // It is OK to look into interfaces, we need just some resolution now.
- if (!concrete) {
- for (InterfaceType mixin in type.interfaces) {
- var result = lookUpImpl(mixin, acceptAbstract: acceptAbstract);
- if (result != null) {
- return result;
- }
- }
- }
-
- if (!inMixin || acceptAbstract) {
- return lookUpImpl(type.superclass,
- acceptAbstract: acceptAbstract, inMixin: inMixin);
- }
-
- return null;
- }
-
- if (element.isMixin) {
- // TODO(scheglov) We should choose the most specific signature.
- // Not just the first signature.
- for (InterfaceType constraint in superclassConstraints) {
- var result = lookUpImpl(constraint, acceptAbstract: true);
- if (result != null) {
- return result;
- }
- }
- return null;
- } else {
- return lookUpImpl(
- this,
- includeType: thisType,
- startMixinIndex: startMixinIndex,
- );
- }
- }
-
- @deprecated
- @override
- MethodElement? lookUpInheritedMethod(String name,
- {LibraryElement? library, bool thisType = true}) {
- MethodElement? result;
- if (thisType) {
- result = lookUpMethod(name, library);
- } else {
- result = lookUpMethodInSuperclass(name, library);
- }
- if (result != null) {
- return result;
- }
- return _lookUpMemberInInterfaces(this, false, library,
- HashSet<ClassElement>(), (InterfaceType t) => t.getMethod(name));
- }
-
- @deprecated
- @override
- PropertyAccessorElement? lookUpInheritedSetter(String name,
- {LibraryElement? library, bool thisType = true}) {
- PropertyAccessorElement? result;
- if (thisType) {
- result = lookUpSetter(name, library);
- } else {
- result = lookUpSetterInSuperclass(name, library);
- }
- if (result != null) {
- return result;
- }
- return _lookUpMemberInInterfaces(this, false, library,
- HashSet<ClassElement>(), (t) => t.getSetter(name));
- }
-
- @deprecated
- @override
- MethodElement? lookUpMethod(String methodName, LibraryElement? library) {
- var element = getMethod(methodName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- return lookUpMethodInSuperclass(methodName, library);
- }
-
@override
MethodElement? lookUpMethod2(
String name,
@@ -1000,56 +782,6 @@
return null;
}
- @deprecated
- @override
- MethodElement? lookUpMethodInSuperclass(
- String methodName, LibraryElement? library) {
- for (InterfaceType mixin in mixins.reversed) {
- var element = mixin.getMethod(methodName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- for (InterfaceType constraint in superclassConstraints) {
- var element = constraint.getMethod(methodName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- HashSet<ClassElement> visitedClasses = HashSet<ClassElement>();
- var supertype = superclass;
- var supertypeElement = supertype?.element;
- while (supertype != null &&
- supertypeElement != null &&
- !visitedClasses.contains(supertypeElement)) {
- visitedClasses.add(supertypeElement);
- var element = supertype.getMethod(methodName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- for (InterfaceType mixin in supertype.mixins.reversed) {
- element = mixin.getMethod(methodName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- supertype = supertype.superclass;
- supertypeElement = supertype?.element;
- }
- return null;
- }
-
- @deprecated
- @override
- PropertyAccessorElement? lookUpSetter(
- String setterName, LibraryElement? library) {
- var element = getSetter(setterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- return lookUpSetterInSuperclass(setterName, library);
- }
-
@override
PropertyAccessorElement? lookUpSetter2(
String name,
@@ -1089,45 +821,6 @@
return null;
}
- @deprecated
- @override
- PropertyAccessorElement? lookUpSetterInSuperclass(
- String setterName, LibraryElement? library) {
- for (InterfaceType mixin in mixins.reversed) {
- var element = mixin.getSetter(setterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- for (InterfaceType constraint in superclassConstraints) {
- var element = constraint.getSetter(setterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- HashSet<ClassElement> visitedClasses = HashSet<ClassElement>();
- var supertype = superclass;
- var supertypeElement = supertype?.element;
- while (supertype != null &&
- supertypeElement != null &&
- !visitedClasses.contains(supertypeElement)) {
- visitedClasses.add(supertypeElement);
- var element = supertype.getSetter(setterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- for (InterfaceType mixin in supertype.mixins.reversed) {
- element = mixin.getSetter(setterName);
- if (element != null && element.isAccessibleIn(library)) {
- return element;
- }
- }
- supertype = supertype.superclass;
- supertypeElement = supertype?.element;
- }
- return null;
- }
-
@override
bool referencesAny(Set<TypeParameterElement> parameters) {
return typeArguments.any((argument) {
@@ -1160,140 +853,6 @@
}
return result;
}
-
- /// Returns a "smart" version of the "least upper bound" of the given types.
- ///
- /// If these types have the same element and differ only in terms of the type
- /// arguments, attempts to find a compatible set of type arguments.
- ///
- /// Otherwise, calls [DartType.getLeastUpperBound].
- @Deprecated('Use TypeSystem.leastUpperBound instead')
- static InterfaceType getSmartLeastUpperBound(
- InterfaceType first, InterfaceType second) {
- // TODO(paulberry): this needs to be deprecated and replaced with a method
- // in [TypeSystem], since it relies on the deprecated functionality of
- // [DartType.getLeastUpperBound].
- if (first.element == second.element) {
- return _leastUpperBound(first, second);
- }
- var typeSystem = first.element.library.typeSystem as TypeSystemImpl;
- return typeSystem.getLeastUpperBound(first, second) as InterfaceType;
- }
-
- /// Return the "least upper bound" of the given types under the assumption
- /// that the types have the same element and differ only in terms of the type
- /// arguments.
- ///
- /// The resulting type is composed by comparing the corresponding type
- /// arguments, keeping those that are the same, and using 'dynamic' for those
- /// that are different.
- static InterfaceType _leastUpperBound(
- InterfaceType firstType, InterfaceType secondType) {
- ClassElement firstElement = firstType.element;
- ClassElement secondElement = secondType.element;
- if (firstElement != secondElement) {
- throw ArgumentError('The same elements expected, but '
- '$firstElement and $secondElement are given.');
- }
- if (firstType == secondType) {
- return firstType;
- }
- List<DartType> firstArguments = firstType.typeArguments;
- List<DartType> secondArguments = secondType.typeArguments;
- int argumentCount = firstArguments.length;
- if (argumentCount == 0) {
- return firstType;
- }
- var lubArguments = List<DartType>.filled(
- argumentCount,
- DynamicTypeImpl.instance,
- );
- for (int i = 0; i < argumentCount; i++) {
- //
- // Ideally we would take the least upper bound of the two argument types,
- // but this can cause an infinite recursion (such as when finding the
- // least upper bound of String and num).
- //
- if (firstArguments[i] == secondArguments[i]) {
- lubArguments[i] = firstArguments[i];
- }
- }
-
- NullabilitySuffix computeNullability() {
- NullabilitySuffix first = firstType.nullabilitySuffix;
- NullabilitySuffix second = secondType.nullabilitySuffix;
- if (first == NullabilitySuffix.question ||
- second == NullabilitySuffix.question) {
- return NullabilitySuffix.question;
- } else if (first == NullabilitySuffix.star ||
- second == NullabilitySuffix.star) {
- return NullabilitySuffix.star;
- }
- return NullabilitySuffix.none;
- }
-
- return InterfaceTypeImpl(
- element: firstElement,
- typeArguments: lubArguments,
- nullabilitySuffix: computeNullability(),
- );
- }
-
- /// Look up the getter with the given name in the interfaces implemented by
- /// the given [targetType], either directly or indirectly. Return the element
- /// representing the getter that was found, or `null` if there is no getter
- /// with the given name. The flag [includeTargetType] should be `true` if the
- /// search should include the target type. The [visitedInterfaces] is a set
- /// containing all of the interfaces that have been examined, used to prevent
- /// infinite recursion and to optimize the search.
- static T? _lookUpMemberInInterfaces<T extends ExecutableElement>(
- InterfaceType targetType,
- bool includeTargetType,
- LibraryElement? library,
- HashSet<ClassElement> visitedInterfaces,
- T? Function(InterfaceType type) getMember) {
- // TODO(brianwilkerson) This isn't correct. Section 8.1.1 of the
- // specification (titled "Inheritance and Overriding" under "Interfaces")
- // describes a much more complex scheme for finding the inherited member.
- // We need to follow that scheme. The code below should cover the 80% case.
- ClassElement targetClass = targetType.element;
- if (!visitedInterfaces.add(targetClass)) {
- return null;
- }
- if (includeTargetType) {
- var member = getMember(targetType);
- if (member != null && member.isAccessibleIn(library)) {
- return member;
- }
- }
- for (InterfaceType interfaceType in targetType.interfaces) {
- var member = _lookUpMemberInInterfaces(
- interfaceType, true, library, visitedInterfaces, getMember);
- if (member != null) {
- return member;
- }
- }
- for (InterfaceType constraint in targetType.superclassConstraints) {
- var member = _lookUpMemberInInterfaces(
- constraint, true, library, visitedInterfaces, getMember);
- if (member != null) {
- return member;
- }
- }
- for (InterfaceType mixinType in targetType.mixins.reversed) {
- var member = _lookUpMemberInInterfaces(
- mixinType, true, library, visitedInterfaces, getMember);
- if (member != null) {
- return member;
- }
- }
- var superclass = targetType.superclass;
- if (superclass == null) {
- return null;
- }
- return _lookUpMemberInInterfaces(
- superclass, true, library, visitedInterfaces, getMember);
- }
}
/// The type `Never` represents the uninhabited bottom type.
@@ -1393,18 +952,6 @@
/// Initialize a newly created type to be declared by the given [element].
TypeImpl(this._element, {this.alias});
- @Deprecated('Use alias instead')
- @override
- List<DartType>? get aliasArguments {
- return alias?.typeArguments;
- }
-
- @Deprecated('Use alias instead')
- @override
- TypeAliasElement? get aliasElement {
- return alias?.element;
- }
-
@deprecated
@override
String get displayName {
diff --git a/pkg/analyzer/lib/src/dart/error/lint_codes.dart b/pkg/analyzer/lib/src/dart/error/lint_codes.dart
index 45983c4..32b5cff 100644
--- a/pkg/analyzer/lib/src/dart/error/lint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/lint_codes.dart
@@ -13,11 +13,10 @@
const LintCode(
String name,
String problemMessage, {
- @Deprecated('Use correctionMessage instead') String? correction,
String? correctionMessage,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage ?? correction,
+ correctionMessage: correctionMessage,
problemMessage: problemMessage,
name: name,
uniqueName: uniqueName ?? 'LintCode.$name',
@@ -29,9 +28,6 @@
@override
int get hashCode => uniqueName.hashCode;
- @Deprecated('Use problemMessage instead')
- String get message => problemMessage;
-
@override
ErrorType get type => ErrorType.LINT;
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index e9eec90..61e6301 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -569,7 +569,7 @@
var libraryUnit = resolvedUnits.first;
var result = ResolvedLibraryResultImpl(contextObjects!.analysisSession,
- path, libraryUnit.uri, libraryUnit.libraryElement, resolvedUnits);
+ libraryUnit.libraryElement, resolvedUnits);
if (completionPath == null) {
cachedResults[path] = result;
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index af87eed..6741d98 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -341,11 +341,6 @@
nonPackageFeatureSet = featureSet;
}
- @deprecated
- set enabledExperiments(List<String> enabledExperiments) {
- _contextFeatures = ExperimentStatus.fromStrings(enabledExperiments);
- }
-
@override
List<ErrorProcessor> get errorProcessors =>
_errorProcessors ??= const <ErrorProcessor>[];
diff --git a/pkg/analyzer/lib/src/summary/summary_file_builder.dart b/pkg/analyzer/lib/src/summary/summary_file_builder.dart
deleted file mode 100644
index 521f24b..0000000
--- a/pkg/analyzer/lib/src/summary/summary_file_builder.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-@Deprecated('Use package:analyzer/dart/sdk/build_sdk_summary.dart instead')
-library summary_file_builder;
-
-import 'dart:typed_data';
-
-import 'package:analyzer/dart/sdk/build_sdk_summary.dart' as api;
-import 'package:analyzer/file_system/file_system.dart';
-
-/// Build summary for SDK the at the given [sdkPath].
-///
-/// If [embedderYamlPath] is provided, then libraries from this file are
-/// appended to the libraries of the specified SDK.
-Uint8List buildSdkSummary({
- required ResourceProvider resourceProvider,
- required String sdkPath,
- String? embedderYamlPath,
-}) {
- return api.buildSdkSummary(
- resourceProvider: resourceProvider,
- sdkPath: sdkPath,
- embedderYamlPath: embedderYamlPath,
- );
-}
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 14a27f7..ab9503d 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 2.8.0
+version: 3.0.0-dev
description: This package provides a library that performs static analysis of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
diff --git a/pkg/analyzer/test/file_system/file_system_test_support.dart b/pkg/analyzer/test/file_system/file_system_test_support.dart
index 0550aa1..11cf39f 100644
--- a/pkg/analyzer/test/file_system/file_system_test_support.dart
+++ b/pkg/analyzer/test/file_system/file_system_test_support.dart
@@ -229,15 +229,6 @@
expect(() => file.modificationStamp, throwsA(isFileSystemException));
}
- @deprecated
- test_parent() {
- File file = getFile(exists: true);
-
- var parent = file.parent!;
- expect(parent.exists, isTrue);
- expect(parent.path, defaultFolderPath);
- }
-
test_parent2() {
File file = getFile(exists: true);
@@ -925,22 +916,6 @@
expect(folder.exists, isFalse);
}
- @Deprecated('Not used by clients')
- test_getModificationTimes_existing() async {
- Source source = getFile(exists: true).createSource();
-
- var times = await provider.getModificationTimes([source]);
- expect(times, [source.modificationStamp]);
- }
-
- @Deprecated('Not used by clients')
- test_getModificationTimes_notExisting() async {
- Source source = getFile(exists: false).createSource();
-
- var times = await provider.getModificationTimes([source]);
- expect(times, [-1]);
- }
-
test_getResource_file_existing() {
String filePath = getFile(exists: true).path;
diff --git a/pkg/analyzer/test/file_system/overlay_file_system_test.dart b/pkg/analyzer/test/file_system/overlay_file_system_test.dart
index fd9a6df..dae3df2 100644
--- a/pkg/analyzer/test/file_system/overlay_file_system_test.dart
+++ b/pkg/analyzer/test/file_system/overlay_file_system_test.dart
@@ -812,20 +812,6 @@
expect(folder.exists, isTrue);
}
- @Deprecated('Not used by clients')
- test_getModificationTimes_withoutOverlay() async {
- Source source = _file(exists: true).createSource();
- List<int> times = await provider.getModificationTimes([source]);
- expect(times, [source.modificationStamp]);
- }
-
- @Deprecated('Not used by clients')
- test_getModificationTimes_withOverlay() async {
- Source source = _file(exists: true, withOverlay: true).createSource();
- List<int> times = await provider.getModificationTimes([source]);
- expect(times, [42]);
- }
-
test_getResource_file_existing_withoutOverlay() {
String path = _file(exists: true).path;
Resource resource = provider.getResource(path);
diff --git a/pkg/analyzer/test/resource_utils.dart b/pkg/analyzer/test/resource_utils.dart
index 3337265..8d84e18 100644
--- a/pkg/analyzer/test/resource_utils.dart
+++ b/pkg/analyzer/test/resource_utils.dart
@@ -6,7 +6,6 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
@@ -88,11 +87,6 @@
Folder getFolder(String path) => _provider.getFolder(_assertPath(path));
@override
- Future<List<int>> getModificationTimes(List<Source> sources) async {
- return sources.map((source) => 0).toList();
- }
-
- @override
Resource getResource(String path) => _provider.getResource(_assertPath(path));
@override
diff --git a/pkg/analyzer/test/src/dart/analysis/experiments_test.dart b/pkg/analyzer/test/src/dart/analysis/experiments_test.dart
index f808c64..5eed0e1 100644
--- a/pkg/analyzer/test/src/dart/analysis/experiments_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/experiments_test.dart
@@ -30,11 +30,6 @@
expect('${actual.major}.${actual.minor}', expectedStr);
}
- ExperimentStatus fromStrings(List<String> flags) {
- return overrideKnownFeatures(
- knownFeatures, () => ExperimentStatus.fromStrings(flags));
- }
-
ExperimentStatus fromStrings2({
required Version sdkLanguageVersion,
required List<String> flags,
@@ -473,193 +468,6 @@
expect(getFlags(status), [false, true]);
}
- test_fromStrings_conflicting_flags_disable_then_enable() {
- // Enable takes precedence because it's last
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: false,
- isExpired: false,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: null,
- );
- var status = fromStrings(['no-a', 'a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [true]);
- }
-
- test_fromStrings_conflicting_flags_enable_then_disable() {
- // Disable takes precedence because it's last
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: false,
- isExpired: false,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: null,
- );
- var status = fromStrings(['a', 'no-a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [false]);
- }
-
- test_fromStrings_default_values() {
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: false,
- isExpired: false,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: null,
- );
- knownFeatures['b'] = ExperimentalFeature(
- index: 1,
- enableString: 'b',
- isEnabledByDefault: true,
- isExpired: false,
- documentation: 'b',
- experimentalReleaseVersion: null,
- releaseVersion: Version.parse('1.0.0'),
- );
- var status = fromStrings([]);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [false, true]);
- }
-
- test_fromStrings_disable_disabled_feature() {
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: false,
- isExpired: false,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: null,
- );
- var status = fromStrings(['no-a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [false]);
- }
-
- test_fromStrings_disable_enabled_feature() {
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: true,
- isExpired: false,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: Version.parse('1.0.0'),
- );
- var status = fromStrings(['no-a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [false]);
- }
-
- test_fromStrings_enable_disabled_feature() {
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: false,
- isExpired: false,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: null,
- );
- var status = fromStrings(['a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [true]);
- }
-
- test_fromStrings_enable_enabled_feature() {
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: true,
- isExpired: false,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: Version.parse('1.0.0'),
- );
- var status = fromStrings(['a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [true]);
- }
-
- test_fromStrings_illegal_use_of_expired_flag_disable() {
- // Expired flags are ignored even if they would fail validation.
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: true,
- isExpired: true,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: Version.parse('1.0.0'),
- );
- var status = fromStrings(['no-a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [true]);
- }
-
- test_fromStrings_illegal_use_of_expired_flag_enable() {
- // Expired flags are ignored even if they would fail validation.
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: false,
- isExpired: true,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: null,
- );
- var status = fromStrings(['a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [false]);
- }
-
- test_fromStrings_unnecessary_use_of_expired_flag_disable() {
- // Expired flags are ignored.
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: false,
- isExpired: true,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: null,
- );
- var status = fromStrings(['no-a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [false]);
- }
-
- test_fromStrings_unnecessary_use_of_expired_flag_enable() {
- // Expired flags are ignored.
- knownFeatures['a'] = ExperimentalFeature(
- index: 0,
- enableString: 'a',
- isEnabledByDefault: true,
- isExpired: true,
- documentation: 'a',
- experimentalReleaseVersion: null,
- releaseVersion: Version.parse('1.0.0'),
- );
- var status = fromStrings(['a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), [true]);
- }
-
- test_fromStrings_unrecognized_flag() {
- // Unrecognized flags are ignored.
- var status = fromStrings(['a']);
- assertCurrentSdkLanguageVersion(status);
- expect(getFlags(status), <Object>[]);
- }
-
test_validateFlagCombination_disable_then_enable() {
knownFeatures['a'] = ExperimentalFeature(
index: 0,
diff --git a/pkg/analyzer/test/src/dart/element/element_test.dart b/pkg/analyzer/test/src/dart/element/element_test.dart
index 0ac00a2..2b46b93 100644
--- a/pkg/analyzer/test/src/dart/element/element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart
@@ -13,7 +13,6 @@
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
import 'package:analyzer/src/generated/testing/element_factory.dart';
-import 'package:analyzer/src/generated/testing/test_type_provider.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -1269,357 +1268,6 @@
expect(0 == typeA.hashCode, isFalse);
}
- @deprecated
- void test_lookUpGetter_implemented() {
- //
- // class A { g {} }
- //
- var classA = class_(name: 'A');
- String getterName = "g";
- PropertyAccessorElement getterG =
- ElementFactory.getterElement(getterName, false, intNone);
- classA.accessors = <PropertyAccessorElement>[getterG];
- InterfaceType typeA = interfaceTypeStar(classA);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[classA];
- expect(typeA.lookUpGetter(getterName, library), same(getterG));
- }
-
- @deprecated
- void test_lookUpGetter_inherited() {
- //
- // class A { g {} }
- // class B extends A {}
- //
- var classA = class_(name: 'A');
- String getterName = "g";
- PropertyAccessorElement getterG =
- ElementFactory.getterElement(getterName, false, intNone);
- classA.accessors = <PropertyAccessorElement>[getterG];
- ClassElementImpl classB =
- ElementFactory.classElement("B", interfaceTypeStar(classA));
- InterfaceType typeB = interfaceTypeStar(classB);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[
- classA,
- classB
- ];
- expect(typeB.lookUpGetter(getterName, library), same(getterG));
- }
-
- @deprecated
- void test_lookUpGetter_mixin_shadowing() {
- //
- // class B {}
- // class M1 { get g {} }
- // class M2 { get g {} }
- // class C extends B with M1, M2 {}
- //
- TestTypeProvider typeProvider = TestTypeProvider();
- String getterName = 'g';
- var classB = class_(name: 'B');
- ClassElementImpl classM1 = ElementFactory.classElement2('M1');
- PropertyAccessorElementImpl getterM1g = ElementFactory.getterElement(
- getterName, false, typeProvider.dynamicType);
- classM1.accessors = <PropertyAccessorElement>[getterM1g];
- ClassElementImpl classM2 = ElementFactory.classElement2('M2');
- PropertyAccessorElementImpl getterM2g = ElementFactory.getterElement(
- getterName, false, typeProvider.dynamicType);
- classM2.accessors = <PropertyAccessorElement>[getterM2g];
- ClassElementImpl classC =
- ElementFactory.classElement('C', interfaceTypeStar(classB));
- classC.mixins = <InterfaceType>[
- interfaceTypeStar(classM1),
- interfaceTypeStar(classM2)
- ];
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- var unit = library.definingCompilationUnit as CompilationUnitElementImpl;
- unit.classes = <ClassElement>[classB, classM1, classM2, classC];
- expect(
- interfaceTypeStar(classC).lookUpGetter(getterName, library), getterM2g);
- }
-
- @deprecated
- void test_lookUpGetter_recursive() {
- //
- // class A extends B {}
- // class B extends A {}
- //
- var classA = class_(name: 'A');
- InterfaceType typeA = interfaceTypeStar(classA);
- var classB = ElementFactory.classElement("B", typeA);
- classA.supertype = interfaceTypeStar(classB);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[
- classA,
- classB
- ];
- expect(typeA.lookUpGetter("g", library), isNull);
- }
-
- @deprecated
- void test_lookUpGetter_unimplemented() {
- //
- // class A {}
- //
- var classA = class_(name: 'A');
- InterfaceType typeA = interfaceTypeStar(classA);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[classA];
- expect(typeA.lookUpGetter("g", library), isNull);
- }
-
- @deprecated
- void test_lookUpMethod_implemented() {
- //
- // class A { m() {} }
- //
- var classA = class_(name: 'A');
- String methodName = "m";
- MethodElementImpl methodM =
- ElementFactory.methodElement(methodName, intNone);
- classA.methods = <MethodElement>[methodM];
- InterfaceType typeA = interfaceTypeStar(classA);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[classA];
- expect(typeA.lookUpMethod(methodName, library), same(methodM));
- }
-
- @deprecated
- void test_lookUpMethod_inherited() {
- //
- // class A { m() {} }
- // class B extends A {}
- //
- var classA = class_(name: 'A');
- String methodName = "m";
- MethodElementImpl methodM =
- ElementFactory.methodElement(methodName, intNone);
- classA.methods = <MethodElement>[methodM];
- ClassElementImpl classB =
- ElementFactory.classElement("B", interfaceTypeStar(classA));
- InterfaceType typeB = interfaceTypeStar(classB);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[
- classA,
- classB
- ];
- expect(typeB.lookUpMethod(methodName, library), same(methodM));
- }
-
- @deprecated
- void test_lookUpMethod_mixin_shadowing() {
- //
- // class B {}
- // class M1 { m() {} }
- // class M2 { m() {} }
- // class C extends B with M1, M2 {}
- //
- String methodName = 'm';
- var classB = class_(name: 'B');
- ClassElementImpl classM1 = ElementFactory.classElement2('M1');
- MethodElementImpl methodM1m =
- ElementFactory.methodElement(methodName, intNone);
- classM1.methods = <MethodElement>[methodM1m];
- ClassElementImpl classM2 = ElementFactory.classElement2('M2');
- MethodElementImpl methodM2m =
- ElementFactory.methodElement(methodName, intNone);
- classM2.methods = <MethodElement>[methodM2m];
- ClassElementImpl classC =
- ElementFactory.classElement('C', interfaceTypeStar(classB));
- classC.mixins = <InterfaceType>[
- interfaceTypeStar(classM1),
- interfaceTypeStar(classM2)
- ];
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- var unit = library.definingCompilationUnit as CompilationUnitElementImpl;
- unit.classes = <ClassElement>[classB, classM1, classM2, classC];
- expect(
- interfaceTypeStar(classC).lookUpMethod(methodName, library), methodM2m);
- }
-
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44522')
- @deprecated
- void test_lookUpMethod_parameterized() {
- //
- // class A<E> { E m(E p) {} }
- // class B<F> extends A<F> {}
- //
- var E = typeParameter('E');
- var A = class_(name: 'A', typeParameters: [E]);
- DartType typeE = typeParameterTypeStar(E);
- String methodName = "m";
- MethodElementImpl methodM =
- ElementFactory.methodElement(methodName, typeE, [typeE]);
- A.methods = <MethodElement>[methodM];
-
- var F = typeParameter('F');
- var B = class_(
- name: 'B',
- typeParameters: [F],
- superType: interfaceTypeStar(A, typeArguments: [
- typeParameterTypeStar(F),
- ]),
- );
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[A];
- //
- // B<I>
- //
- var typeI = interfaceTypeStar(class_(name: 'I'));
- var typeBI = interfaceTypeStar(B, typeArguments: <DartType>[typeI]);
- MethodElement method = typeBI.lookUpMethod(methodName, library)!;
- expect(method, isNotNull);
- FunctionType methodType = method.type;
- expect(methodType.returnType, same(typeI));
- List<DartType> parameterTypes = methodType.normalParameterTypes;
- expect(parameterTypes, hasLength(1));
- expect(parameterTypes[0], same(typeI));
- }
-
- @deprecated
- void test_lookUpMethod_recursive() {
- //
- // class A extends B {}
- // class B extends A {}
- //
- var classA = class_(name: 'A');
- InterfaceType typeA = interfaceTypeStar(classA);
- var classB = ElementFactory.classElement("B", typeA);
- classA.supertype = interfaceTypeStar(classB);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[
- classA,
- classB
- ];
- expect(typeA.lookUpMethod("m", library), isNull);
- }
-
- @deprecated
- void test_lookUpMethod_unimplemented() {
- //
- // class A {}
- //
- var classA = class_(name: 'A');
- InterfaceType typeA = interfaceTypeStar(classA);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[classA];
- expect(typeA.lookUpMethod("m", library), isNull);
- }
-
- @deprecated
- void test_lookUpSetter_implemented() {
- //
- // class A { s(x) {} }
- //
- var classA = class_(name: 'A');
- String setterName = "s";
- PropertyAccessorElement setterS =
- ElementFactory.setterElement(setterName, false, intNone);
- classA.accessors = <PropertyAccessorElement>[setterS];
- InterfaceType typeA = interfaceTypeStar(classA);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[classA];
- expect(typeA.lookUpSetter(setterName, library), same(setterS));
- }
-
- @deprecated
- void test_lookUpSetter_inherited() {
- //
- // class A { s(x) {} }
- // class B extends A {}
- //
- var classA = class_(name: 'A');
- String setterName = "g";
- PropertyAccessorElement setterS =
- ElementFactory.setterElement(setterName, false, intNone);
- classA.accessors = <PropertyAccessorElement>[setterS];
- ClassElementImpl classB =
- ElementFactory.classElement("B", interfaceTypeStar(classA));
- InterfaceType typeB = interfaceTypeStar(classB);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[
- classA,
- classB
- ];
- expect(typeB.lookUpSetter(setterName, library), same(setterS));
- }
-
- @deprecated
- void test_lookUpSetter_mixin_shadowing() {
- //
- // class B {}
- // class M1 { set s() {} }
- // class M2 { set s() {} }
- // class C extends B with M1, M2 {}
- //
- TestTypeProvider typeProvider = TestTypeProvider();
- String setterName = 's';
- var classB = class_(name: 'B');
- ClassElementImpl classM1 = ElementFactory.classElement2('M1');
- PropertyAccessorElementImpl setterM1g = ElementFactory.setterElement(
- setterName, false, typeProvider.dynamicType);
- classM1.accessors = <PropertyAccessorElement>[setterM1g];
- ClassElementImpl classM2 = ElementFactory.classElement2('M2');
- PropertyAccessorElementImpl setterM2g = ElementFactory.getterElement(
- setterName, false, typeProvider.dynamicType);
- classM2.accessors = <PropertyAccessorElement>[setterM2g];
- ClassElementImpl classC =
- ElementFactory.classElement('C', interfaceTypeStar(classB));
- classC.mixins = <InterfaceType>[
- interfaceTypeStar(classM1),
- interfaceTypeStar(classM2)
- ];
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- var unit = library.definingCompilationUnit as CompilationUnitElementImpl;
- unit.classes = <ClassElement>[classB, classM1, classM2, classC];
- expect(
- interfaceTypeStar(classC).lookUpGetter(setterName, library), setterM2g);
- }
-
- @deprecated
- void test_lookUpSetter_recursive() {
- //
- // class A extends B {}
- // class B extends A {}
- //
- var classA = class_(name: 'A');
- InterfaceType typeA = interfaceTypeStar(classA);
- var classB = ElementFactory.classElement("B", typeA);
- classA.supertype = interfaceTypeStar(classB);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[
- classA,
- classB
- ];
- expect(typeA.lookUpSetter("s", library), isNull);
- }
-
- @deprecated
- void test_lookUpSetter_unimplemented() {
- //
- // class A {}
- //
- var classA = class_(name: 'A');
- InterfaceType typeA = interfaceTypeStar(classA);
- LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
- CompilationUnitElement unit = library.definingCompilationUnit;
- (unit as CompilationUnitElementImpl).classes = <ClassElement>[classA];
- expect(typeA.lookUpSetter("s", library), isNull);
- }
-
void test_resolveToBound() {
var type = interfaceTypeStar(ElementFactory.classElement2('A'));
diff --git a/pkg/dart2js_info/README.md b/pkg/dart2js_info/README.md
index 8257448..5f05010 100644
--- a/pkg/dart2js_info/README.md
+++ b/pkg/dart2js_info/README.md
@@ -544,17 +544,18 @@
This package is developed in [github][repo]. Please file feature requests and
bugs at the [issue tracker][tracker].
-[repo]: https://github.com/dart-lang/dart2js_info/
-[tracker]: https://github.com/dart-lang/dart2js_info/issues
-[code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps.dart
-[diff]: https://github.com/dart-lang/dart2js_info/blob/master/bin/diff.dart
-[library_size]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_size_split.dart
-[deferred_check]: https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_library_check.dart
-[deferred_size]: https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_library_size.dart
-[deferred_layout]: https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_library_layout.dart
-[coverage_server]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_log_server.dart
-[coverage_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size_analysis.dart
-[function_size]: https://github.com/dart-lang/dart2js_info/blob/master/bin/function_size_analysis.dart
-[AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/AllInfo-class.html
-[convert]: https://github.com/dart-lang/dart2js_info/blob/master/bin/convert.dart
-[show]: https://github.com/dart-lang/dart2js_info/blob/master/bin/text_print.dart
+[AllInfo]: https://pub.dev/documentation/dart2js_info/latest/dart2js_info.info/AllInfo-class.html
+[code_deps]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/code_deps.dart
+[common]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/common_command.dart
+[convert]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/convert.dart
+[coverage_server]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/coverage_log_server.dart
+[coverage_analysis]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/live_code_size_analysis.dart
+[deferred_check]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/deferred_library_check.dart
+[deferred_layout]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/deferred_library_layout.dart
+[deferred_size]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/deferred_library_size.dart
+[diff]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/diff.dart
+[function_size]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/function_size_analysis.dart
+[library_size]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/library_size_split.dart
+[repo]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/
+[show]: https://github.com/dart-lang/sdk/tree/main/pkg/dart2js_info/bin/src/text_print.dart
+[tracker]: https://github.com/dart-lang/sdk/issues
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 86800bb..38e5cfc 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -11888,7 +11888,9 @@
v.visitTypeParameterType(this, arg);
@override
- void visitChildren(Visitor v) {}
+ void visitChildren(Visitor v) {
+ promotedBound?.accept(v);
+ }
@override
bool operator ==(Object other) => equals(other, null);
diff --git a/pkg/vm/lib/transformations/type_flow/transformer.dart b/pkg/vm/lib/transformations/type_flow/transformer.dart
index aa9af8f..024368c 100644
--- a/pkg/vm/lib/transformations/type_flow/transformer.dart
+++ b/pkg/vm/lib/transformations/type_flow/transformer.dart
@@ -979,6 +979,7 @@
if (parent is Class) {
shaker.addClassUsedInType(parent);
}
+ node.visitChildren(this);
}
}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/regress_47878.dart b/pkg/vm/testcases/transformations/type_flow/transformer/regress_47878.dart
new file mode 100644
index 0000000..866f945
--- /dev/null
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/regress_47878.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for https://github.com/dart-lang/sdk/issues/47878
+
+abstract class Disposable {}
+
+class A {}
+
+class Data<T> {
+ T? value;
+}
+
+class DataStream<T> {
+ DataStream({newValue, Data<T>? stream}) {
+ var lastValue = stream!.value;
+
+ if (lastValue != null &&
+ lastValue is Disposable &&
+ lastValue != newValue) {}
+ }
+}
+
+void main() {
+ DataStream<A>();
+}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/regress_47878.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/regress_47878.dart.expect
new file mode 100644
index 0000000..d52c496
--- /dev/null
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/regress_47878.dart.expect
@@ -0,0 +1,26 @@
+library #lib /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+abstract class Disposable extends core::Object {
+}
+abstract class A extends core::Object {
+}
+abstract class Data<T extends core::Object? = dynamic> extends core::Object {
+}
+class DataStream<T extends core::Object? = dynamic> extends core::Object {
+ constructor •() → self::DataStream<self::DataStream::T%>
+ : super core::Object::•() {
+ self::DataStream::T? lastValue = block {
+ #C1!;
+ } =>throw "Attempt to execute code removed by Dart AOT compiler (TFA)";
+ if(!(throw "Attempt to execute code removed by Dart AOT compiler (TFA)") && false && !([@vm.inferred-type.metadata=dart.core::bool (skip check) (receiver not int)] lastValue{self::DataStream::T & self::Disposable /* '!' & '!' = '!' */} =={core::Object::==}{(core::Object) → core::bool} #C1)) {
+ }
+ }
+}
+static method main() → void {
+ new self::DataStream::•<self::A>();
+}
+constants {
+ #C1 = null
+}
diff --git a/tools/VERSION b/tools/VERSION
index 0d79263..5d1e0e8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 94
+PRERELEASE 95
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/flutter/analyze_flutter_flutter.sh b/tools/bots/flutter/analyze_flutter_flutter.sh
index cd50561..fbfb264 100755
--- a/tools/bots/flutter/analyze_flutter_flutter.sh
+++ b/tools/bots/flutter/analyze_flutter_flutter.sh
@@ -39,4 +39,4 @@
$dart fix packages/flutter/test_fixes --compare-to-golden
# Analyze the sample code in dartdoc snippets.
-$dart dev/bots/analyze_sample_code.dart
+PUB_CACHE=$checkout/.pub_cache $dart dev/bots/analyze_sample_code.dart