Version 2.17.0-117.0.dev
Merge commit 'deba7fee1d90227020301833951b87da27d9a90c' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index 66d9ee6..b671ff4 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2022-02-02T12:23:40.780016",
+ "generated": "2022-02-16T14:11:48.394602",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -136,7 +136,7 @@
"name": "boolean_selector",
"rootUri": "../third_party/pkg/boolean_selector",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "browser_launcher",
@@ -172,7 +172,7 @@
"name": "clock",
"rootUri": "../third_party/pkg/clock",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "collection",
@@ -316,7 +316,7 @@
"name": "file_testing",
"rootUri": "../third_party/pkg/file/packages/file_testing",
"packageUri": "lib/",
- "languageVersion": "2.1"
+ "languageVersion": "2.12"
},
{
"name": "fixnum",
@@ -629,7 +629,7 @@
"name": "source_map_stack_trace",
"rootUri": "../third_party/pkg/source_map_stack_trace",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "source_maps",
@@ -677,7 +677,7 @@
"name": "string_scanner",
"rootUri": "../third_party/pkg/string_scanner",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "sync_http",
@@ -695,7 +695,7 @@
"name": "term_glyph",
"rootUri": "../third_party/pkg/term_glyph",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "test",
@@ -766,7 +766,7 @@
"name": "vector_math",
"rootUri": "../third_party/pkg/vector_math",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.14"
},
{
"name": "vm",
diff --git a/DEPS b/DEPS
index dc28abe..777bf85 100644
--- a/DEPS
+++ b/DEPS
@@ -80,7 +80,7 @@
"async_rev": "80886150a5e6c58006c8ae5a6c2aa7108638e2a9",
"bazel_worker_rev": "ceeba0982d4ff40d32371c9d35f3d2dc1868de20",
"benchmark_harness_rev": "c546dbd9f639f75cd2f75de8df2eb9f8ea15e8e7",
- "boolean_selector_rev": "665e6921ab246569420376f827bff4585dff0b14",
+ "boolean_selector_rev": "437e7f06c7e416bed91e16ae1df453555897e945",
"boringssl_gen_rev": "ced85ef0a00bbca77ce5a91261a5f2ae61b1e62f",
"boringssl_rev" : "87f316d7748268eb56f2dc147bd593254ae93198",
"browser-compat-data_tag": "v1.0.22",
@@ -89,7 +89,7 @@
"charcode_rev": "84ea427711e24abf3b832923959caa7dd9a8514b",
"chrome_rev" : "19997",
"cli_util_rev" : "b0adbba89442b2ea6fef39c7a82fe79cb31e1168",
- "clock_rev" : "a494269254ba978e7ef8f192c5f7fec3fc05b9d3",
+ "clock_rev" : "5631a0612f4ac7e1b32f7c9a00fc7c00a41615e1",
"collection_rev": "a4c941ab94044d118b2086a3f261c30377604127",
"convert_rev": "e063fdca4bebffecbb5e6aa5525995120982d9ce",
"crypto_rev": "b5024e4de2b1c474dd558bef593ddbf0bfade152",
@@ -113,9 +113,9 @@
"devtools_rev" : "3b054edf3a14a4a51bc8019f456efcf0073cd626",
"ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
"fixnum_rev": "848341f061359ef7ddc0cad472c2ecbb036b28ac",
- "file_rev": "0e09370f581ab6388d46fda4cdab66638c0171a1",
+ "file_rev": "1ebc38852ffed24b564910317982298b56c2cedd",
"glob_rev": "da1f4595ee2f87982cbcc663d4cac244822d9227",
- "html_rev": "3c2448108b431dd00d3a7033d9f43f19fa5d93d3",
+ "html_rev": "f108bce59d136c584969fd24a5006914796cf213",
"http_io_rev": "2fa188caf7937e313026557713f7feffedd4978b",
"http_multi_server_rev": "34bf7f04b61cce561f47f7f275c2cc811534a05a",
"http_parser_rev": "202391286ddc13c4c3c284ac5b511f04697250ed",
@@ -150,23 +150,23 @@
"shelf_proxy_tag": "v1.0.0",
"shelf_rev": "46483f896cc4308ee3d8e997030ae799b72aa16a",
"shelf_web_socket_rev": "24fb8a04befa75a94ac63a27047b231d1a22aab4",
- "source_map_stack_trace_rev": "1c3026f69d9771acf2f8c176a1ab750463309cce",
+ "source_map_stack_trace_rev": "80709f2d2fe5086ab50d744a28a2d26ea4384a1b",
"source_maps-0.9.4_rev": "38524",
"source_maps_rev": "6499ee3adac8d469e2953e2e8ba4bdb4c2fbef90",
"source_span_rev": "dc189b455d823e2919667f6c5dcb41ab7483bce0",
"sse_rev": "9084339389eb441d0c0518cddac211a097e78657",
"stack_trace_rev": "5220580872625ddee41e9ca9a5f3364789b2f0f6",
"stream_channel_rev": "3fa3e40c75c210d617b8b943b9b8f580e9866a89",
- "string_scanner_rev": "1b63e6e5db5933d7be0a45da6e1129fe00262734",
+ "string_scanner_rev": "0e53bf9059e8e22a3b346aac7ec755a0f8314eb6",
"sync_http_rev": "b59c134f2e34d12acac110d4f17f83e5a7db4330",
"test_descriptor_rev": "ead23c1e7df079ac0f6457a35f7a71432892e527",
"test_process_rev": "7c73ec8a8a6e0e63d0ec27d70c21ca4323fb5e8f",
- "term_glyph_rev": "6a0f9b6fb645ba75e7a00a4e20072678327a0347",
+ "term_glyph_rev": "4885b7f8af6931e23d3aa6d1767ee3f9a626923d",
"test_reflective_loader_rev": "fcfce37666672edac849d2af6dffc0f8df236a94",
"test_rev": "099dcc4d052a30c6921489cfbefa1c8531d12975",
"typed_data_rev": "29ce5a92b03326d0b8035916ac04f528874994bd",
"usage_rev": "f0cb8f7cce8b675255c81488dbab8cf9f2f56404",
- "vector_math_rev": "0c9f5d68c047813a6dcdeb88ba7a42daddf25025",
+ "vector_math_rev": "0cbed0914d49a6a44555e6d5444c438a4a4c3fc1",
"watcher_rev": "f76997ab0c857dc5537ac0975a9ada92b54ef949",
"webdriver_rev": "ff5ccb1522edf4bed578ead4d65e0cbc1f2c4f02",
"web_components_rev": "8f57dac273412a7172c8ade6f361b407e2e4ed02",
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index bb5c37e..7312240 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -2836,6 +2836,31 @@
r"""Enum factory constructors can't redirect to generative constructors.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String name)>
+ templateEnumImplementerContainsValuesDeclaration =
+ const Template<Message Function(String name)>(
+ problemMessageTemplate:
+ r"""'#name' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.""",
+ withArguments: _withArgumentsEnumImplementerContainsValuesDeclaration);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)>
+ codeEnumImplementerContainsValuesDeclaration =
+ const Code<Message Function(String name)>(
+ "EnumImplementerContainsValuesDeclaration",
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsEnumImplementerContainsValuesDeclaration(String name) {
+ if (name.isEmpty) throw 'No name provided';
+ name = demangleMixinApplicationName(name);
+ return new Message(codeEnumImplementerContainsValuesDeclaration,
+ problemMessage:
+ """'${name}' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeEnumInClass = messageEnumInClass;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart b/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
index 76a08e2..856e20d 100644
--- a/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
@@ -51,7 +51,7 @@
@override
void visitInstanceCreationExpression(InstanceCreationExpression node) {
- var labelText = node.constructorName.type2.name.name;
+ var labelText = node.constructorName.type.name.name;
var name = node.constructorName.name;
if (name != null) {
labelText += '.${name.name}';
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index 0711fd6..303ffc6 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -687,7 +687,7 @@
@override
void visitConstructorReference(ConstructorReference node) {
var constructorName = node.constructorName;
- constructorName.type2.accept(this);
+ constructorName.type.accept(this);
// We have a `ConstructorReference` only when it is resolved.
// TODO(scheglov) The `ConstructorName` in a tear-off always has a name,
diff --git a/pkg/analysis_server/lib/src/computer/computer_signature.dart b/pkg/analysis_server/lib/src/computer/computer_signature.dart
index 04013bf..0e852c2 100644
--- a/pkg/analysis_server/lib/src/computer/computer_signature.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_signature.dart
@@ -42,7 +42,7 @@
var element = ElementLocator.locate(parent);
execElement = element is ExecutableElement ? element : null;
} else if (parent is InstanceCreationExpression) {
- name = parent.constructorName.type2.name.name;
+ name = parent.constructorName.type.name.name;
var constructorName = parent.constructorName.name;
if (constructorName != null) {
name += '.${constructorName.name}';
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
index 51853fe..6aa8512 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
@@ -26,12 +26,12 @@
var node = request.target.containingNode;
if (node is ConstructorName) {
if (node.parent is ConstructorReference) {
- var element = node.type2.name.staticElement;
+ var element = node.type.name.staticElement;
if (element is ClassElement) {
_buildSuggestions(element);
}
} else {
- var type = node.type2.type;
+ var type = node.type.type;
if (type is InterfaceType) {
var element = type.element;
_buildSuggestions(element);
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart
index 4e1c0eb..8d9d8d4 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart
@@ -49,7 +49,7 @@
//
// Extract the information needed to build the edit.
//
- var constructorTypeArguments = creation.constructorName.type2.typeArguments;
+ var constructorTypeArguments = creation.constructorName.type.typeArguments;
//
// Build the edit.
//
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart
index 1704cda..cbc6f18 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart
@@ -51,7 +51,7 @@
//
// Extract the information needed to build the edit.
//
- var constructorTypeArguments = creation.constructorName.type2.typeArguments;
+ var constructorTypeArguments = creation.constructorName.type.typeArguments;
//
// Build the edit.
//
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart
index 8ebe7c7..158a890 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart
@@ -66,7 +66,7 @@
//
var name = creation.constructorName.name;
var constructorTypeArguments =
- creation.constructorName.type2.typeArguments;
+ creation.constructorName.type.typeArguments;
TypeArgumentList? elementTypeArguments;
SourceRange? elementsRange;
if (name == null) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
index e476729..1e367b0 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
@@ -63,7 +63,7 @@
}
// prepare target interface type
- var targetType = _constructorName.type2.type;
+ var targetType = _constructorName.type.type;
if (targetType is! InterfaceType) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
index 34ecd3a..e57083d 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
@@ -23,7 +23,7 @@
@override
Future<void> compute(ChangeBuilder builder) async {
var widgetClass = node.thisOrAncestorOfType<ClassDeclaration>();
- var superclass = widgetClass?.extendsClause?.superclass2;
+ var superclass = widgetClass?.extendsClause?.superclass;
if (widgetClass == null || superclass == null) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart b/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart
index 417a2cf..82676c6 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart
@@ -27,7 +27,7 @@
return;
}
- var namedType = creation.constructorName.type2;
+ var namedType = creation.constructorName.type;
if (namedType.typeArguments != null) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
index a5f687c..b1236c9 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
@@ -67,9 +67,9 @@
}
}
} else if (initializer is InstanceCreationExpression) {
- if (initializer.constructorName.type2.typeArguments == null) {
+ if (initializer.constructorName.type.typeArguments == null) {
typeArgumentsText = utils.getNodeText(typeArguments);
- typeArgumentsOffset = initializer.constructorName.type2.end;
+ typeArgumentsOffset = initializer.constructorName.type.end;
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart
index 4f0972c..bd0dde1 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart
@@ -114,7 +114,7 @@
if (node is ExtensionOverride) {
return node.typeArguments;
} else if (node is InstanceCreationExpression) {
- return node.constructorName.type2.typeArguments;
+ return node.constructorName.type.typeArguments;
} else if (node is InvocationExpression) {
return node.typeArguments;
} else if (node is NamedType) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart
index e512626..0157194 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart
@@ -96,7 +96,7 @@
}
} else if (node is InstanceCreationExpression) {
var name = node.constructorName;
- var className = _nameFromIdentifier(name.type2.name);
+ var className = _nameFromIdentifier(name.type.name);
var constructorName = name.name?.name ?? '';
if (components[0] == constructorName && components[1] == className) {
return true;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
index acceb63..beda821 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
@@ -223,7 +223,7 @@
// get a more exact matcher.
// TODO(brianwilkerson) Use 'new' for the name of the unnamed constructor.
var constructorName = node.name?.name ?? ''; // ?? 'new';
- var className = node.type2.name.simpleName;
+ var className = node.type.name.simpleName;
_addMatcher(
components: [constructorName, className],
kinds: const [ElementKind.constructorKind],
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart
index 92e23b9..6d36d486 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart
@@ -99,7 +99,7 @@
}
}
} else if (node is ConstructorName) {
- var typeName = node.type2.name;
+ var typeName = node.type.name;
SimpleIdentifier classNameNode;
if (typeName is SimpleIdentifier) {
classNameNode = typeName;
diff --git a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
index da822b8..93de681 100644
--- a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
+++ b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
@@ -181,7 +181,7 @@
name = expression.methodName.name;
} else if (expression is InstanceCreationExpression) {
var constructorName = expression.constructorName;
- var namedType = constructorName.type2;
+ var namedType = constructorName.type;
var typeNameIdentifier = namedType.name;
// new ClassName()
if (typeNameIdentifier is SimpleIdentifier) {
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index f5935dd..8f78367 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -29,6 +29,7 @@
show SourceChange, SourceEdit;
import 'package:analyzer_plugin/src/utilities/string_utilities.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
+import 'package:collection/collection.dart';
import 'package:path/path.dart' as path;
/// Adds edits to the given [change] that ensure that all the [libraries] are
@@ -982,6 +983,39 @@
return ClassMemberLocation(prefix, offset, suffix);
}
+ ClassMemberLocation? prepareEnumNewConstructorLocation(
+ EnumDeclaration enumDeclaration,
+ ) {
+ var indent = getIndent(1);
+
+ var targetMember = enumDeclaration.members
+ .where((e) => e is FieldDeclaration || e is ConstructorDeclaration)
+ .lastOrNull;
+ if (targetMember != null) {
+ return ClassMemberLocation(
+ endOfLine + endOfLine + indent,
+ targetMember.end,
+ '',
+ );
+ }
+
+ var semicolon = enumDeclaration.semicolon;
+ if (semicolon != null) {
+ return ClassMemberLocation(
+ endOfLine + endOfLine + indent,
+ semicolon.end,
+ '',
+ );
+ }
+
+ var lastConstant = enumDeclaration.constants.last;
+ return ClassMemberLocation(
+ ';' + endOfLine + endOfLine + indent,
+ lastConstant.end,
+ '',
+ );
+ }
+
ClassMemberLocation? prepareNewClassMemberLocation(
CompilationUnitMember declaration,
bool Function(ClassMember existingMember) shouldSkip) {
diff --git a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
index ee34219..d6832cf 100644
--- a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
+++ b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
@@ -295,15 +295,15 @@
// ClassDeclarations) and super.visitClassTypeAlias is not sufficient.
//
_handleRefEdge(
- node.superclass2.name.staticElement,
+ node.superclass.name.staticElement,
const <String>[schema.REF_EDGE],
- syntacticEntity: node.superclass2,
+ syntacticEntity: node.superclass,
);
// TODO(jwren) refactor the following lines into a method that can be used
// by visitClassDeclaration()
// extends
var recordSupertypeVName = _vNameFromElement(
- node.superclass2.name.staticElement, schema.RECORD_KIND);
+ node.superclass.name.staticElement, schema.RECORD_KIND);
addEdge(_enclosingClassVName!, schema.EXTENDS_EDGE, recordSupertypeVName);
// implements
@@ -659,7 +659,7 @@
// assert (element.enclosingElement != null);
}
// visit children
- _safelyVisitList(constructorName.type2.typeArguments?.arguments);
+ _safelyVisitList(constructorName.type.typeArguments?.arguments);
_safelyVisit(node.argumentList);
}
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
index 05e0eb3..cdb3485 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
@@ -418,7 +418,7 @@
// Rename the class when on `new` in an instance creation.
if (node is InstanceCreationExpression) {
var creation = node;
- var typeIdentifier = creation.constructorName.type2.name;
+ var typeIdentifier = creation.constructorName.type.name;
element = typeIdentifier.staticElement;
offset = typeIdentifier.offset;
length = typeIdentifier.length;
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart
index b31755a..7eef982 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart
@@ -72,6 +72,9 @@
bool get isConstructorTearOff =>
_match.kind == MatchKind.REFERENCE_BY_CONSTRUCTOR_TEAR_OFF;
+ bool get isInvocationByEnumConstantWithoutArguments =>
+ _match.kind == MatchKind.INVOCATION_BY_ENUM_CONSTANT_WITHOUT_ARGUMENTS;
+
bool get isResolved => _match.isResolved;
SourceRange get range => _match.sourceRange;
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart
index dc58d49..5e7e7bc 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart
@@ -10,8 +10,6 @@
import 'package:analysis_server/src/services/refactoring/refactoring_internal.dart';
import 'package:analysis_server/src/services/refactoring/rename.dart';
import 'package:analysis_server/src/services/search/hierarchy.dart';
-import 'package:analysis_server/src/services/search/search_engine.dart';
-import 'package:analysis_server/src/services/search/search_engine_internal.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -55,12 +53,6 @@
// prepare references
var matches = await searchEngine.searchReferences(element);
var references = getSourceReferences(matches);
- // append declaration
- if (element.isSynthetic) {
- await _replaceSynthetic();
- } else {
- references.add(_createDeclarationReference());
- }
// update references
for (var reference in references) {
String replacement;
@@ -69,8 +61,24 @@
} else {
replacement = reference.isConstructorTearOff ? '.new' : '';
}
+ if (reference.isInvocationByEnumConstantWithoutArguments) {
+ replacement += '()';
+ }
reference.addEdit(change, replacement);
}
+ // Update the declaration.
+ if (element.isSynthetic) {
+ await _replaceSynthetic();
+ } else {
+ doSourceChange_addSourceEdit(
+ change,
+ element.source,
+ newSourceEdit_range(
+ _declarationNameRange(),
+ newName.isNotEmpty ? '.$newName' : '',
+ ),
+ );
+ }
}
void _analyzePossibleConflicts(RefactoringStatus result) {
@@ -88,25 +96,14 @@
}
}
- SourceReference _createDeclarationReference() {
- SourceRange sourceRange;
+ SourceRange _declarationNameRange() {
var offset = element.periodOffset;
var nameEnd = element.nameEnd!;
if (offset != null) {
- sourceRange = range.startOffsetEndOffset(offset, nameEnd);
+ return range.startOffsetEndOffset(offset, nameEnd);
} else {
- sourceRange = SourceRange(nameEnd, 0);
+ return SourceRange(nameEnd, 0);
}
- return SourceReference(SearchMatchImpl(
- element.source.fullName,
- element.library.source,
- element.source,
- element.library,
- element,
- true,
- true,
- MatchKind.DECLARATION,
- sourceRange));
}
Future<void> _replaceSynthetic() async {
@@ -118,32 +115,46 @@
return;
}
- var classNode = result.node;
- if (classNode is! ClassDeclaration) {
- return;
- }
-
var resolvedUnit = result.resolvedUnit;
if (resolvedUnit == null) {
return;
}
- var utils = CorrectionUtils(resolvedUnit);
- var location =
- utils.prepareNewConstructorLocation(resolvedUnit.session, classNode);
- if (location == null) {
- return;
- }
+ var node = result.node;
+ if (node is ClassDeclaration) {
+ var utils = CorrectionUtils(resolvedUnit);
+ var location = utils.prepareNewConstructorLocation(session, node);
+ if (location == null) {
+ return;
+ }
- var header = '${classElement.name}.$newName();';
- doSourceChange_addElementEdit(
- change,
- classElement,
- SourceEdit(
- location.offset,
- 0,
- location.prefix + header + location.suffix,
- ),
- );
+ var header = '${classElement.name}.$newName();';
+ doSourceChange_addElementEdit(
+ change,
+ classElement,
+ SourceEdit(
+ location.offset,
+ 0,
+ location.prefix + header + location.suffix,
+ ),
+ );
+ } else if (node is EnumDeclaration) {
+ var utils = CorrectionUtils(resolvedUnit);
+ var location = utils.prepareEnumNewConstructorLocation(node);
+ if (location == null) {
+ return;
+ }
+
+ var header = 'const ${classElement.name}.$newName();';
+ doSourceChange_addElementEdit(
+ change,
+ classElement,
+ SourceEdit(
+ location.offset,
+ 0,
+ location.prefix + header + location.suffix,
+ ),
+ );
+ }
}
}
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index c86b091..59847fe 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -48,7 +48,7 @@
/// Return a list of the experiments that are to be enabled for tests in this
/// class, an empty list if there are no experiments that should be enabled.
List<String> get experiments => [
- EnableString.constructor_tearoffs,
+ EnableString.enhanced_enums,
EnableString.named_arguments_anywhere,
EnableString.super_parameters,
];
diff --git a/pkg/analysis_server/test/client/completion_driver_test.dart b/pkg/analysis_server/test/client/completion_driver_test.dart
index 848a1e8..47c6443 100644
--- a/pkg/analysis_server/test/client/completion_driver_test.dart
+++ b/pkg/analysis_server/test/client/completion_driver_test.dart
@@ -35,7 +35,9 @@
AnalysisServerOptions get serverOptions => AnalysisServerOptions();
- bool get supportsAvailableSuggestions;
+ bool get _isProtocolVersion1 {
+ return protocol == TestingCompletionProtocol.version1;
+ }
Future<void> addProjectFile(String relativePath, String content) async {
newFile('$testPackageRootPath/$relativePath', content: content);
@@ -43,7 +45,10 @@
expect(relativePath, startsWith('lib/'));
var packageRelativePath = relativePath.substring(4);
var uriStr = 'package:test/$packageRelativePath';
- await driver.waitForSetWithUri(uriStr);
+
+ if (_isProtocolVersion1) {
+ await driver.waitForSetWithUri(uriStr);
+ }
}
Future<List<CompletionSuggestion>> addTestFile(String content,
@@ -105,7 +110,7 @@
}
Future<List<CompletionSuggestion>> getSuggestions() async {
- if (supportsAvailableSuggestions) {
+ if (_isProtocolVersion1) {
await driver.waitForSetWithUri('dart:core');
await driver.waitForSetWithUri('dart:async');
}
@@ -154,7 +159,7 @@
''');
driver = CompletionDriver(
- supportsAvailableSuggestions: supportsAvailableSuggestions,
+ supportsAvailableSuggestions: _isProtocolVersion1,
server: this,
);
await driver.createProject();
@@ -234,9 +239,6 @@
}
mixin BasicCompletionTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => false;
-
/// Duplicates (and potentially replaces DeprecatedMemberRelevanceTest).
Future<void> test_deprecated_member_relevance() async {
await addTestFile('''
@@ -301,9 +303,6 @@
}
mixin CompletionWithSuggestionsTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_project_filterImports_defaultConstructor() async {
await addProjectFile('lib/a.dart', r'''
class A {}
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index 4ae4511..8d4e69a 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -1860,6 +1860,58 @@
);
}
+ Future<void> test_enum_constructor_add_toSynthetic() {
+ addTestFile('''
+enum E {
+ v1, v2.new()
+}
+''');
+ return assertSuccessfulRefactoring(
+ () {
+ return sendRenameRequest('new()', 'newName');
+ },
+ '''
+enum E {
+ v1.newName(), v2.newName();
+
+ const E.newName();
+}
+''',
+ feedbackValidator: (feedback) {
+ var renameFeedback = feedback as RenameFeedback;
+ expect(renameFeedback.offset, 17);
+ expect(renameFeedback.length, 4);
+ },
+ );
+ }
+
+ Future<void> test_enum_constructor_change() {
+ addTestFile('''
+enum E {
+ v1.test(), v2.test();
+
+ const E.test();
+}
+''');
+ return assertSuccessfulRefactoring(
+ () {
+ return sendRenameRequest('test();', 'newName');
+ },
+ '''
+enum E {
+ v1.newName(), v2.newName();
+
+ const E.newName();
+}
+''',
+ feedbackValidator: (feedback) {
+ var renameFeedback = feedback as RenameFeedback;
+ expect(renameFeedback.offset, 24);
+ expect(renameFeedback.length, 5);
+ },
+ );
+ }
+
Future<void> test_feedback() {
addTestFile('''
class Test {}
diff --git a/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart b/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart
index 1cbdf28..d154a6e 100644
--- a/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart
@@ -28,9 +28,6 @@
}
mixin EnumTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_enumConstantName() async {
await _check_locations(
declaration: 'enum MyEnum { foo01 }',
diff --git a/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart b/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart
index 8d27610..d473b9f 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart
@@ -45,26 +45,19 @@
}).toList();
}
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_nothing_x() async {
await _checkContainers(
line: '^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
{
// TODO(scheglov) Not quite right, without static.
Keyword.CONST,
- if (isClass || isMixin) Keyword.COVARIANT,
+ if (context.isClass || context.isMixin) Keyword.COVARIANT,
Keyword.DYNAMIC,
// TODO(scheglov) This does not look right, mixin.
- if (isClass || isMixin) Keyword.FACTORY,
+ if (context.isClass || context.isMixin) Keyword.FACTORY,
Keyword.FINAL,
Keyword.GET,
Keyword.LATE,
@@ -83,11 +76,7 @@
Future<void> test_static_const_x() async {
await _checkContainers(
line: 'static const ^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
{
@@ -103,11 +92,7 @@
Future<void> test_static_final_Ox() async {
await _checkContainers(
line: 'static final O^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
if (isProtocolVersion2) {
check(response).suggestions
..withKindKeyword.isEmpty
@@ -129,11 +114,7 @@
Future<void> test_static_final_x() async {
await _checkContainers(
line: 'static final ^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
{
@@ -149,11 +130,7 @@
Future<void> test_static_fx() async {
await _checkContainers(
line: 'static f^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
if (isProtocolVersion2) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
@@ -188,11 +165,7 @@
Future<void> test_static_late_x() async {
await _checkContainers(
line: 'static late ^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
{
@@ -208,11 +181,7 @@
Future<void> test_static_x() async {
await _checkContainers(
line: 'static ^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
{
@@ -230,11 +199,7 @@
Future<void> test_static_x_name_eq() async {
await _checkContainers(
line: 'static ^ name = 0;',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
{
@@ -258,11 +223,7 @@
Future<void> test_sx() async {
await _checkContainers(
line: 's^',
- validator: (
- response, {
- required bool isClass,
- required bool isMixin,
- }) {
+ validator: (context, response) {
if (isProtocolVersion2) {
check(response).suggestions
..withKindKeyword.matchesInAnyOrder(
@@ -282,10 +243,10 @@
{
// TODO(scheglov) Not quite right, without static.
Keyword.CONST,
- if (isClass || isMixin) Keyword.COVARIANT,
+ if (context.isClass || context.isMixin) Keyword.COVARIANT,
Keyword.DYNAMIC,
// TODO(scheglov) This does not look right, mixin.
- if (isClass || isMixin) Keyword.FACTORY,
+ if (context.isClass || context.isMixin) Keyword.FACTORY,
Keyword.FINAL,
Keyword.GET,
Keyword.LATE,
@@ -305,10 +266,9 @@
Future<void> _checkContainers({
required String line,
required void Function(
- CompletionResponseForTesting response, {
- required bool isClass,
- required bool isMixin,
- })
+ _Context context,
+ CompletionResponseForTesting response,
+ )
validator,
}) async {
// class
@@ -318,11 +278,7 @@
$line
}
''');
- validator(
- response,
- isClass: true,
- isMixin: false,
- );
+ validator(_Context(isClass: true), response);
}
// enum
{
@@ -332,11 +288,7 @@
$line
}
''');
- validator(
- response,
- isClass: false,
- isMixin: false,
- );
+ validator(_Context(), response);
}
// extension
{
@@ -345,11 +297,7 @@
$line
}
''');
- validator(
- response,
- isClass: false,
- isMixin: false,
- );
+ validator(_Context(), response);
}
// mixin
{
@@ -358,11 +306,17 @@
$line
}
''');
- validator(
- response,
- isClass: false,
- isMixin: true,
- );
+ validator(_Context(isMixin: true), response);
}
}
}
+
+class _Context {
+ final bool isClass;
+ final bool isMixin;
+
+ _Context({
+ this.isClass = false,
+ this.isMixin = false,
+ });
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/location/enum_constant_test.dart b/pkg/analysis_server/test/services/completion/dart/location/enum_constant_test.dart
index c9d4bf1..90a8f54 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/enum_constant_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/enum_constant_test.dart
@@ -30,9 +30,6 @@
}
mixin EnumConstantDeclarationTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_afterName_atEnd() async {
var response = await getTestCodeSuggestions('''
enum E {
diff --git a/pkg/analysis_server/test/services/completion/dart/location/enum_test.dart b/pkg/analysis_server/test/services/completion/dart/location/enum_test.dart
index 295cbdd..baaedd1 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/enum_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/enum_test.dart
@@ -46,9 +46,6 @@
}
mixin EnumDeclarationTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_afterConstants_noSemicolon() async {
var response = await getTestCodeSuggestions('''
enum E {
diff --git a/pkg/analysis_server/test/services/completion/dart/location/field_formal_parameter_test.dart b/pkg/analysis_server/test/services/completion/dart/location/field_formal_parameter_test.dart
index b34836b..41f4004 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/field_formal_parameter_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/field_formal_parameter_test.dart
@@ -30,9 +30,6 @@
}
mixin SuperFormalParameterTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
/// https://github.com/dart-lang/sdk/issues/39028
Future<void> test_mixin_constructor() async {
var response = await getTestCodeSuggestions('''
diff --git a/pkg/analysis_server/test/services/completion/dart/location/named_expression_test.dart b/pkg/analysis_server/test/services/completion/dart/location/named_expression_test.dart
index e3fd183..c6355ea 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/named_expression_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/named_expression_test.dart
@@ -30,9 +30,6 @@
}
mixin NamedExpressionExpressionTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_beforePositional() async {
var response = await getTestCodeSuggestions('''
void f(int x) {
diff --git a/pkg/analysis_server/test/services/completion/dart/location/super_formal_parameter_test.dart b/pkg/analysis_server/test/services/completion/dart/location/super_formal_parameter_test.dart
index a38465a..2d4144a 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/super_formal_parameter_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/super_formal_parameter_test.dart
@@ -30,9 +30,6 @@
}
mixin SuperFormalParameterTestCases on AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_explicit_optionalNamed_hasArgument_named() async {
var response = await getTestCodeSuggestions('''
class A {
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart b/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
index f353b8d..018c26d 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
@@ -8,9 +8,6 @@
import '../../../../client/completion_driver_test.dart';
abstract class CompletionRelevanceTest extends AbstractCompletionDriverTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
/// Assert that all of the given completions were produced and that the
/// suggestions are ordered in decreasing order based on relevance scores.
void assertOrder(List<CompletionSuggestion> suggestions) {
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart
index b6ad9fc..73fa3be 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart
@@ -29,9 +29,6 @@
}
mixin InstanceMemberTestCases on CompletionRelevanceTest {
- @override
- bool get supportsAvailableSuggestions => true;
-
Future<void> test_contextType() async {
await addTestFile(r'''
class A {}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
index 79d6fe7..9a40d78 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
@@ -12,12 +12,13 @@
void main() {
defineReflectiveSuite(() {
- defineReflectiveTests(RenameConstructorTest);
+ defineReflectiveTests(RenameConstructorClassTest);
+ defineReflectiveTests(RenameConstructorEnumTest);
});
}
@reflectiveTest
-class RenameConstructorTest extends RenameRefactoringTest {
+class RenameConstructorClassTest extends _RenameConstructorTest {
Future<void> test_checkInitialConditions_inSDK() async {
await indexTestUnit('''
main() {
@@ -285,7 +286,287 @@
RenameRefactoring.create(workspace, testAnalysisResult, null);
expect(refactoring, isNull);
}
+}
+@reflectiveTest
+class RenameConstructorEnumTest extends _RenameConstructorTest {
+ Future<void> test_checkNewName() async {
+ await indexTestUnit('''
+enum E {
+ v.test();
+ const E.test(); // 0
+}
+''');
+ createRenameRefactoringAtString('test(); // 0');
+ expect(refactoring.oldName, 'test');
+ // same
+ refactoring.newName = 'test';
+ assertRefactoringStatus(
+ refactoring.checkNewName(), RefactoringProblemSeverity.FATAL,
+ expectedMessage:
+ 'The new name must be different than the current name.');
+ // empty
+ refactoring.newName = '';
+ assertRefactoringStatusOK(refactoring.checkNewName());
+ // OK
+ refactoring.newName = 'newName';
+ assertRefactoringStatusOK(refactoring.checkNewName());
+ }
+
+ Future<void> test_checkNewName_hasMember_constructor() async {
+ await indexTestUnit('''
+enum E {
+ v.test();
+ const E.test(); // 0
+ const E.newName(); // existing
+}
+''');
+ _createConstructorDeclarationRefactoring('test(); // 0');
+ // check status
+ refactoring.newName = 'newName';
+ var status = refactoring.checkNewName();
+ assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
+ expectedMessage:
+ "Class 'E' already declares constructor with name 'newName'.",
+ expectedContextSearch: 'newName(); // existing');
+ }
+
+ Future<void> test_checkNewName_hasMember_method() async {
+ await indexTestUnit('''
+enum E {
+ v.test();
+ const E.test(); // 0
+ void newName() {} // existing
+}
+''');
+ _createConstructorDeclarationRefactoring('test(); // 0');
+ // check status
+ refactoring.newName = 'newName';
+ var status = refactoring.checkNewName();
+ assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
+ expectedMessage:
+ "Class 'E' already declares method with name 'newName'.",
+ expectedContextSearch: 'newName() {} // existing');
+ }
+
+ Future<void> test_createChange_add() async {
+ await indexTestUnit('''
+/// [E.new]
+enum E {
+ v1(), v2.new(), v3, v4.other();
+ const E(); // 0
+ const E.other() : this();
+}
+''');
+ // configure refactoring
+ _createConstructorDeclarationRefactoring('(); // 0');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+/// [E.newName]
+enum E {
+ v1.newName(), v2.newName(), v3.newName(), v4.other();
+ const E.newName(); // 0
+ const E.other() : this.newName();
+}
+''');
+ }
+
+ Future<void> test_createChange_add_toSynthetic_hasConstructor() async {
+ await indexTestUnit('''
+/// [E.new]
+enum E {
+ v1(), v2.new(), v3;
+
+ factory E.other() => throw 0;
+}
+''');
+ // configure refactoring
+ _createEnumConstantRefactoring('v1()');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+/// [E.newName]
+enum E {
+ v1.newName(), v2.newName(), v3.newName();
+
+ factory E.other() => throw 0;
+
+ const E.newName();
+}
+''');
+ }
+
+ Future<void> test_createChange_add_toSynthetic_hasField() async {
+ await indexTestUnit('''
+/// [E.new]
+enum E {
+ v1(), v2.new(), v3;
+
+ final int foo = 0;
+}
+''');
+ // configure refactoring
+ _createEnumConstantRefactoring('v1()');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+/// [E.newName]
+enum E {
+ v1.newName(), v2.newName(), v3.newName();
+
+ final int foo = 0;
+
+ const E.newName();
+}
+''');
+ }
+
+ Future<void> test_createChange_add_toSynthetic_hasMethod() async {
+ await indexTestUnit('''
+/// [E.new]
+enum E {
+ v1(), v2.new(), v3;
+
+ void foo() {}
+}
+''');
+ // configure refactoring
+ _createEnumConstantRefactoring('v1()');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+/// [E.newName]
+enum E {
+ v1.newName(), v2.newName(), v3.newName();
+
+ const E.newName();
+
+ void foo() {}
+}
+''');
+ }
+
+ Future<void> test_createChange_add_toSynthetic_hasSemicolon() async {
+ await indexTestUnit('''
+/// [E.new]
+enum E {
+ v1(), v2.new(), v3;
+}
+''');
+ // configure refactoring
+ _createEnumConstantRefactoring('v1()');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+/// [E.newName]
+enum E {
+ v1.newName(), v2.newName(), v3.newName();
+
+ const E.newName();
+}
+''');
+ }
+
+ Future<void> test_createChange_add_toSynthetic_noSemicolon() async {
+ await indexTestUnit('''
+/// [E.new]
+enum E {
+ v1(), v2.new(), v3
+}
+''');
+ // configure refactoring
+ _createEnumConstantRefactoring('v1()');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+/// [E.newName]
+enum E {
+ v1.newName(), v2.newName(), v3.newName();
+
+ const E.newName();
+}
+''');
+ }
+
+ Future<void> test_createChange_change() async {
+ await indexTestUnit('''
+/// [E.test]
+enum E {
+ v1.test(), v2.other();
+ const E.test(); // 0
+ const E.other() : this.test();
+}
+''');
+ // configure refactoring
+ _createConstructorDeclarationRefactoring('test(); // 0');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, 'test');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+/// [E.newName]
+enum E {
+ v1.newName(), v2.other();
+ const E.newName(); // 0
+ const E.other() : this.newName();
+}
+''');
+ }
+
+ Future<void> test_createChange_remove() async {
+ await indexTestUnit('''
+/// [E]
+enum E {
+ v1.test(), v2.other();
+ const E.test(); // 0
+ const E.other() : this.test();
+}
+''');
+ // configure refactoring
+ _createConstructorDeclarationRefactoring('test(); // 0');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, 'test');
+ // validate change
+ refactoring.newName = '';
+ return assertSuccessfulRefactoring('''
+/// [E]
+enum E {
+ v1(), v2.other();
+ const E(); // 0
+ const E.other() : this();
+}
+''');
+ }
+
+ void _createEnumConstantRefactoring(String search) {
+ var enumConstant = findNode.enumConstantDeclaration(search);
+ var element = enumConstant.constructorElement;
+ createRenameRefactoringForElement(element);
+ }
+}
+
+class _RenameConstructorTest extends RenameRefactoringTest {
void _createConstructorDeclarationRefactoring(String search) {
var element = findNode.constructor(search).declaredElement;
createRenameRefactoringForElement(element);
diff --git a/pkg/analysis_server/test/src/utilities/flutter_test.dart b/pkg/analysis_server/test/src/utilities/flutter_test.dart
index 53e071c..d616586 100644
--- a/pkg/analysis_server/test/src/utilities/flutter_test.dart
+++ b/pkg/analysis_server/test/src/utilities/flutter_test.dart
@@ -125,7 +125,7 @@
var statement = statements[0] as ExpressionStatement;
var creation = statement.expression as InstanceCreationExpression;
var constructorName = creation.constructorName;
- var namedType = constructorName.type2;
+ var namedType = constructorName.type;
var argumentList = creation.argumentList;
expect(_flutter.identifyWidgetExpression(creation), creation);
expect(_flutter.identifyWidgetExpression(constructorName), creation);
@@ -142,7 +142,7 @@
var statement = statements[1] as ExpressionStatement;
var creation = statement.expression as InstanceCreationExpression;
var constructorName = creation.constructorName;
- var namedType = constructorName.type2;
+ var namedType = constructorName.type;
var argumentList = creation.argumentList;
expect(_flutter.identifyWidgetExpression(creation), creation);
expect(_flutter.identifyWidgetExpression(constructorName), creation);
diff --git a/pkg/analysis_server/tool/code_completion/code_metrics.dart b/pkg/analysis_server/tool/code_completion/code_metrics.dart
index da9d00b..cdfd1df 100644
--- a/pkg/analysis_server/tool/code_completion/code_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/code_metrics.dart
@@ -326,7 +326,7 @@
'abstractKeyword': node.abstractKeyword,
'name': node.name,
'typeParameters': node.typeParameters,
- 'superclass': node.superclass2,
+ 'superclass': node.superclass,
'withClause': node.withClause,
'implementsClause': node.implementsClause,
});
@@ -409,7 +409,7 @@
@override
void visitConstructorName(ConstructorName node) {
_visitChildren(node, {
- 'type': node.type2,
+ 'type': node.type,
'name': node.name,
});
super.visitConstructorName(node);
@@ -531,7 +531,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
_visitChildren(node, {
- 'superclass': node.superclass2,
+ 'superclass': node.superclass,
});
super.visitExtendsClause(node);
}
@@ -775,7 +775,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
_visitChildren(node, {
- 'interfaces': node.interfaces2,
+ 'interfaces': node.interfaces,
});
super.visitImplementsClause(node);
}
@@ -986,7 +986,7 @@
@override
void visitOnClause(OnClause node) {
_visitChildren(node, {
- 'superclassConstraints': node.superclassConstraints2,
+ 'superclassConstraints': node.superclassConstraints,
});
super.visitOnClause(node);
}
@@ -1286,7 +1286,7 @@
@override
void visitWithClause(WithClause node) {
_visitChildren(node, {
- 'mixinTypes': node.mixinTypes2,
+ 'mixinTypes': node.mixinTypes,
});
super.visitWithClause(node);
}
diff --git a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
index 157e2be..97f3c5c 100644
--- a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
@@ -456,7 +456,7 @@
void visitClassTypeAlias(ClassTypeAlias node) {
var wasInGenericContext = inGenericContext;
inGenericContext = inGenericContext || node.typeParameters != null;
- _recordDataForNode('ClassTypeAlias (superclass)', node.superclass2);
+ _recordDataForNode('ClassTypeAlias (superclass)', node.superclass);
var context = 'superclass';
_recordTokenType('ClassDeclaration ($context)', node.withClause);
context = 'with';
@@ -646,7 +646,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- _recordDataForNode('ExtendsClause (type)', node.superclass2);
+ _recordDataForNode('ExtendsClause (type)', node.superclass);
super.visitExtendsClause(node);
}
@@ -845,7 +845,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
// At the start of each type name.
- for (var namedType in node.interfaces2) {
+ for (var namedType in node.interfaces) {
_recordDataForNode('ImplementsClause (type)', namedType);
}
super.visitImplementsClause(node);
@@ -1068,7 +1068,7 @@
@override
void visitOnClause(OnClause node) {
- for (var constraint in node.superclassConstraints2) {
+ for (var constraint in node.superclassConstraints) {
_recordDataForNode('OnClause (type)', constraint);
}
super.visitOnClause(node);
@@ -1351,7 +1351,7 @@
@override
void visitWithClause(WithClause node) {
- for (var namedType in node.mixinTypes2) {
+ for (var namedType in node.mixinTypes) {
_recordDataForNode('WithClause (type)', namedType);
}
super.visitWithClause(node);
diff --git a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
index 7111493..a50093b 100644
--- a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
+++ b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
@@ -463,7 +463,7 @@
@override
void visitClassTypeAlias(ClassTypeAlias node) {
- _recordDataForNode('ClassTypeAlias_superclass', node.superclass2);
+ _recordDataForNode('ClassTypeAlias_superclass', node.superclass);
var context = 'superclass';
_recordKeyword('ClassTypeAlias_$context', node.withClause);
context = 'with';
@@ -643,7 +643,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- _recordDataForNode('ExtendsClause_superclass', node.superclass2);
+ _recordDataForNode('ExtendsClause_superclass', node.superclass);
super.visitExtendsClause(node);
}
@@ -819,7 +819,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
// At the start of each type name.
- for (var namedType in node.interfaces2) {
+ for (var namedType in node.interfaces) {
_recordDataForNode('ImplementsClause_interface', namedType);
}
super.visitImplementsClause(node);
@@ -998,7 +998,7 @@
@override
void visitOnClause(OnClause node) {
- for (var constraint in node.superclassConstraints2) {
+ for (var constraint in node.superclassConstraints) {
_recordDataForNode('OnClause_superclassConstraint', constraint);
}
super.visitOnClause(node);
@@ -1251,7 +1251,7 @@
@override
void visitWithClause(WithClause node) {
- for (var namedType in node.mixinTypes2) {
+ for (var namedType in node.mixinTypes) {
_recordDataForNode('WithClause_mixinType', namedType);
}
super.visitWithClause(node);
diff --git a/pkg/analysis_server/tool/code_completion/visitors.dart b/pkg/analysis_server/tool/code_completion/visitors.dart
index f65c8b6..5783758 100644
--- a/pkg/analysis_server/tool/code_completion/visitors.dart
+++ b/pkg/analysis_server/tool/code_completion/visitors.dart
@@ -653,7 +653,7 @@
if (constructorName is ConstructorName) {
var instanceCreationExpression = constructorName.parent;
if (instanceCreationExpression is InstanceCreationExpression &&
- constructorName.type2.name == node) {
+ constructorName.type.name == node) {
if (instanceCreationExpression.keyword != null ||
constructorName.name == null) {
elementKind = protocol.ElementKind.CONSTRUCTOR;
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index e75af1d..64571a3 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -2,6 +2,7 @@
* Added `getField` to `ExtensionElement`.
* Added `isGenerative` to `ConstructorElement`.
* Added `isDartCoreEnum` to `ClassElement` and `DartType`.
+* Deprecated `superclass2`, `mixinTypes2`, etc. Use `superclass`, `mixinTypes`, etc.
## 3.2.0
* Deprecated `changes` getter in `File` and `Folder`, use `watch()` instead.
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 0d9c573..5719d83 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -916,6 +916,10 @@
SimpleIdentifier get name;
/// Return the name of the superclass of the class being declared.
+ NamedType get superclass;
+
+ /// Return the name of the superclass of the class being declared.
+ @Deprecated('Use superclass instead')
NamedType get superclass2;
/// Return the type parameters for the class, or `null` if the class does not
@@ -1342,6 +1346,10 @@
Token? get period;
/// Return the name of the type defining the constructor.
+ NamedType get type;
+
+ /// Return the name of the type defining the constructor.
+ @Deprecated('Use type instead')
NamedType get type2;
}
@@ -1783,6 +1791,10 @@
Token get extendsKeyword;
/// Return the name of the class that is being extended.
+ NamedType get superclass;
+
+ /// Return the name of the class that is being extended.
+ @Deprecated('Use superclass instead')
NamedType get superclass2;
}
@@ -2680,6 +2692,10 @@
Token get implementsKeyword;
/// Return the list of the interfaces that are being implemented.
+ NodeList<NamedType> get interfaces;
+
+ /// Return the list of the interfaces that are being implemented.
+ @Deprecated('Use interfaces instead')
NodeList<NamedType> get interfaces2;
}
@@ -3532,6 +3548,10 @@
Token get onKeyword;
/// Return the list of the classes are superclass constraints for the mixin.
+ NodeList<NamedType> get superclassConstraints;
+
+ /// Return the list of the classes are superclass constraints for the mixin.
+ @Deprecated('Use superclassConstraints instead')
NodeList<NamedType> get superclassConstraints2;
}
@@ -4615,6 +4635,10 @@
/// Clients may not extend, implement or mix-in this class.
abstract class WithClause implements AstNode {
/// Return the names of the mixins that were specified.
+ NodeList<NamedType> get mixinTypes;
+
+ /// Return the names of the mixins that were specified.
+ @Deprecated('Use mixinTypes instead')
NodeList<NamedType> get mixinTypes2;
/// Return the token representing the 'with' keyword.
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
index d65f695..b8a21dc 100644
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
@@ -173,7 +173,7 @@
NamedType? enclosingSuperClass;
if (node is ClassDeclaration) {
- enclosingSuperClass = node.extendsClause?.superclass2;
+ enclosingSuperClass = node.extendsClause?.superclass;
}
enclosingClassNameSignature =
@@ -290,7 +290,7 @@
var api = referenceCollector.collect(
apiTokenSignature,
typeParameters: node.typeParameters,
- superClass: node.superclass2,
+ superClass: node.superclass,
withClause: node.withClause,
implementsClause: node.implementsClause,
);
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
index b9b7403..706248e 100644
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
@@ -88,11 +88,11 @@
_visitTypeParameterList(typeParameters2);
// Parts of classes.
- _visitTypeAnnotation(extendsClause?.superclass2);
+ _visitTypeAnnotation(extendsClause?.superclass);
_visitTypeAnnotation(superClass);
- _visitTypeAnnotations(withClause?.mixinTypes2);
- _visitTypeAnnotations(onClause?.superclassConstraints2);
- _visitTypeAnnotations(implementsClause?.interfaces2);
+ _visitTypeAnnotations(withClause?.mixinTypes);
+ _visitTypeAnnotations(onClause?.superclassConstraints);
+ _visitTypeAnnotations(implementsClause?.interfaces);
// Parts of executables.
_visitFormalParameterList(formalParameters);
@@ -305,7 +305,7 @@
void _visitConstructorName(ConstructorName? node) {
if (node == null) return;
- _visitConstructor(node.type2, node.name);
+ _visitConstructor(node.type, node.name);
}
void _visitExpression(Expression? node, {bool get = true, bool set = false}) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/index.dart b/pkg/analyzer/lib/src/dart/analysis/index.dart
index b703443..ba8cdd5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/index.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/index.dart
@@ -634,13 +634,13 @@
offset = node.period!.offset;
length = node.name!.end - offset;
} else {
- offset = node.type2.end;
+ offset = node.type.end;
length = 0;
}
recordRelationOffset(element, kind, offset, length, true);
- node.type2.accept(this);
+ node.type.accept(this);
}
@override
@@ -690,7 +690,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- recordSuperType(node.superclass2, IndexRelationKind.IS_EXTENDED_BY);
+ recordSuperType(node.superclass, IndexRelationKind.IS_EXTENDED_BY);
}
@override
@@ -709,7 +709,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
- for (NamedType namedType in node.interfaces2) {
+ for (NamedType namedType in node.interfaces) {
recordSuperType(namedType, IndexRelationKind.IS_IMPLEMENTED_BY);
}
}
@@ -763,7 +763,7 @@
@override
void visitNamedType(NamedType node) {
AstNode parent = node.parent!;
- if (parent is ClassTypeAlias && parent.superclass2 == node) {
+ if (parent is ClassTypeAlias && parent.superclass == node) {
recordSuperType(node, IndexRelationKind.IS_EXTENDED_BY);
} else {
super.visitNamedType(node);
@@ -772,7 +772,7 @@
@override
void visitOnClause(OnClause node) {
- for (NamedType namedType in node.superclassConstraints2) {
+ for (NamedType namedType in node.superclassConstraints) {
recordSuperType(namedType, IndexRelationKind.IS_IMPLEMENTED_BY);
}
}
@@ -893,7 +893,7 @@
@override
void visitWithClause(WithClause node) {
- for (NamedType namedType in node.mixinTypes2) {
+ for (NamedType namedType in node.mixinTypes) {
recordSuperType(namedType, IndexRelationKind.IS_MIXED_IN_BY);
}
}
@@ -925,9 +925,9 @@
}
addSupertype(superclass);
- withClause?.mixinTypes2.forEach(addSupertype);
- onClause?.superclassConstraints2.forEach(addSupertype);
- implementsClause?.interfaces2.forEach(addSupertype);
+ withClause?.mixinTypes.forEach(addSupertype);
+ onClause?.superclassConstraints.forEach(addSupertype);
+ implementsClause?.interfaces.forEach(addSupertype);
void addMemberName(SimpleIdentifier identifier) {
String name = identifier.name;
@@ -955,7 +955,7 @@
/// Record the given class as a subclass of its direct superclasses.
void _addSubtypeForClassDeclaration(ClassDeclaration node) {
_addSubtype(node.name.name,
- superclass: node.extendsClause?.superclass2,
+ superclass: node.extendsClause?.superclass,
withClause: node.withClause,
implementsClause: node.implementsClause,
memberNodes: node.members);
@@ -964,7 +964,7 @@
/// Record the given class as a subclass of its direct superclasses.
void _addSubtypeForClassTypeAlis(ClassTypeAlias node) {
_addSubtype(node.name.name,
- superclass: node.superclass2,
+ superclass: node.superclass,
withClause: node.withClause,
implementsClause: node.implementsClause,
memberNodes: const []);
diff --git a/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart b/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
index 2d5e347..073d6f6 100644
--- a/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
@@ -34,16 +34,16 @@
for (CompilationUnitMember declaration in unit.declarations) {
if (declaration is ClassDeclaration) {
- _addSubtypedName(declaration.extendsClause?.superclass2);
- _addSubtypedNames(declaration.withClause?.mixinTypes2);
- _addSubtypedNames(declaration.implementsClause?.interfaces2);
+ _addSubtypedName(declaration.extendsClause?.superclass);
+ _addSubtypedNames(declaration.withClause?.mixinTypes);
+ _addSubtypedNames(declaration.implementsClause?.interfaces);
} else if (declaration is ClassTypeAlias) {
- _addSubtypedName(declaration.superclass2);
- _addSubtypedNames(declaration.withClause.mixinTypes2);
- _addSubtypedNames(declaration.implementsClause?.interfaces2);
+ _addSubtypedName(declaration.superclass);
+ _addSubtypedNames(declaration.withClause.mixinTypes);
+ _addSubtypedNames(declaration.implementsClause?.interfaces);
} else if (declaration is MixinDeclaration) {
- _addSubtypedNames(declaration.onClause?.superclassConstraints2);
- _addSubtypedNames(declaration.implementsClause?.interfaces2);
+ _addSubtypedNames(declaration.onClause?.superclassConstraints);
+ _addSubtypedNames(declaration.implementsClause?.interfaces);
}
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 50f88f8..0424dc2 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -1729,10 +1729,14 @@
@override
bool get isAbstract => abstractKeyword != null;
+ @override
+ NamedTypeImpl get superclass => _superclass;
+
set superclass(NamedType superclass) {
_superclass = _becomeParentOf(superclass as NamedTypeImpl);
}
+ @Deprecated('Use superclass instead')
@override
NamedTypeImpl get superclass2 => _superclass;
@@ -2675,10 +2679,14 @@
_name = _becomeParentOf(name as SimpleIdentifierImpl?);
}
+ @override
+ NamedTypeImpl get type => _type;
+
set type(NamedType type) {
_type = _becomeParentOf(type as NamedTypeImpl);
}
+ @Deprecated('Use type instead')
@override
NamedTypeImpl get type2 => _type;
@@ -3856,10 +3864,14 @@
@override
Token get endToken => _superclass.endToken;
+ @override
+ NamedTypeImpl get superclass => _superclass;
+
set superclass(NamedType name) {
_superclass = _becomeParentOf(name as NamedTypeImpl);
}
+ @Deprecated('Use superclass instead')
@override
NamedTypeImpl get superclass2 => _superclass;
@@ -6002,12 +6014,16 @@
// TODO(paulberry): add commas.
Iterable<SyntacticEntity> get childEntities => ChildEntities()
..add(implementsKeyword)
- ..addAll(interfaces2);
+ ..addAll(interfaces);
@override
Token get endToken => _interfaces.endToken!;
@override
+ NodeListImpl<NamedType> get interfaces => _interfaces;
+
+ @Deprecated('Use interfaces instead')
+ @override
NodeListImpl<NamedType> get interfaces2 => _interfaces;
@override
@@ -8217,12 +8233,16 @@
// TODO(paulberry): add commas.
Iterable<SyntacticEntity> get childEntities => ChildEntities()
..add(onKeyword)
- ..addAll(superclassConstraints2);
+ ..addAll(superclassConstraints);
@override
Token get endToken => _superclassConstraints.endToken!;
@override
+ NodeListImpl<NamedType> get superclassConstraints => _superclassConstraints;
+
+ @Deprecated('Use superclassConstraints instead')
+ @override
NodeListImpl<NamedType> get superclassConstraints2 => _superclassConstraints;
@override
@@ -11315,6 +11335,10 @@
Token get endToken => _mixinTypes.endToken!;
@override
+ NodeListImpl<NamedType> get mixinTypes => _mixinTypes;
+
+ @Deprecated('Use mixinTypes instead')
+ @override
NodeListImpl<NamedType> get mixinTypes2 => _mixinTypes;
@override
diff --git a/pkg/analyzer/lib/src/dart/ast/element_locator.dart b/pkg/analyzer/lib/src/dart/ast/element_locator.dart
index 8159d3a..e0bfc35 100644
--- a/pkg/analyzer/lib/src/dart/ast/element_locator.dart
+++ b/pkg/analyzer/lib/src/dart/ast/element_locator.dart
@@ -52,6 +52,18 @@
}
@override
+ Element? visitConstructorSelector(ConstructorSelector node) {
+ var parent = node.parent;
+ if (parent is EnumConstantArguments) {
+ var parent2 = parent.parent;
+ if (parent2 is EnumConstantDeclaration) {
+ return parent2.constructorElement;
+ }
+ }
+ return null;
+ }
+
+ @override
Element? visitExportDirective(ExportDirective node) {
return node.element;
}
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 2fc1149..960f2cf 100644
--- a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
@@ -174,7 +174,7 @@
_visitNode(node.name);
_visitNode(node.typeParameters);
sink.write(' = ');
- _visitNode(node.superclass2);
+ _visitNode(node.superclass);
_visitNode(node.withClause, prefix: ' ');
_visitNode(node.implementsClause, prefix: ' ');
sink.write(';');
@@ -239,7 +239,7 @@
@override
void visitConstructorName(ConstructorName node) {
- _visitNode(node.type2);
+ _visitNode(node.type);
_visitNode(node.name, prefix: '.');
}
@@ -376,7 +376,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
sink.write('extends ');
- _visitNode(node.superclass2);
+ _visitNode(node.superclass);
}
@override
@@ -622,7 +622,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
sink.write('implements ');
- _visitNodeList(node.interfaces2, separator: ', ');
+ _visitNodeList(node.interfaces, separator: ', ');
}
@override
@@ -813,7 +813,7 @@
@override
void visitOnClause(OnClause node) {
sink.write('on ');
- _visitNodeList(node.superclassConstraints2, separator: ', ');
+ _visitNodeList(node.superclassConstraints, separator: ', ');
}
@override
@@ -1113,7 +1113,7 @@
@override
void visitWithClause(WithClause node) {
sink.write('with ');
- _visitNodeList(node.mixinTypes2, separator: ', ');
+ _visitNodeList(node.mixinTypes, separator: ', ');
}
@override
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 1aca07f..dd78df6 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -255,7 +255,7 @@
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualTokens(node.equals, other.equals) &&
isEqualTokens(node.abstractKeyword, other.abstractKeyword) &&
- isEqualNodes(node.superclass2, other.superclass2) &&
+ isEqualNodes(node.superclass, other.superclass) &&
isEqualNodes(node.withClause, other.withClause) &&
isEqualNodes(node.implementsClause, other.implementsClause) &&
isEqualTokens(node.semicolon, other.semicolon);
@@ -338,7 +338,7 @@
@override
bool visitConstructorName(ConstructorName node) {
ConstructorName other = _other as ConstructorName;
- return isEqualNodes(node.type2, other.type2) &&
+ return isEqualNodes(node.type, other.type) &&
isEqualTokens(node.period, other.period) &&
isEqualNodes(node.name, other.name);
}
@@ -482,7 +482,7 @@
bool visitExtendsClause(ExtendsClause node) {
ExtendsClause other = _other as ExtendsClause;
return isEqualTokens(node.extendsKeyword, other.extendsKeyword) &&
- isEqualNodes(node.superclass2, other.superclass2);
+ isEqualNodes(node.superclass, other.superclass);
}
@override
@@ -733,7 +733,7 @@
bool visitImplementsClause(ImplementsClause node) {
ImplementsClause other = _other as ImplementsClause;
return isEqualTokens(node.implementsKeyword, other.implementsKeyword) &&
- _isEqualNodeLists(node.interfaces2, other.interfaces2);
+ _isEqualNodeLists(node.interfaces, other.interfaces);
}
@override
@@ -938,7 +938,7 @@
OnClause other = _other as OnClause;
return isEqualTokens(node.onKeyword, other.onKeyword) &&
_isEqualNodeLists(
- node.superclassConstraints2, other.superclassConstraints2);
+ node.superclassConstraints, other.superclassConstraints);
}
@override
@@ -1281,7 +1281,7 @@
bool visitWithClause(WithClause node) {
WithClause other = _other as WithClause;
return isEqualTokens(node.withKeyword, other.withKeyword) &&
- _isEqualNodeLists(node.mixinTypes2, other.mixinTypes2);
+ _isEqualNodeLists(node.mixinTypes, other.mixinTypes);
}
@override
@@ -1797,7 +1797,7 @@
} else if (identical(node.typeParameters, _oldNode)) {
node.typeParameters = _newNode as TypeParameterList;
return true;
- } else if (identical(node.superclass2, _oldNode)) {
+ } else if (identical(node.superclass, _oldNode)) {
node.superclass = _newNode as NamedType;
return true;
} else if (identical(node.withClause, _oldNode)) {
@@ -1908,7 +1908,7 @@
@override
bool visitConstructorName(covariant ConstructorNameImpl node) {
- if (identical(node.type2, _oldNode)) {
+ if (identical(node.type, _oldNode)) {
node.type = _newNode as NamedType;
return true;
} else if (identical(node.name, _oldNode)) {
@@ -2061,7 +2061,7 @@
@override
bool visitExtendsClause(covariant ExtendsClauseImpl node) {
- if (identical(node.superclass2, _oldNode)) {
+ if (identical(node.superclass, _oldNode)) {
node.superclass = _newNode as NamedType;
return true;
}
@@ -2402,7 +2402,7 @@
@override
bool visitImplementsClause(covariant ImplementsClauseImpl node) {
- if (_replaceInList(node.interfaces2)) {
+ if (_replaceInList(node.interfaces)) {
return true;
}
return visitNode(node);
@@ -2674,7 +2674,7 @@
@override
bool visitOnClause(covariant OnClauseImpl node) {
- if (_replaceInList(node.superclassConstraints2)) {
+ if (_replaceInList(node.superclassConstraints)) {
return true;
}
return visitNode(node);
@@ -3046,7 +3046,7 @@
@override
bool visitWithClause(covariant WithClauseImpl node) {
- if (_replaceInList(node.mixinTypes2)) {
+ if (_replaceInList(node.mixinTypes)) {
return true;
}
return visitNode(node);
diff --git a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
index 1202cc6..92f15c0 100644
--- a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
+++ b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
@@ -118,7 +118,7 @@
void visitConstructorReference(ConstructorReference node) {
super.visitConstructorReference(node);
if (node.inConstantContext || node.inConstantExpression) {
- _checkForConstWithTypeParameters(node.constructorName.type2,
+ _checkForConstWithTypeParameters(node.constructorName.type,
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS_CONSTRUCTOR_TEAROFF);
}
}
@@ -169,7 +169,7 @@
@override
void visitInstanceCreationExpression(InstanceCreationExpression node) {
if (node.isConst) {
- NamedType namedType = node.constructorName.type2;
+ NamedType namedType = node.constructorName.type;
_checkForConstWithTypeParameters(
namedType, CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS);
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 0e8ee0a..49ca24e 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -662,7 +662,7 @@
// The result is already instantiated during resolution;
// [_dartObjectComputer.typeInstantiate] is unnecessary.
var typeElement =
- node.constructorName.type2.name.staticElement as TypeDefiningElement;
+ node.constructorName.type.name.staticElement as TypeDefiningElement;
TypeAliasElement? viaTypeAlias;
if (typeElement is TypeAliasElementImpl) {
diff --git a/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart b/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart
index ae554f5..66503bc 100644
--- a/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart
+++ b/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart
@@ -188,7 +188,7 @@
}
if (node is ConstructorReference) {
- _typeArgumentList(node.constructorName.type2.typeArguments);
+ _typeArgumentList(node.constructorName.type.typeArguments);
return;
}
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index 06fb704..f4077d4 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -551,10 +551,10 @@
return;
}
if (errorNode is ConstructorName &&
- !(errorNode.type2.type as InterfaceType).element.hasOptionalTypeArgs) {
+ !(errorNode.type.type as InterfaceType).element.hasOptionalTypeArgs) {
String constructorName = errorNode.name == null
- ? errorNode.type2.name.name
- : '${errorNode.type2}.${errorNode.name}';
+ ? errorNode.type.name.name
+ : '${errorNode.type}.${errorNode.name}';
errorReporter.reportErrorForNode(
HintCode.INFERENCE_FAILURE_ON_INSTANCE_CREATION,
errorNode,
diff --git a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
index 61f364e..1ab0674 100644
--- a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
@@ -45,7 +45,7 @@
// Either `new` or `const` has been specified.
return node;
}
- var typeName = node.constructorName.type2.name;
+ var typeName = node.constructorName.type.name;
if (typeName is SimpleIdentifier) {
var element = nameScope.lookup(typeName.name).getter;
if (element is FunctionElement ||
@@ -525,8 +525,8 @@
required TypeAliasElement element,
}) {
var typeName = astFactory.namedType(
- name: node.constructorName.type2.name,
- typeArguments: node.constructorName.type2.typeArguments,
+ name: node.constructorName.type.name,
+ typeArguments: node.constructorName.type.typeArguments,
);
typeName.type = element.aliasedType;
typeName.name.staticType = element.aliasedType;
@@ -549,7 +549,7 @@
}) {
var functionReference = astFactory.functionReference(
function: function,
- typeArguments: node.constructorName.type2.typeArguments,
+ typeArguments: node.constructorName.type.typeArguments,
);
var methodInvocation = astFactory.methodInvocation(
functionReference,
diff --git a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
index 4ef8323..bd133e5 100644
--- a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
@@ -20,7 +20,7 @@
void resolve(ConstructorReferenceImpl node) {
if (!_resolver.isConstructorTearoffsEnabled &&
- node.constructorName.type2.typeArguments == null) {
+ node.constructorName.type.typeArguments == null) {
// Only report this if [node] has no explicit type arguments; otherwise
// the parser has already reported an error.
_resolver.errorReporter.reportErrorForNode(
@@ -49,7 +49,7 @@
//
// Only report errors when the constructor tearoff feature is enabled,
// to avoid reporting redundant errors.
- var enclosingElement = node.constructorName.type2.name.staticElement;
+ var enclosingElement = node.constructorName.type.name.staticElement;
if (enclosingElement is TypeAliasElement) {
enclosingElement = enclosingElement.aliasedType.element;
}
@@ -124,7 +124,7 @@
constructorName.name?.staticElement = constructorElement.declaration;
node.staticType = inferred;
// The NamedType child of `constructorName` doesn't have a static type.
- constructorName.type2.type = null;
+ constructorName.type.type = null;
}
} else {
var constructorElement = constructorName.staticElement;
@@ -134,7 +134,7 @@
node.staticType = constructorElement.type;
}
// The NamedType child of `constructorName` doesn't have a static type.
- constructorName.type2.type = null;
+ constructorName.type.type = null;
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
index dedb7b5..41802d0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
@@ -65,7 +65,7 @@
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
typeArguments,
[
- function.constructorName.type2.name.toSource(),
+ function.constructorName.type.name.toSource(),
function.constructorName.name!.name
],
);
diff --git a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
index 2e12dd0..fff2325 100644
--- a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
@@ -38,7 +38,7 @@
// InstanceCreationExpression needs to be rewritten as a MethodInvocation
// with a target of `a.m<int>` (a FunctionReference) and a name of `apply`.
if (node.keyword == null) {
- var typeNameTypeArguments = node.constructorName.type2.typeArguments;
+ var typeNameTypeArguments = node.constructorName.type.typeArguments;
if (typeNameTypeArguments != null) {
// This could be a method call on a function reference or a constructor
// reference.
@@ -60,7 +60,7 @@
constructorName: constructorName,
definingLibrary: _resolver.definingLibrary,
);
- var typeName = constructorName.type2;
+ var typeName = constructorName.type;
var constructorElement = constructorName.staticElement;
var inferenceResult = inferArgumentTypes(
inferenceNode: node,
@@ -93,7 +93,7 @@
InstanceCreationExpressionImpl node,
TypeArgumentListImpl typeNameTypeArguments,
) {
- var typeNameName = node.constructorName.type2.name;
+ var typeNameName = node.constructorName.type.name;
if (typeNameName is SimpleIdentifierImpl) {
// TODO(srawlins): Lookup the name and potentially rewrite `node` as a
// [MethodInvocation].
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
index e31ad4c..598cae9 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
@@ -97,7 +97,7 @@
List<TypeParameterElement>? typeParameters;
ConstructorElement? rawElement;
- var typeName = constructorName.type2;
+ var typeName = constructorName.type;
var typeArguments = typeName.typeArguments;
var typeElement = typeName.name.staticElement;
if (typeElement is ClassElement) {
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index d41a3b6..0cef5e5 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -235,7 +235,7 @@
ErrorCode errorCode = withClause == null
? CompileTimeErrorCode.EXTENDS_NON_CLASS
: CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS;
- _resolveType(extendsClause.superclass2, errorCode, asClass: true);
+ _resolveType(extendsClause.superclass, errorCode, asClass: true);
}
_resolveWithClause(withClause);
@@ -265,7 +265,7 @@
node.typeParameters?.accept(this);
_resolveType(
- node.superclass2,
+ node.superclass,
CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS,
asClass: true,
);
@@ -780,7 +780,7 @@
void visitInstanceCreationExpression(InstanceCreationExpression node) {
var newNode = _astRewriter.instanceCreationExpression(_nameScope, node);
if (newNode != node) {
- if (node.constructorName.type2.typeArguments != null &&
+ if (node.constructorName.type.typeArguments != null &&
newNode is MethodInvocation &&
newNode.target is FunctionReference &&
!_libraryElement.featureSet.isEnabled(Feature.constructor_tearoffs)) {
@@ -1293,7 +1293,7 @@
if (clause == null) return;
_resolveTypes(
- clause.interfaces2,
+ clause.interfaces,
CompileTimeErrorCode.IMPLEMENTS_NON_CLASS,
);
}
@@ -1302,7 +1302,7 @@
if (clause == null) return;
_resolveTypes(
- clause.superclassConstraints2,
+ clause.superclassConstraints,
CompileTimeErrorCode.MIXIN_SUPER_CLASS_CONSTRAINT_NON_INTERFACE,
);
}
@@ -1311,7 +1311,7 @@
var redirectedConstructor = node.redirectedConstructor;
if (redirectedConstructor == null) return;
- var namedType = redirectedConstructor.type2;
+ var namedType = redirectedConstructor.type;
_namedTypeResolver.redirectedConstructor_namedType = namedType;
redirectedConstructor.accept(this);
@@ -1372,7 +1372,7 @@
void _resolveWithClause(WithClause? clause) {
if (clause == null) return;
- for (var namedType in clause.mixinTypes2) {
+ for (var namedType in clause.mixinTypes) {
_namedTypeResolver.withClause_namedType = namedType;
_resolveType(
namedType as NamedTypeImpl,
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 74bf441..a151c37 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -1197,7 +1197,7 @@
// TODO(jwren) We should modify ConstructorElement.getDisplayName(), or
// have the logic centralized elsewhere, instead of doing this logic
// here.
- String fullConstructorName = constructorName.type2.name.name;
+ String fullConstructorName = constructorName.type.name.name;
if (constructorName.name != null) {
fullConstructorName = '$fullConstructorName.${constructorName.name}';
}
diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart
index e7d450e..5e6859d 100644
--- a/pkg/analyzer/lib/src/error/inheritance_override.dart
+++ b/pkg/analyzer/lib/src/error/inheritance_override.dart
@@ -45,7 +45,7 @@
classNameNode: declaration.name,
implementsClause: declaration.implementsClause,
members: declaration.members,
- superclass: declaration.extendsClause?.superclass2,
+ superclass: declaration.extendsClause?.superclass,
withClause: declaration.withClause,
).verify();
} else if (declaration is ClassTypeAlias) {
@@ -58,7 +58,7 @@
library: library,
classNameNode: declaration.name,
implementsClause: declaration.implementsClause,
- superclass: declaration.superclass2,
+ superclass: declaration.superclass,
withClause: declaration.withClause,
).verify();
} else if (declaration is EnumDeclaration) {
@@ -178,7 +178,7 @@
// class C extends S&M2 { ...members of C... }
// So, we need to check members of each mixin against superinterfaces
// of `S`, and superinterfaces of all previous mixins.
- var mixinNodes = withClause?.mixinTypes2;
+ var mixinNodes = withClause?.mixinTypes;
var mixinTypes = classElement.mixins;
for (var i = 0; i < mixinTypes.length; i++) {
var mixinType = mixinTypes[i];
@@ -398,7 +398,7 @@
bool _checkDirectSuperTypes() {
var hasError = false;
if (implementsClause != null) {
- for (var namedType in implementsClause!.interfaces2) {
+ for (var namedType in implementsClause!.interfaces) {
if (_checkDirectSuperType(
namedType,
CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
@@ -408,7 +408,7 @@
}
}
if (onClause != null) {
- for (var namedType in onClause!.superclassConstraints2) {
+ for (var namedType in onClause!.superclassConstraints) {
if (_checkDirectSuperType(
namedType,
CompileTimeErrorCode.MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS,
@@ -426,7 +426,7 @@
}
}
if (withClause != null) {
- for (var namedType in withClause!.mixinTypes2) {
+ for (var namedType in withClause!.mixinTypes) {
if (_checkDirectSuperType(
namedType,
CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index db01b0b..aadad6e 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -33,7 +33,7 @@
_libraryElement.typeSystem as TypeSystemImpl;
void checkConstructorReference(ConstructorReference node) {
- var classElement = node.constructorName.type2.name.staticElement;
+ var classElement = node.constructorName.type.name.staticElement;
List<TypeParameterElement> typeParameters;
if (classElement is TypeAliasElement) {
typeParameters = classElement.typeParameters;
@@ -46,7 +46,7 @@
if (typeParameters.isEmpty) {
return;
}
- var typeArgumentList = node.constructorName.type2.typeArguments;
+ var typeArgumentList = node.constructorName.type.typeArguments;
if (typeArgumentList == null) {
return;
}
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 8046f63..68ee0dc 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -2821,7 +2821,7 @@
if (!enableEnhancedEnums &&
(tmpArguments != null ||
tmpConstructor != null &&
- (tmpConstructor.type2.typeArguments != null ||
+ (tmpConstructor.type.typeArguments != null ||
tmpConstructor.name != null))) {
Token token = tmpArguments != null
? tmpArguments.argumentList.beginToken
@@ -2842,7 +2842,7 @@
TypeArgumentListImpl? typeArguments;
ConstructorSelectorImpl? constructorSelector;
if (tmpConstructor != null) {
- typeArguments = tmpConstructor.type2.typeArguments;
+ typeArguments = tmpConstructor.type.typeArguments;
var constructorNamePeriod = tmpConstructor.period;
var constructorNameId = tmpConstructor.name;
if (constructorNamePeriod != null && constructorNameId != null) {
@@ -3744,7 +3744,7 @@
var extendsClause = pop(NullValue.ExtendsClause) as ExtendsClause?;
var declaration = declarations.last as ClassDeclarationImpl;
if (extendsClause != null) {
- if (declaration.extendsClause?.superclass2 == null) {
+ if (declaration.extendsClause?.superclass == null) {
declaration.extendsClause = extendsClause;
}
}
@@ -3752,15 +3752,15 @@
if (declaration.withClause == null) {
declaration.withClause = withClause;
} else {
- declaration.withClause!.mixinTypes2.addAll(withClause.mixinTypes2);
+ declaration.withClause!.mixinTypes.addAll(withClause.mixinTypes);
}
}
if (implementsClause != null) {
if (declaration.implementsClause == null) {
declaration.implementsClause = implementsClause;
} else {
- declaration.implementsClause!.interfaces2
- .addAll(implementsClause.interfaces2);
+ declaration.implementsClause!.interfaces
+ .addAll(implementsClause.interfaces);
}
}
}
@@ -3802,16 +3802,16 @@
if (mixinDeclaration!.onClause == null) {
mixinDeclaration!.onClause = onClause;
} else {
- mixinDeclaration!.onClause!.superclassConstraints2
- .addAll(onClause.superclassConstraints2);
+ mixinDeclaration!.onClause!.superclassConstraints
+ .addAll(onClause.superclassConstraints);
}
}
if (implementsClause != null) {
if (mixinDeclaration!.implementsClause == null) {
mixinDeclaration!.implementsClause = implementsClause;
} else {
- mixinDeclaration!.implementsClause!.interfaces2
- .addAll(implementsClause.interfaces2);
+ mixinDeclaration!.implementsClause!.interfaces
+ .addAll(implementsClause.interfaces);
}
}
}
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index b32cea7..07b58e3 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -153,7 +153,7 @@
}
void visitConstructorName(covariant ConstructorNameImpl node) {
- var type = node.type2.type;
+ var type = node.type.type;
if (type == null) {
return;
}
@@ -368,7 +368,7 @@
// TODO(brianwilkerson) Defer this check until we know there's an error (by
// in-lining _resolveArgumentsToFunction below).
var declaration = node.thisOrAncestorOfType<ClassDeclaration>();
- var superclassName = declaration?.extendsClause?.superclass2.name;
+ var superclassName = declaration?.extendsClause?.superclass.name;
if (superclassName != null &&
_resolver.definingLibrary
.shouldIgnoreUndefinedIdentifier(superclassName)) {
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 2eafede..83d50a2 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -432,7 +432,7 @@
_checkForBuiltInIdentifierAsName(
node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
_checkForConflictingClassTypeVariableErrorCodes();
- var superclass = node.extendsClause?.superclass2;
+ var superclass = node.extendsClause?.superclass;
var implementsClause = node.implementsClause;
var withClause = node.withClause;
@@ -471,7 +471,7 @@
try {
_enclosingClass = node.declaredElement as ClassElementImpl;
_checkClassInheritance(
- node, node.superclass2, node.withClause, node.implementsClause);
+ node, node.superclass, node.withClause, node.implementsClause);
_checkForMainFunction(node.name);
_checkForWrongTypeParameterVarianceInSuperinterfaces();
} finally {
@@ -844,7 +844,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
- node.interfaces2.forEach(_checkForImplicitDynamicType);
+ node.interfaces.forEach(_checkForImplicitDynamicType);
super.visitImplementsClause(node);
}
@@ -879,7 +879,7 @@
@override
void visitInstanceCreationExpression(InstanceCreationExpression node) {
ConstructorName constructorName = node.constructorName;
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
DartType type = namedType.typeOrThrow;
if (type is InterfaceType) {
_checkForConstOrNewWithAbstractClass(node, namedType, type);
@@ -1333,7 +1333,7 @@
@override
void visitWithClause(WithClause node) {
- node.mixinTypes2.forEach(_checkForImplicitDynamicType);
+ node.mixinTypes.forEach(_checkForImplicitDynamicType);
super.visitWithClause(node);
}
@@ -1353,7 +1353,7 @@
!_checkForNoGenerativeConstructorsInSuperclass(superclass)) {
_checkForImplicitDynamicType(superclass);
_checkForExtendsDeferredClass(superclass);
- _checkForRepeatedType(implementsClause?.interfaces2,
+ _checkForRepeatedType(implementsClause?.interfaces,
CompileTimeErrorCode.IMPLEMENTS_REPEATED);
_checkImplementsSuperClass(implementsClause);
_checkMixinsSuperClass(withClause);
@@ -1427,9 +1427,9 @@
bool problemReported = false;
int mixinTypeIndex = -1;
for (int mixinNameIndex = 0;
- mixinNameIndex < withClause.mixinTypes2.length;
+ mixinNameIndex < withClause.mixinTypes.length;
mixinNameIndex++) {
- NamedType mixinName = withClause.mixinTypes2[mixinNameIndex];
+ NamedType mixinName = withClause.mixinTypes[mixinNameIndex];
DartType mixinType = mixinName.typeOrThrow;
if (mixinType is InterfaceType) {
mixinTypeIndex++;
@@ -1479,7 +1479,7 @@
if (redirectedElement == null) {
// If the element is null, we check for the
// REDIRECT_TO_MISSING_CONSTRUCTOR case
- NamedType constructorNamedType = redirectedConstructor.type2;
+ NamedType constructorNamedType = redirectedConstructor.type;
DartType redirectedType = constructorNamedType.typeOrThrow;
if (redirectedType.element != null && !redirectedType.isDynamic) {
// Prepare the constructor name
@@ -1659,15 +1659,15 @@
}
if (extendsClause != null) {
- var superElement = extendsClause.superclass2.name.staticElement;
+ var superElement = extendsClause.superclass.name.staticElement;
if (superElement != null && superElement.name == "Function") {
errorReporter.reportErrorForNode(
- HintCode.DEPRECATED_EXTENDS_FUNCTION, extendsClause.superclass2);
+ HintCode.DEPRECATED_EXTENDS_FUNCTION, extendsClause.superclass);
}
}
if (implementsClause != null) {
- for (var interface in implementsClause.interfaces2) {
+ for (var interface in implementsClause.interfaces) {
var type = interface.type;
if (type != null && type.isDartCoreFunction) {
errorReporter.reportErrorForNode(
@@ -1680,7 +1680,7 @@
}
if (withClause != null) {
- for (NamedType type in withClause.mixinTypes2) {
+ for (NamedType type in withClause.mixinTypes) {
var mixinElement = type.name.staticElement;
if (mixinElement != null && mixinElement.name == "Function") {
errorReporter.reportErrorForNode(
@@ -2802,7 +2802,7 @@
return false;
}
bool foundError = false;
- for (NamedType type in clause.interfaces2) {
+ for (NamedType type in clause.interfaces) {
if (_checkForExtendsOrImplementsDisallowedClass(
type, CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS)) {
foundError = true;
@@ -3007,7 +3007,7 @@
} else {
errorReporter.reportErrorForNode(
CompileTimeErrorCode.INSTANTIATE_ENUM,
- node.type2,
+ node.type,
);
}
}
@@ -3506,7 +3506,7 @@
return false;
}
- for (NamedType mixinType in withClause.mixinTypes2) {
+ for (NamedType mixinType in withClause.mixinTypes) {
DartType type = mixinType.typeOrThrow;
if (type is InterfaceType) {
LibraryElement library = type.element.library;
@@ -3830,7 +3830,7 @@
return false;
}
bool problemReported = false;
- for (NamedType namedType in onClause.superclassConstraints2) {
+ for (NamedType namedType in onClause.superclassConstraints) {
DartType type = namedType.typeOrThrow;
if (type is InterfaceType) {
if (_checkForExtendsOrImplementsDisallowedClass(
@@ -4867,7 +4867,7 @@
return;
}
- for (var interfaceNode in implementsClause.interfaces2) {
+ for (var interfaceNode in implementsClause.interfaces) {
var type = interfaceNode.type;
if (type is InterfaceType && type.element == superElement) {
errorReporter.reportErrorForNode(
@@ -4889,11 +4889,11 @@
!_checkForImplementsClauseErrorCodes(implementsClause)) {
// _checkForImplicitDynamicType(superclass);
_checkForRepeatedType(
- onClause?.superclassConstraints2,
+ onClause?.superclassConstraints,
CompileTimeErrorCode.ON_REPEATED,
);
_checkForRepeatedType(
- implementsClause?.interfaces2,
+ implementsClause?.interfaces,
CompileTimeErrorCode.IMPLEMENTS_REPEATED,
);
_checkForConflictingGenerics(node);
@@ -4914,7 +4914,7 @@
return;
}
- for (var mixinNode in withClause.mixinTypes2) {
+ for (var mixinNode in withClause.mixinTypes) {
var type = mixinNode.type;
if (type is InterfaceType && type.element == superElement) {
errorReporter.reportErrorForNode(
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 3735ddd..34d16ab 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -78,7 +78,7 @@
// Only the Allocator, Opaque and Struct class may be extended.
var extendsClause = node.extendsClause;
if (extendsClause != null) {
- final NamedType superclass = extendsClause.superclass2;
+ final NamedType superclass = extendsClause.superclass;
final ffiClass = superclass.ffiClass;
if (ffiClass != null) {
final className = ffiClass.name;
@@ -133,14 +133,14 @@
var implementsClause = node.implementsClause;
if (implementsClause != null) {
- for (NamedType type in implementsClause.interfaces2) {
+ for (NamedType type in implementsClause.interfaces) {
checkSupertype(type, FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS,
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS);
}
}
var withClause = node.withClause;
if (withClause != null) {
- for (NamedType type in withClause.mixinTypes2) {
+ for (NamedType type in withClause.mixinTypes) {
checkSupertype(type, FfiCode.SUBTYPE_OF_FFI_CLASS_IN_WITH,
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH);
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 512107b..d07e3e9 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1455,7 +1455,7 @@
@override
void visitConstructorName(ConstructorName node) {
- node.type2.accept(this);
+ node.type.accept(this);
elementResolver.visitConstructorName(node as ConstructorNameImpl);
}
@@ -1572,7 +1572,7 @@
);
}
} else {
- var typeName = constructorName.type2.name;
+ var typeName = constructorName.type.name;
if (typeName.staticElement is EnumElementImpl) {
var nameNode = node.arguments?.constructorSelector?.name;
if (nameNode != null) {
@@ -3047,7 +3047,7 @@
node.documentationComment?.accept(this);
node.name.accept(this);
node.typeParameters?.accept(this);
- node.superclass2.accept(this);
+ node.superclass.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
}
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index b5c5db4..c9a8835 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -152,7 +152,7 @@
covariant InstanceCreationExpressionImpl node) {
_inferInstanceCreationExpression(node);
_inferenceHelper.recordStaticType(
- node, node.constructorName.type2.typeOrThrow);
+ node, node.constructorName.type.typeOrThrow);
}
/// <blockquote>
@@ -322,7 +322,7 @@
return;
}
- var typeName = constructorName.type2;
+ var typeName = constructorName.type;
var typeArguments = typeName.typeArguments;
var constructorType = elementToInfer.asType;
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
index e03af22..d9a70fa 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -166,7 +166,7 @@
// We need to inform the applier about the right shape of the AST.
// _sink.writeByte(node.name != null ? 1 : 0);
- _writeNode(node.type2);
+ _writeNode(node.type);
_writeOptionalNode(node.name);
_sink.writeElement(node.staticElement);
diff --git a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
index b30141a..1c36d87 100644
--- a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
@@ -167,7 +167,7 @@
node.name.accept(this);
node.typeParameters?.accept(this);
_token(node.equals);
- node.superclass2.accept(this);
+ node.superclass.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
_token(node.semicolon);
@@ -231,7 +231,7 @@
@override
void visitConstructorName(ConstructorName node) {
- node.type2.accept(this);
+ node.type.accept(this);
_token(node.period);
node.name?.accept(this);
}
@@ -338,7 +338,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
_token(node.extendsKeyword);
- node.superclass2.accept(this);
+ node.superclass.accept(this);
}
@override
@@ -572,7 +572,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
_token(node.implementsKeyword);
- _nodeList(node.interfaces2, node.endToken.next);
+ _nodeList(node.interfaces, node.endToken.next);
}
@override
@@ -740,7 +740,7 @@
@override
void visitOnClause(OnClause node) {
_token(node.onKeyword);
- _nodeList(node.superclassConstraints2, node.endToken.next);
+ _nodeList(node.superclassConstraints, node.endToken.next);
}
@override
@@ -1005,7 +1005,7 @@
@override
void visitWithClause(WithClause node) {
_token(node.withKeyword);
- _nodeList(node.mixinTypes2, node.endToken.next);
+ _nodeList(node.mixinTypes, node.endToken.next);
}
@override
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart
index e159199..a3d32ce 100644
--- a/pkg/analyzer/lib/src/summary2/element_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -150,7 +150,7 @@
}
});
- node.superclass2.accept(this);
+ node.superclass.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
}
@@ -387,7 +387,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- node.superclass2.accept(this);
+ node.superclass.accept(this);
}
@override
@@ -741,7 +741,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
- node.interfaces2.accept(this);
+ node.interfaces.accept(this);
}
@override
@@ -897,7 +897,7 @@
@override
void visitOnClause(OnClause node) {
- node.superclassConstraints2.accept(this);
+ node.superclassConstraints.accept(this);
}
@override
@@ -1094,7 +1094,7 @@
@override
void visitWithClause(WithClause node) {
- node.mixinTypes2.accept(this);
+ node.mixinTypes.accept(this);
}
List<ElementAnnotation> _buildAnnotations(List<Annotation> nodeList) {
diff --git a/pkg/analyzer/lib/src/summary2/informative_data.dart b/pkg/analyzer/lib/src/summary2/informative_data.dart
index 1d68050..4d66405 100644
--- a/pkg/analyzer/lib/src/summary2/informative_data.dart
+++ b/pkg/analyzer/lib/src/summary2/informative_data.dart
@@ -1740,7 +1740,7 @@
void _applyToEnumConstantInitializer(ConstFieldElementImpl element) {
var initializer = element.constantInitializer;
if (initializer is InstanceCreationExpression) {
- initializer.constructorName.type2.typeArguments?.accept(this);
+ initializer.constructorName.type.typeArguments?.accept(this);
for (var argument in initializer.argumentList.arguments) {
argument.accept(this);
}
@@ -1811,7 +1811,7 @@
@override
void visitConstructorName(ConstructorName node) {
- node.type2.accept(this);
+ node.type.accept(this);
_tokenOrNull(node.period);
node.name?.accept(this);
}
diff --git a/pkg/analyzer/lib/src/summary2/reference_resolver.dart b/pkg/analyzer/lib/src/summary2/reference_resolver.dart
index 57e276a..1cecbd4 100644
--- a/pkg/analyzer/lib/src/summary2/reference_resolver.dart
+++ b/pkg/analyzer/lib/src/summary2/reference_resolver.dart
@@ -80,7 +80,7 @@
LinkingNodeContext(node, scope);
node.typeParameters?.accept(this);
- node.superclass2.accept(this);
+ node.superclass.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
nodesToBuildType.addDeclaration(node);
@@ -139,7 +139,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- node.superclass2.accept(this);
+ node.superclass.accept(this);
}
@override
@@ -287,7 +287,7 @@
@override
void visitImplementsClause(ImplementsClause node) {
- node.interfaces2.accept(this);
+ node.interfaces.accept(this);
}
@override
@@ -384,7 +384,7 @@
@override
void visitOnClause(OnClause node) {
- node.superclassConstraints2.accept(this);
+ node.superclassConstraints.accept(this);
}
@override
@@ -442,7 +442,7 @@
@override
void visitWithClause(WithClause node) {
- node.mixinTypes2.accept(this);
+ node.mixinTypes.accept(this);
}
NullabilitySuffix _getNullabilitySuffix(bool hasQuestion) {
diff --git a/pkg/analyzer/lib/src/summary2/types_builder.dart b/pkg/analyzer/lib/src/summary2/types_builder.dart
index 03daeed..f69284f 100644
--- a/pkg/analyzer/lib/src/summary2/types_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/types_builder.dart
@@ -122,7 +122,7 @@
var extendsClause = node.extendsClause;
if (extendsClause != null) {
- var type = extendsClause.superclass2.type;
+ var type = extendsClause.superclass.type;
if (type is InterfaceType && _isInterfaceTypeClass(type)) {
element.supertype = type;
} else {
@@ -135,18 +135,18 @@
}
element.mixins = _toInterfaceTypeList(
- node.withClause?.mixinTypes2,
+ node.withClause?.mixinTypes,
);
element.interfaces = _toInterfaceTypeList(
- node.implementsClause?.interfaces2,
+ node.implementsClause?.interfaces,
);
}
void _classTypeAlias(ClassTypeAlias node) {
var element = node.declaredElement as ClassElementImpl;
- var superType = node.superclass2.type;
+ var superType = node.superclass.type;
if (superType is InterfaceType && _isInterfaceTypeInterface(superType)) {
element.supertype = superType;
} else {
@@ -154,11 +154,11 @@
}
element.mixins = _toInterfaceTypeList(
- node.withClause.mixinTypes2,
+ node.withClause.mixinTypes,
);
element.interfaces = _toInterfaceTypeList(
- node.implementsClause?.interfaces2,
+ node.implementsClause?.interfaces,
);
}
@@ -226,11 +226,11 @@
var element = node.declaredElement as EnumElementImpl;
element.mixins = _toInterfaceTypeList(
- node.withClause?.mixinTypes2,
+ node.withClause?.mixinTypes,
);
element.interfaces = _toInterfaceTypeList(
- node.implementsClause?.interfaces2,
+ node.implementsClause?.interfaces,
);
}
@@ -302,7 +302,7 @@
var element = node.declaredElement as MixinElementImpl;
var constraints = _toInterfaceTypeList(
- node.onClause?.superclassConstraints2,
+ node.onClause?.superclassConstraints,
);
if (constraints.isEmpty) {
constraints = [_objectType(element)];
@@ -310,7 +310,7 @@
element.superclassConstraints = constraints;
element.interfaces = _toInterfaceTypeList(
- node.implementsClause?.interfaces2,
+ node.implementsClause?.interfaces,
);
}
@@ -395,7 +395,7 @@
void perform(WithClause? withClause) {
if (withClause == null) return;
- for (var mixinNode in withClause.mixinTypes2) {
+ for (var mixinNode in withClause.mixinTypes) {
var mixinType = _inferSingle(mixinNode as NamedTypeImpl);
interfacesMerger.addWithSupertypes(mixinType);
}
@@ -546,7 +546,7 @@
} finally {
element.mixinInferenceCallback = null;
element.mixins = _toInterfaceTypeList(
- withClause.mixinTypes2,
+ withClause.mixinTypes,
);
}
}
diff --git a/pkg/analyzer/lib/src/test_utilities/find_node.dart b/pkg/analyzer/lib/src/test_utilities/find_node.dart
index b25d26f..d137ec9 100644
--- a/pkg/analyzer/lib/src/test_utilities/find_node.dart
+++ b/pkg/analyzer/lib/src/test_utilities/find_node.dart
@@ -127,6 +127,10 @@
return _node(search, (n) => n is ConstructorReference);
}
+ ConstructorSelector constructorSelector(String search) {
+ return _node(search, (n) => n is ConstructorSelector);
+ }
+
ContinueStatement continueStatement(String search) {
return _node(search, (n) => n is ContinueStatement);
}
diff --git a/pkg/analyzer/test/error/error_test.dart b/pkg/analyzer/test/error/error_test.dart
index 0cce128..afad0dc 100644
--- a/pkg/analyzer/test/error/error_test.dart
+++ b/pkg/analyzer/test/error/error_test.dart
@@ -37,7 +37,7 @@
if (declaration is ClassDeclaration) {
var extendsClause = declaration.extendsClause;
if (extendsClause != null &&
- extendsClause.superclass2.name.name == 'ErrorCode') {
+ extendsClause.superclass.name.name == 'ErrorCode') {
String className = declaration.name.name;
for (ClassMember member in declaration.members) {
if (member is FieldDeclaration && member.isStatic) {
diff --git a/pkg/analyzer/test/generated/class_member_parser_test.dart b/pkg/analyzer/test/generated/class_member_parser_test.dart
index 28b8faf..fe8509a 100644
--- a/pkg/analyzer/test/generated/class_member_parser_test.dart
+++ b/pkg/analyzer/test/generated/class_member_parser_test.dart
@@ -1137,7 +1137,7 @@
expect(constructor.separator!.type, TokenType.EQ);
expect(constructor.initializers, isEmpty);
expect(constructor.redirectedConstructor, isNotNull);
- expect(constructor.redirectedConstructor!.type2.name.name, 'prefix.B');
+ expect(constructor.redirectedConstructor!.type.name.name, 'prefix.B');
expect(constructor.redirectedConstructor!.period!.type, TokenType.PERIOD);
expect(constructor.redirectedConstructor!.name!.name, 'foo');
expect(constructor.body, isEmptyFunctionBody);
@@ -1187,7 +1187,7 @@
expect(constructor.separator!.type, TokenType.EQ);
expect(constructor.initializers, isEmpty);
expect(constructor.redirectedConstructor, isNotNull);
- expect(constructor.redirectedConstructor!.type2.name.name, 'B');
+ expect(constructor.redirectedConstructor!.type.name.name, 'B');
expect(constructor.redirectedConstructor!.period, isNull);
expect(constructor.redirectedConstructor!.name, isNull);
expect(constructor.body, isEmptyFunctionBody);
diff --git a/pkg/analyzer/test/generated/expression_parser_test.dart b/pkg/analyzer/test/generated/expression_parser_test.dart
index 356ecc9..ec3df10 100644
--- a/pkg/analyzer/test/generated/expression_parser_test.dart
+++ b/pkg/analyzer/test/generated/expression_parser_test.dart
@@ -671,7 +671,7 @@
expect(instanceCreation.keyword, isNotNull);
ConstructorName name = instanceCreation.constructorName;
expect(name, isNotNull);
- expect(name.type2, isNotNull);
+ expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
expect(instanceCreation.argumentList, isNotNull);
@@ -1044,7 +1044,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type.name.name, 'A.B');
expect(type.typeArguments, isNull);
expect(name.period, isNull);
@@ -1061,7 +1061,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNotNull);
@@ -1079,7 +1079,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNotNull);
@@ -1096,7 +1096,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNull);
@@ -1113,7 +1113,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNull);
@@ -1130,7 +1130,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNull);
@@ -1147,7 +1147,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNotNull);
@@ -1164,7 +1164,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNotNull);
@@ -1182,7 +1182,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type2;
+ NamedType type = name.type;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNull);
@@ -1427,7 +1427,7 @@
expect(expression.keyword, isNotNull);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- expect(name.type2, isNotNull);
+ expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
expect(expression.argumentList, isNotNull);
diff --git a/pkg/analyzer/test/generated/function_reference_parser_test.dart b/pkg/analyzer/test/generated/function_reference_parser_test.dart
index 2c0c918..07f8755 100644
--- a/pkg/analyzer/test/generated/function_reference_parser_test.dart
+++ b/pkg/analyzer/test/generated/function_reference_parser_test.dart
@@ -113,7 +113,7 @@
parseExpression('f<a, b>.toString()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var type = constructorName.type2;
+ var type = constructorName.type;
expect((type.name as SimpleIdentifier).name, 'f');
var typeArgs = type.typeArguments!.arguments;
expect(typeArgs, hasLength(2));
diff --git a/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart b/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
index bd35b65..a7e7d3d 100644
--- a/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
+++ b/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
@@ -51,10 +51,10 @@
// type. Resolution will change the type to `D` and the name to `new` if
// appropriate.
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as PrefixedIdentifier;
+ var typeName = constructorName.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'C');
expect(typeName.identifier.name, 'new');
- expect(constructorName.type2.typeArguments, isNull);
+ expect(constructorName.type.typeArguments, isNull);
expect(constructorName.name, isNull);
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -64,9 +64,9 @@
parseExpression('const C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as SimpleIdentifier;
+ var typeName = constructorName.type.name as SimpleIdentifier;
expect(typeName.name, 'C');
- expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -76,10 +76,10 @@
parseExpression('const prefix.C.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as PrefixedIdentifier;
+ var typeName = constructorName.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type2.typeArguments, isNull);
+ expect(constructorName.type.typeArguments, isNull);
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -89,10 +89,10 @@
'const prefix.C<int>.new()',
featureSet: constructorTearoffs) as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as PrefixedIdentifier;
+ var typeName = constructorName.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -105,10 +105,10 @@
// type. Resolution will change the type to `D` and the name to `new` if
// appropriate.
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as PrefixedIdentifier;
+ var typeName = constructorName.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'C');
expect(typeName.identifier.name, 'new');
- expect(constructorName.type2.typeArguments, isNull);
+ expect(constructorName.type.typeArguments, isNull);
expect(constructorName.name, isNull);
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -118,9 +118,9 @@
parseExpression('new C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as SimpleIdentifier;
+ var typeName = constructorName.type.name as SimpleIdentifier;
expect(typeName.name, 'C');
- expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -130,10 +130,10 @@
parseExpression('new prefix.C.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as PrefixedIdentifier;
+ var typeName = constructorName.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type2.typeArguments, isNull);
+ expect(constructorName.type.typeArguments, isNull);
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -142,10 +142,10 @@
var instanceCreationExpression = parseExpression('new prefix.C<int>.new()',
featureSet: constructorTearoffs) as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as PrefixedIdentifier;
+ var typeName = constructorName.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -166,9 +166,9 @@
parseExpression('C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as SimpleIdentifier;
+ var typeName = constructorName.type.name as SimpleIdentifier;
expect(typeName.name, 'C');
- expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -190,10 +190,10 @@
parseExpression('prefix.C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type2.name as PrefixedIdentifier;
+ var typeName = constructorName.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -357,10 +357,10 @@
// type. Resolution will change the type to `D` and the name to `new` if
// appropriate.
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type2.name as PrefixedIdentifier;
+ var typeName = redirectedConstructor.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'D');
expect(typeName.identifier.name, 'new');
- expect(redirectedConstructor.type2.typeArguments, isNull);
+ expect(redirectedConstructor.type.typeArguments, isNull);
expect(redirectedConstructor.name, isNull);
}
@@ -375,9 +375,9 @@
classDeclaration.members.single as ConstructorDeclaration;
expect(constructorDeclaration.initializers, isEmpty);
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type2.name as SimpleIdentifier;
+ var typeName = redirectedConstructor.type.name as SimpleIdentifier;
expect(typeName.name, 'D');
- expect(redirectedConstructor.type2.typeArguments!.arguments, hasLength(1));
+ expect(redirectedConstructor.type.typeArguments!.arguments, hasLength(1));
expect(redirectedConstructor.name!.name, 'new');
}
@@ -392,10 +392,10 @@
classDeclaration.members.single as ConstructorDeclaration;
expect(constructorDeclaration.initializers, isEmpty);
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type2.name as PrefixedIdentifier;
+ var typeName = redirectedConstructor.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'D');
- expect(redirectedConstructor.type2.typeArguments, isNull);
+ expect(redirectedConstructor.type.typeArguments, isNull);
expect(redirectedConstructor.name!.name, 'new');
}
@@ -410,10 +410,10 @@
classDeclaration.members.single as ConstructorDeclaration;
expect(constructorDeclaration.initializers, isEmpty);
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type2.name as PrefixedIdentifier;
+ var typeName = redirectedConstructor.type.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'D');
- expect(redirectedConstructor.type2.typeArguments!.arguments, hasLength(1));
+ expect(redirectedConstructor.type.typeArguments!.arguments, hasLength(1));
expect(redirectedConstructor.name!.name, 'new');
}
diff --git a/pkg/analyzer/test/generated/simple_parser_test.dart b/pkg/analyzer/test/generated/simple_parser_test.dart
index e183e2a..a2c57e7 100644
--- a/pkg/analyzer/test/generated/simple_parser_test.dart
+++ b/pkg/analyzer/test/generated/simple_parser_test.dart
@@ -1175,7 +1175,7 @@
ConstructorName name = parseConstructorName('A.n');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type2, isNotNull);
+ expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
@@ -1184,7 +1184,7 @@
ConstructorName name = parseConstructorName('p.A.n');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type2, isNotNull);
+ expect(name.type, isNotNull);
expect(name.period, isNotNull);
expect(name.name, isNotNull);
}
@@ -1193,7 +1193,7 @@
ConstructorName name = parseConstructorName('A');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type2, isNotNull);
+ expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
@@ -1202,7 +1202,7 @@
ConstructorName name = parseConstructorName('p.A');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type2, isNotNull);
+ expect(name.type, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
@@ -1250,8 +1250,8 @@
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.extendsKeyword, isNotNull);
- expect(clause.superclass2, isNotNull);
- expect(clause.superclass2, isNamedType);
+ expect(clause.superclass, isNotNull);
+ expect(clause.superclass, isNamedType);
}
void test_parseFunctionBody_block() {
@@ -1385,7 +1385,7 @@
ImplementsClause clause = parseImplementsClause('implements A, B, C');
expectNotNullIfNoErrors(clause);
assertNoErrors();
- expect(clause.interfaces2, hasLength(3));
+ expect(clause.interfaces, hasLength(3));
expect(clause.implementsKeyword, isNotNull);
}
@@ -1393,7 +1393,7 @@
ImplementsClause clause = parseImplementsClause('implements A');
expectNotNullIfNoErrors(clause);
assertNoErrors();
- expect(clause.interfaces2, hasLength(1));
+ expect(clause.interfaces, hasLength(1));
expect(clause.implementsKeyword, isNotNull);
}
@@ -1436,7 +1436,7 @@
var creation = body.expression as InstanceCreationExpressionImpl;
expect(creation.keyword, isNull);
ConstructorName constructorName = creation.constructorName;
- expect(constructorName.type2.toSource(), 'C<E>');
+ expect(constructorName.type.toSource(), 'C<E>');
expect(constructorName.period, isNotNull);
expect(constructorName.name, isNotNull);
expect(creation.argumentList, isNotNull);
@@ -1471,7 +1471,7 @@
var creation = body.expression as InstanceCreationExpression;
expect(creation.keyword, isNull);
ConstructorName constructorName = creation.constructorName;
- expect(constructorName.type2.toSource(), 'p.C<E>');
+ expect(constructorName.type.toSource(), 'p.C<E>');
expect(constructorName.period, isNotNull);
expect(constructorName.name, isNotNull);
expect(creation.argumentList, isNotNull);
@@ -2081,7 +2081,7 @@
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.withKeyword, isNotNull);
- expect(clause.mixinTypes2, hasLength(3));
+ expect(clause.mixinTypes, hasLength(3));
}
void test_parseWithClause_single() {
@@ -2089,7 +2089,7 @@
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.withKeyword, isNotNull);
- expect(clause.mixinTypes2, hasLength(1));
+ expect(clause.mixinTypes, hasLength(1));
}
void test_typeAlias_37733() {
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index cf141f5..cfbc48c 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -372,7 +372,7 @@
var exp = stmt.expression as InstanceCreationExpression;
ClassElement elementB = AstFinder.getClass(unit, "B").declaredElement!;
ClassElement elementA = AstFinder.getClass(unit, "A").declaredElement!;
- expect(exp.constructorName.type2.typeOrThrow.element, elementB);
+ expect(exp.constructorName.type.typeOrThrow.element, elementB);
_isInstantiationOf(_hasElement(elementB))([
_isType(elementA.typeParameters[0]
.instantiate(nullabilitySuffix: NullabilitySuffix.star))
@@ -2372,7 +2372,7 @@
var bConstructor = b.members[0] as ConstructorDeclaration;
var redirected = bConstructor.redirectedConstructor as ConstructorName;
- var typeName = redirected.type2;
+ var typeName = redirected.type;
assertType(typeName.type, 'A<T2, U2>');
assertType(typeName.type, 'A<T2, U2>');
@@ -2408,7 +2408,7 @@
var bConstructor = b.members[0] as ConstructorDeclaration;
var redirected = bConstructor.redirectedConstructor as ConstructorName;
- var typeName = redirected.type2;
+ var typeName = redirected.type;
assertType(typeName.type, 'A<T2, U2>');
assertType(typeName.type, 'A<T2, U2>');
diff --git a/pkg/analyzer/test/generated/top_level_parser_test.dart b/pkg/analyzer/test/generated/top_level_parser_test.dart
index bde8059..6962aff 100644
--- a/pkg/analyzer/test/generated/top_level_parser_test.dart
+++ b/pkg/analyzer/test/generated/top_level_parser_test.dart
@@ -398,7 +398,7 @@
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNotNull);
expect(typeAlias.implementsClause!.implementsKeyword, isNotNull);
- expect(typeAlias.implementsClause!.interfaces2.length, 1);
+ expect(typeAlias.implementsClause!.interfaces.length, 1);
expect(typeAlias.semicolon, isNotNull);
}
@@ -414,7 +414,7 @@
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.withClause.withKeyword, isNotNull);
- expect(typeAlias.withClause.mixinTypes2.length, 1);
+ expect(typeAlias.withClause.mixinTypes.length, 1);
expect(typeAlias.implementsClause, isNull);
expect(typeAlias.semicolon, isNotNull);
}
@@ -935,7 +935,7 @@
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNotNull);
- expect(typeAlias.superclass2.name.name, "S");
+ expect(typeAlias.superclass.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNull);
expect(typeAlias.semicolon, isNotNull);
@@ -953,7 +953,7 @@
expect(typeAlias.typeParameters!.typeParameters, hasLength(1));
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
- expect(typeAlias.superclass2.name.name, "S");
+ expect(typeAlias.superclass.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -971,7 +971,7 @@
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
- expect(typeAlias.superclass2.name.name, "S");
+ expect(typeAlias.superclass.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -989,7 +989,7 @@
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
- expect(typeAlias.superclass2.name.name, "S");
+ expect(typeAlias.superclass.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNull);
expect(typeAlias.semicolon, isNotNull);
@@ -1949,7 +1949,7 @@
expect(declaration.onClause, isNull);
var implementsClause = declaration.implementsClause!;
expect(implementsClause.implementsKeyword, isNotNull);
- NodeList<NamedType> interfaces = implementsClause.interfaces2;
+ NodeList<NamedType> interfaces = implementsClause.interfaces;
expect(interfaces, hasLength(1));
expect(interfaces[0].name.name, 'B');
expect(interfaces[0].typeArguments, isNull);
@@ -1971,7 +1971,7 @@
expect(declaration.onClause, isNull);
var implementsClause = declaration.implementsClause!;
expect(implementsClause.implementsKeyword, isNotNull);
- NodeList<NamedType> interfaces = implementsClause.interfaces2;
+ NodeList<NamedType> interfaces = implementsClause.interfaces;
expect(interfaces, hasLength(2));
expect(interfaces[0].name.name, 'B');
expect(interfaces[0].typeArguments!.arguments, hasLength(1));
@@ -2013,7 +2013,7 @@
expect(declaration.documentationComment, isNull);
var onClause = declaration.onClause!;
expect(onClause.onKeyword, isNotNull);
- NodeList<NamedType> constraints = onClause.superclassConstraints2;
+ NodeList<NamedType> constraints = onClause.superclassConstraints;
expect(constraints, hasLength(1));
expect(constraints[0].name.name, 'B');
expect(constraints[0].typeArguments, isNull);
@@ -2035,7 +2035,7 @@
expect(declaration.documentationComment, isNull);
var onClause = declaration.onClause!;
expect(onClause.onKeyword, isNotNull);
- NodeList<NamedType> constraints = onClause.superclassConstraints2;
+ NodeList<NamedType> constraints = onClause.superclassConstraints;
expect(constraints, hasLength(2));
expect(constraints[0].name.name, 'B');
expect(constraints[0].typeArguments, isNull);
@@ -2059,13 +2059,13 @@
expect(declaration.documentationComment, isNull);
var onClause = declaration.onClause!;
expect(onClause.onKeyword, isNotNull);
- NodeList<NamedType> constraints = onClause.superclassConstraints2;
+ NodeList<NamedType> constraints = onClause.superclassConstraints;
expect(constraints, hasLength(1));
expect(constraints[0].name.name, 'B');
expect(constraints[0].typeArguments, isNull);
var implementsClause = declaration.implementsClause!;
expect(implementsClause.implementsKeyword, isNotNull);
- NodeList<NamedType> interfaces = implementsClause.interfaces2;
+ NodeList<NamedType> interfaces = implementsClause.interfaces;
expect(interfaces, hasLength(1));
expect(interfaces[0].name.name, 'C');
expect(interfaces[0].typeArguments, isNull);
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index dfaa5e0..aa0c90b 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -457,7 +457,7 @@
source: findNode.classTypeAlias('B<U>'),
childAccessors: [
(node) => node.documentationComment!,
- (node) => node.superclass2,
+ (node) => node.superclass,
(node) => node.implementsClause!,
(node) => node.name,
(node) => node.typeParameters!,
@@ -604,7 +604,7 @@
destination: findNode.constructorName('A.foo'),
source: findNode.constructorName('B.bar'),
childAccessors: [
- (node) => node.type2,
+ (node) => node.type,
(node) => node.name!,
],
);
@@ -797,7 +797,7 @@
destination: findNode.extendsClause('A0'),
source: findNode.extendsClause('B0'),
childAccessors: [
- (node) => node.superclass2,
+ (node) => node.superclass,
],
);
}
@@ -1122,8 +1122,8 @@
var node = findNode.implementsClause('implements');
_assertReplaceInList(
destination: node,
- child: node.interfaces2[0],
- replacement: node.interfaces2[1],
+ child: node.interfaces[0],
+ replacement: node.interfaces[1],
);
}
@@ -1950,8 +1950,8 @@
var node = findNode.withClause('with');
_assertReplaceInList(
destination: node,
- child: node.mixinTypes2[0],
- replacement: node.mixinTypes2[1],
+ child: node.mixinTypes[0],
+ replacement: node.mixinTypes[1],
);
}
diff --git a/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart b/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
index 7401b6c..2ba48a6 100644
--- a/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
+++ b/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
@@ -55,9 +55,9 @@
TypeArgumentList? typeArguments;
List<DartType> typeArgumentTypes;
if (node is InstanceCreationExpression) {
- typeArguments = node.constructorName.type2.typeArguments;
+ typeArguments = node.constructorName.type.typeArguments;
typeArgumentTypes =
- (node.constructorName.type2.type as InterfaceType).typeArguments;
+ (node.constructorName.type.type as InterfaceType).typeArguments;
} else if (node is InvocationExpression) {
typeArguments = node.typeArguments;
typeArgumentTypes = node.typeArgumentTypes!;
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index 620abd3..0bcce79 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -670,7 +670,7 @@
var constructorName = constC.constructorName;
expect(constructorName.staticElement, constructorC);
- expect(constructorName.type2.type, interfaceTypeNone(elementC));
+ expect(constructorName.type.type, interfaceTypeNone(elementC));
}
test_annotation_unprefixed_topLevelVariable() async {
@@ -1309,7 +1309,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(aUnnamed));
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, interfaceTypeNone(aElement));
var identifier = namedType.name as SimpleIdentifier;
@@ -1329,7 +1329,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(aNamed));
- var namedType = constructorName.type2;
+ var namedType = constructorName.type;
expect(namedType.type, interfaceTypeNone(aElement));
var identifier = namedType.name as SimpleIdentifier;
@@ -1378,7 +1378,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(actualMember));
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, auType);
var identifier = namedType.name as SimpleIdentifier;
@@ -1400,7 +1400,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(actualMember));
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, auType);
var identifier = namedType.name as SimpleIdentifier;
@@ -2049,7 +2049,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
Identifier typeIdentifier = namedType.name;
@@ -2067,7 +2067,7 @@
expect(constructorName.staticElement, namedConstructor);
expect(constructorName.name!.staticType, isNull);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2102,7 +2102,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, constructorElement);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
Identifier typeIdentifier = namedType.name;
@@ -2143,7 +2143,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
Identifier typeIdentifier = namedType.name;
@@ -2165,7 +2165,7 @@
expect(constructorName.name!.staticElement, namedConstructor);
expect(constructorName.name!.staticType, isNull);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2217,7 +2217,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as PrefixedIdentifier;
@@ -2247,7 +2247,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as PrefixedIdentifier;
@@ -2277,7 +2277,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments!.arguments, hasLength(1));
_assertNamedTypeSimple(
namedType.typeArguments!.arguments[0], typeProvider.boolType);
@@ -2332,7 +2332,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2354,7 +2354,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments!.arguments, hasLength(1));
_assertNamedTypeSimple(
namedType.typeArguments!.arguments[0], typeProvider.boolType);
@@ -2379,7 +2379,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2402,7 +2402,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.typeArguments!.arguments, hasLength(1));
_assertNamedTypeSimple(
namedType.typeArguments!.arguments[0], typeProvider.boolType);
@@ -2434,7 +2434,7 @@
assertMember(creation, defaultConstructor, {'K': 'int', 'V': 'double'});
assertType(creation, 'C<int, double>');
- var namedType = creation.constructorName.type2;
+ var namedType = creation.constructorName.type;
assertNamedType(namedType, cElement, 'C<int, double>');
var typeArguments = namedType.typeArguments!.arguments;
@@ -2453,7 +2453,7 @@
assertMember(creation, namedConstructor, {'K': 'num', 'V': 'String'});
assertType(creation, 'C<num, String>');
- var namedType = creation.constructorName.type2;
+ var namedType = creation.constructorName.type;
assertNamedType(namedType, cElement, 'C<num, String>');
var typeArguments = namedType.typeArguments!.arguments;
@@ -3049,7 +3049,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType type = constructorName.type2;
+ NamedType type = constructorName.type;
expect(type.typeArguments, isNull);
assertElement(type.name, c);
assertTypeNull(type.name);
@@ -3066,7 +3066,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name!.name, 'named');
- NamedType type = constructorName.type2;
+ NamedType type = constructorName.type;
expect(type.typeArguments, isNull);
assertElement(type.name, c);
assertType(type.name, 'C<bool>');
@@ -3083,7 +3083,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name!.name, 'named2');
- NamedType type = constructorName.type2;
+ NamedType type = constructorName.type;
assertTypeArguments(type.typeArguments!, [doubleType]);
assertElement(type.name, c);
assertType(type.name, 'C<double>');
@@ -5594,7 +5594,7 @@
assertElement(creation, c.unnamedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type2, c, 'C');
+ assertNamedType(creation.constructorName.type, c, 'C');
}
{
@@ -5603,7 +5603,7 @@
assertElement(creation, namedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type2, c, 'C');
+ assertNamedType(creation.constructorName.type, c, 'C');
assertElement(creation.constructorName.name, namedConstructor);
}
}
@@ -5630,7 +5630,7 @@
assertElement(creation, c.unnamedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type2, c, 'C',
+ assertNamedType(creation.constructorName.type, c, 'C',
expectedPrefix: import.prefix);
}
@@ -5640,7 +5640,7 @@
assertElement(creation, namedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type2, c, 'C',
+ assertNamedType(creation.constructorName.type, c, 'C',
expectedPrefix: import.prefix);
assertElement(creation.constructorName.name, namedConstructor);
}
@@ -5664,7 +5664,7 @@
assertMember(creation, c.unnamedConstructor!, {'T': 'int'});
assertType(creation, 'C<int>');
- assertNamedType(creation.constructorName.type2, c, 'C<int>');
+ assertNamedType(creation.constructorName.type, c, 'C<int>');
assertNamedType(findNode.namedType('int>'), intElement, 'int');
}
@@ -5674,7 +5674,7 @@
assertMember(creation, namedConstructor, {'T': 'String'});
assertType(creation, 'C<String>');
- assertNamedType(creation.constructorName.type2, c, 'C<String>');
+ assertNamedType(creation.constructorName.type, c, 'C<String>');
assertNamedType(findNode.namedType('String>'), stringElement, 'String');
assertMember(
@@ -6831,7 +6831,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType superClass = dNode.extendsClause!.superclass2;
+ NamedType superClass = dNode.extendsClause!.superclass;
expect(superClass.type, expectedType);
var identifier = superClass.name as SimpleIdentifier;
@@ -6845,7 +6845,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType mixinType = dNode.withClause!.mixinTypes2[0];
+ NamedType mixinType = dNode.withClause!.mixinTypes[0];
expect(mixinType.type, expectedType);
var identifier = mixinType.name as SimpleIdentifier;
@@ -6859,7 +6859,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType implementedType = dNode.implementsClause!.interfaces2[0];
+ NamedType implementedType = dNode.implementsClause!.interfaces[0];
expect(implementedType.type, expectedType);
var identifier = implementedType.name as SimpleIdentifier;
@@ -6900,7 +6900,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType superClass = dNode.superclass2;
+ NamedType superClass = dNode.superclass;
expect(superClass.type, expectedType);
var identifier = superClass.name as SimpleIdentifier;
@@ -6914,7 +6914,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType mixinType = dNode.withClause.mixinTypes2[0];
+ NamedType mixinType = dNode.withClause.mixinTypes[0];
expect(mixinType.type, expectedType);
var identifier = mixinType.name as SimpleIdentifier;
@@ -6928,7 +6928,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType interfaceType = dNode.implementsClause!.interfaces2[0];
+ NamedType interfaceType = dNode.implementsClause!.interfaces[0];
expect(interfaceType.type, expectedType);
var identifier = interfaceType.name as SimpleIdentifier;
@@ -7833,7 +7833,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, isDynamicType);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -7865,7 +7865,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -7909,7 +7909,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -7947,7 +7947,7 @@
ConstructorName constructorName = creation.constructorName;
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -7993,7 +7993,7 @@
ConstructorName constructorName = creation.constructorName;
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -8040,7 +8040,7 @@
ConstructorName constructorName = creation.constructorName;
- NamedType namedType = constructorName.type2;
+ NamedType namedType = constructorName.type;
assertType(namedType, 'Random');
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -8485,7 +8485,7 @@
var constructorElement = classElement.unnamedConstructor;
expect(constructorName.staticElement, constructorElement);
- var namedType = constructorName.type2;
+ var namedType = constructorName.type;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
diff --git a/pkg/analyzer/test/src/dart/ast/element_locator_test.dart b/pkg/analyzer/test/src/dart/ast/element_locator_test.dart
index c594940..4bd8ed4 100644
--- a/pkg/analyzer/test/src/dart/ast/element_locator_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/element_locator_test.dart
@@ -63,6 +63,18 @@
expect(element, isConstructorElement);
}
+ test_locate_ConstructorSelector_EnumConstantArguments_EnumConstantDeclaration() async {
+ await resolveTestCode(r'''
+enum E {
+ v.named(); // 0
+ const E.named();
+}
+''');
+ var node = findNode.constructorSelector('named(); // 0');
+ var element = ElementLocator.locate(node);
+ expect(element, findElement.constructor('named'));
+ }
+
test_locate_ExportDirective() async {
await resolveTestCode("export 'dart:code';");
var node = findNode.export('export');
diff --git a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
index 1adb108..50d0ec5 100644
--- a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
@@ -455,7 +455,7 @@
expectedSubstitution: {'T': 'int'},
);
_assertTypeArgumentList(
- creation.constructorName.type2.typeArguments,
+ creation.constructorName.type.typeArguments,
['int'],
);
expect((creation as InstanceCreationExpressionImpl).typeArguments, isNull);
@@ -493,7 +493,7 @@
expectedSubstitution: {'T': 'int'},
);
_assertTypeArgumentList(
- creation.constructorName.type2.typeArguments,
+ creation.constructorName.type.typeArguments,
['int'],
);
expect((creation as InstanceCreationExpressionImpl).typeArguments, isNull);
diff --git a/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart b/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart
index 93e9187..daa949c 100644
--- a/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart
@@ -132,7 +132,7 @@
var constructorName = creation.constructorName;
- var typeName = constructorName.type2;
+ var typeName = constructorName.type;
assertType(typeName, 'C<int>');
var pC = typeName.name as PrefixedIdentifier;
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index a32c4bb..2e26247 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -180,7 +180,7 @@
assertElement(node, expectedConstructorElement);
assertType(node, expectedType);
- var namedType = node.constructorName.type2;
+ var namedType = node.constructorName.type;
expectedTypeNameElement ??= expectedClassElement;
assertNamedType(
namedType, expectedTypeNameElement,
@@ -499,7 +499,7 @@
assertType(creation, expectedType);
- var namedType = creation.constructorName.type2;
+ var namedType = creation.constructorName.type;
expectedTypeNameElement ??= expectedClassElement;
assertNamedType(namedType, expectedTypeNameElement, expectedType,
expectedPrefix: expectedPrefix);
diff --git a/pkg/analyzer/test/src/diagnostics/mixin_instantiate_test.dart b/pkg/analyzer/test/src/diagnostics/mixin_instantiate_test.dart
index ff289367..8dd5c55 100644
--- a/pkg/analyzer/test/src/diagnostics/mixin_instantiate_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/mixin_instantiate_test.dart
@@ -48,7 +48,7 @@
var creation = findNode.instanceCreation('M.named();');
var m = findElement.mixin('M');
- assertElement(creation.constructorName.type2.name, m);
+ assertElement(creation.constructorName.type.name, m);
}
test_unnamedConstructor() async {
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index e7a44e0..dfdbf61 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -356,7 +356,7 @@
properties.addNode('name', node.name);
properties.addToken('period', node.period);
properties.addElement('staticElement', node.staticElement);
- properties.addNode('type', node.type2);
+ properties.addNode('type', node.type);
_writeProperties(properties);
});
}
@@ -517,7 +517,7 @@
_writeln('ExtendsClause');
_withIndent(() {
var properties = _Properties();
- properties.addNode('superclass', node.superclass2);
+ properties.addNode('superclass', node.superclass);
_addAstNode(properties, node);
_writeProperties(properties);
});
@@ -809,7 +809,7 @@
_withIndent(() {
var properties = _Properties();
properties.addToken('implementsKeyword', node.implementsKeyword);
- properties.addNodeList('interfaces', node.interfaces2);
+ properties.addNodeList('interfaces', node.interfaces);
_addAstNode(properties, node);
_writeProperties(properties);
});
@@ -1072,7 +1072,7 @@
var properties = _Properties();
properties.addToken('onKeyword', node.onKeyword);
properties.addNodeList(
- 'superclassConstraints', node.superclassConstraints2);
+ 'superclassConstraints', node.superclassConstraints);
_addAstNode(properties, node);
_writeProperties(properties);
});
@@ -1545,7 +1545,7 @@
_withIndent(() {
var properties = _Properties();
properties.addToken('withKeyword', node.withKeyword);
- properties.addNodeList('mixinTypes', node.mixinTypes2);
+ properties.addNodeList('mixinTypes', node.mixinTypes);
_addAstNode(properties, node);
_writeProperties(properties);
});
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
index 24a549e..cee17a3 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
@@ -960,7 +960,7 @@
name = expression.methodName.name;
} else if (expression is InstanceCreationExpression) {
var constructorName = expression.constructorName;
- var typeName = constructorName.type2;
+ var typeName = constructorName.type;
var typeNameIdentifier = typeName.name;
// new ClassName()
if (typeNameIdentifier is SimpleIdentifier) {
diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
index 74aee3b..e567a2c 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
@@ -178,7 +178,7 @@
if (name != null) {
constructor = name.staticElement;
} else {
- var classElem = parent.constructorName.type2.name.staticElement;
+ var classElem = parent.constructorName.type.name.staticElement;
if (classElem is ClassElement) {
constructor = classElem.unnamedConstructor;
}
@@ -367,7 +367,7 @@
@override
void visitClassTypeAlias(ClassTypeAlias node) {
- if (identical(entity, node.superclass2)) {
+ if (identical(entity, node.superclass)) {
optype.completionLocation = 'ClassTypeAlias_superclass';
optype.includeTypeNameSuggestions = true;
}
@@ -579,7 +579,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- if (identical(entity, node.superclass2)) {
+ if (identical(entity, node.superclass)) {
optype.completionLocation = 'ExtendsClause_superclass';
optype.includeTypeNameSuggestions = true;
}
@@ -1354,7 +1354,7 @@
@override
void visitWithClause(WithClause node) {
- if (node.mixinTypes2.contains(entity)) {
+ if (node.mixinTypes.contains(entity)) {
optype.completionLocation = 'WithClause_mixinType';
}
optype.includeTypeNameSuggestions = true;
diff --git a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
index 76f048a..2bd48bc 100644
--- a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
+++ b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
@@ -354,7 +354,7 @@
return;
}
// add regions
- var typeName = node.type2;
+ var typeName = node.type;
// [prefix].ClassName
{
var name = typeName.name;
diff --git a/pkg/dart2wasm/OWNERS b/pkg/dart2wasm/OWNERS
new file mode 100644
index 0000000..2e908ab
--- /dev/null
+++ b/pkg/dart2wasm/OWNERS
@@ -0,0 +1 @@
+file:/tools/OWNERS_WASM
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 7b40a7c..0f930faf 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -622,25 +622,58 @@
// Moreover, it checks that `FutureOr` and `void` are not among the
// supertypes and that `Enum` is not implemented by non-abstract classes.
- if (!cls.isAbstract && !cls.isEnum) {
- bool isEnumFound = false;
+ if (library.enableEnhancedEnumsInLibrary) {
+ bool hasEnumSuperinterface = false;
List<Supertype> interfaces =
hierarchyBuilder.getNodeFromClass(cls).superclasses;
- for (int i = 0; !isEnumFound && i < interfaces.length; i++) {
+ for (int i = 0; !hasEnumSuperinterface && i < interfaces.length; i++) {
if (interfaces[i].classNode == enumClass) {
- isEnumFound = true;
+ hasEnumSuperinterface = true;
}
}
interfaces = hierarchyBuilder.getNodeFromClass(cls).interfaces;
- for (int i = 0; !isEnumFound && i < interfaces.length; i++) {
+ for (int i = 0; !hasEnumSuperinterface && i < interfaces.length; i++) {
if (interfaces[i].classNode == enumClass) {
- isEnumFound = true;
+ hasEnumSuperinterface = true;
}
}
- if (isEnumFound) {
+ if (!cls.isAbstract && !cls.isEnum && hasEnumSuperinterface) {
addProblem(templateEnumSupertypeOfNonAbstractClass.withArguments(name),
charOffset, noLength);
}
+
+ if (hasEnumSuperinterface) {
+ Builder? customValuesDeclaration =
+ scope.lookupLocalMember("values", setter: false);
+ if (customValuesDeclaration != null &&
+ !customValuesDeclaration.isStatic) {
+ // Retrieve the earliest declaration for error reporting.
+ while (customValuesDeclaration?.next != null) {
+ customValuesDeclaration = customValuesDeclaration?.next;
+ }
+ library.addProblem(
+ templateEnumImplementerContainsValuesDeclaration
+ .withArguments(this.name),
+ customValuesDeclaration!.charOffset,
+ customValuesDeclaration.fullNameForErrors.length,
+ fileUri);
+ }
+ customValuesDeclaration =
+ scope.lookupLocalMember("values", setter: true);
+ if (customValuesDeclaration != null &&
+ !customValuesDeclaration.isStatic) {
+ // Retrieve the earliest declaration for error reporting.
+ while (customValuesDeclaration?.next != null) {
+ customValuesDeclaration = customValuesDeclaration?.next;
+ }
+ library.addProblem(
+ templateEnumImplementerContainsValuesDeclaration
+ .withArguments(this.name),
+ customValuesDeclaration!.charOffset,
+ customValuesDeclaration.fullNameForErrors.length,
+ fileUri);
+ }
+ }
}
void fail(NamedTypeBuilder target, Message message,
@@ -1387,6 +1420,22 @@
return noSuchMethod != null && noSuchMethod.enclosingClass != objectClass;
}
+ List<Member> _getStaticMembers() {
+ List<Member> staticMembers = <Member>[];
+ for (Field field in cls.fields) {
+ if (field.isStatic) {
+ staticMembers.add(field);
+ }
+ }
+ for (Procedure procedure in cls.procedures) {
+ if (procedure.isStatic) {
+ staticMembers.add(procedure);
+ }
+ }
+ staticMembers.sort(ClassHierarchy.compareMembers);
+ return staticMembers;
+ }
+
bool _addMissingNoSuchMethodForwarders(
KernelTarget target, Set<Member> existingForwarders,
{required bool forSetters}) {
@@ -1401,6 +1450,7 @@
hierarchy.getDispatchTargets(cls, setters: forSetters);
List<Member> declaredMembers =
hierarchy.getDeclaredMembers(cls, setters: forSetters);
+ List<Member> staticMembers = _getStaticMembers();
Procedure noSuchMethod = ClassHierarchy.findMemberByName(
hierarchy.getInterfaceMembers(cls), noSuchMethodName) as Procedure;
@@ -1426,8 +1476,8 @@
forSetter: forSetters);
Member? member = combinedMemberSignature.canonicalMember;
if (member != null) {
- if (_isForwarderRequired(
- clsHasUserDefinedNoSuchMethod, member, cls, concreteMembers,
+ if (_isForwarderRequired(clsHasUserDefinedNoSuchMethod, member, cls,
+ concreteMembers, staticMembers,
isPatch: member.fileUri != member.enclosingClass!.fileUri) &&
!existingForwarders.contains(member)) {
assert(!combinedMemberSignature.needsCovarianceMerging,
@@ -1478,12 +1528,13 @@
bool superHasUserDefinedNoSuchMethod = _hasUserDefinedNoSuchMethod(
nearestConcreteSuperclass, hierarchy, target.objectClass);
{
- List<Member> concrete =
+ List<Member> concreteMembers =
hierarchy.getDispatchTargets(nearestConcreteSuperclass);
+ List<Member> staticMembers = _getStaticMembers();
for (Member member
in hierarchy.getInterfaceMembers(nearestConcreteSuperclass)) {
if (_isForwarderRequired(superHasUserDefinedNoSuchMethod, member,
- nearestConcreteSuperclass, concrete,
+ nearestConcreteSuperclass, concreteMembers, staticMembers,
isPatch: member.fileUri != member.enclosingClass!.fileUri)) {
existingForwarders.add(member);
}
@@ -1493,10 +1544,11 @@
{
List<Member> concreteSetters = hierarchy
.getDispatchTargets(nearestConcreteSuperclass, setters: true);
+ List<Member> staticSetters = _getStaticMembers();
for (Member member in hierarchy
.getInterfaceMembers(nearestConcreteSuperclass, setters: true)) {
if (_isForwarderRequired(superHasUserDefinedNoSuchMethod, member,
- nearestConcreteSuperclass, concreteSetters)) {
+ nearestConcreteSuperclass, concreteSetters, staticSetters)) {
existingSetterForwarders.add(member);
}
}
@@ -1522,7 +1574,7 @@
/// Tells if a noSuchMethod forwarder is required for [member] in [cls].
bool _isForwarderRequired(bool hasUserDefinedNoSuchMethod, Member member,
- Class cls, List<Member> concreteMembers,
+ Class cls, List<Member> concreteMembers, List<Member> staticMembers,
{bool isPatch = false}) {
// A noSuchMethod forwarder is allowed for an abstract member if the class
// has a user-defined noSuchMethod or if the member is private and is
@@ -1536,7 +1588,8 @@
// A noSuchMethod forwarder is required if it's allowed and if there's no
// concrete implementation or a forwarder already.
bool isForwarderRequired = isForwarderAllowed &&
- ClassHierarchy.findMemberByName(concreteMembers, member.name) == null;
+ ClassHierarchy.findMemberByName(concreteMembers, member.name) == null &&
+ ClassHierarchy.findMemberByName(staticMembers, member.name) == null;
return isForwarderRequired;
}
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 644d13b..0e1957f 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -5,8 +5,6 @@
# Note that test/spelling: Status will have no effect. Spelling errors can
# always be fixed by either spelling correctly or updating the dictionary.
-EnumContainsValuesDeclaration/analyzerCode: Fail
-EnumContainsValuesDeclaration/example: Fail
AbstractClassConstructorTearOff/analyzerCode: Fail
AbstractClassInstantiation/example: Fail
AbstractExtensionField/analyzerCode: Fail
@@ -219,6 +217,8 @@
EnumConstructorSuperInitializer/example: Fail
EnumConstructorTearoff/analyzerCode: Fail
EnumConstructorTearoff/example: Fail
+EnumContainsValuesDeclaration/analyzerCode: Fail
+EnumContainsValuesDeclaration/example: Fail
EnumDeclaresConstFactory/analyzerCode: Fail
EnumDeclaresConstFactory/example: Fail
EnumDeclaresFactory/analyzerCode: Fail
@@ -227,6 +227,8 @@
EnumEntryWithTypeArgumentsWithoutArguments/example: Fail
EnumFactoryRedirectsToConstructor/analyzerCode: Fail
EnumFactoryRedirectsToConstructor/example: Fail
+EnumImplementerContainsValuesDeclaration/analyzerCode: Fail
+EnumImplementerContainsValuesDeclaration/example: Fail
EnumInstantiation/example: Fail
EnumNonConstConstructor/analyzerCode: Fail
EnumNonConstConstructor/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 8607ae0..043a64d 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -5476,3 +5476,6 @@
EnumContainsValuesDeclaration:
problemMessage: "Enums can't contain declarations of members with the name 'values'."
+
+EnumImplementerContainsValuesDeclaration:
+ problemMessage: "'#name' has 'Enum' as a superinterface and can't contain non-static member with name 'values'."
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart b/pkg/front_end/testcases/enhanced_enums/issue48388.dart
new file mode 100644
index 0000000..eda8388
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2022, 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.
+
+mixin M1 on Enum {
+ final int values = 42; // Error.
+}
+
+mixin M2 on Enum {
+ static final int values = 42; // Ok.
+}
+
+mixin M3 on Enum {
+ void set values(String x) {} // Error.
+}
+
+mixin M4 on Enum {
+ static void set values(String x) {} // Ok.
+}
+
+mixin M5 on Enum {
+ num get values => 0; // Error.
+ void set values(num x) {} // Error.
+}
+
+abstract class E1 extends Enum {
+ int values() => 42; // Error.
+}
+
+abstract class E2 extends Enum {
+ static int values() => 42; // Ok.
+}
+
+abstract class E3 extends Enum {
+ void set values(num x) {} // Error.
+}
+
+abstract class E4 extends Enum {
+ static void set values(num x) {} // Ok.
+}
+
+abstract class E5 extends Enum {
+ num get values => 0; // Error.
+ void set values(num x) {} // Error.
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.strong.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.strong.expect
new file mode 100644
index 0000000..5326e00
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.strong.expect
@@ -0,0 +1,91 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:6:13: Error: 'M1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// final int values = 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:14:12: Error: 'M3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(String x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:22:11: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:23:12: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:27:7: Error: 'E1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// int values() => 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:35:12: Error: 'E3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:43:11: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:44:12: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M1 extends core::Enum /*isMixinDeclaration*/ {
+ final field core::int values = 42;
+}
+abstract class M2 extends core::Enum /*isMixinDeclaration*/ {
+ static final field core::int values = 42;
+}
+abstract class M3 extends core::Enum /*isMixinDeclaration*/ {
+ set values(core::String x) → void {}
+}
+abstract class M4 extends core::Enum /*isMixinDeclaration*/ {
+ static set values(core::String x) → void {}
+}
+abstract class M5 extends core::Enum /*isMixinDeclaration*/ {
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+abstract class E1 extends core::Enum {
+ synthetic constructor •() → self::E1
+ : super core::Enum::•()
+ ;
+ method values() → core::int
+ return 42;
+}
+abstract class E2 extends core::Enum {
+ synthetic constructor •() → self::E2
+ : super core::Enum::•()
+ ;
+ static method values() → core::int
+ return 42;
+}
+abstract class E3 extends core::Enum {
+ synthetic constructor •() → self::E3
+ : super core::Enum::•()
+ ;
+ set values(core::num x) → void {}
+}
+abstract class E4 extends core::Enum {
+ synthetic constructor •() → self::E4
+ : super core::Enum::•()
+ ;
+ static set values(core::num x) → void {}
+}
+abstract class E5 extends core::Enum {
+ synthetic constructor •() → self::E5
+ : super core::Enum::•()
+ ;
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.strong.transformed.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.strong.transformed.expect
new file mode 100644
index 0000000..5326e00
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.strong.transformed.expect
@@ -0,0 +1,91 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:6:13: Error: 'M1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// final int values = 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:14:12: Error: 'M3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(String x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:22:11: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:23:12: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:27:7: Error: 'E1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// int values() => 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:35:12: Error: 'E3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:43:11: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:44:12: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M1 extends core::Enum /*isMixinDeclaration*/ {
+ final field core::int values = 42;
+}
+abstract class M2 extends core::Enum /*isMixinDeclaration*/ {
+ static final field core::int values = 42;
+}
+abstract class M3 extends core::Enum /*isMixinDeclaration*/ {
+ set values(core::String x) → void {}
+}
+abstract class M4 extends core::Enum /*isMixinDeclaration*/ {
+ static set values(core::String x) → void {}
+}
+abstract class M5 extends core::Enum /*isMixinDeclaration*/ {
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+abstract class E1 extends core::Enum {
+ synthetic constructor •() → self::E1
+ : super core::Enum::•()
+ ;
+ method values() → core::int
+ return 42;
+}
+abstract class E2 extends core::Enum {
+ synthetic constructor •() → self::E2
+ : super core::Enum::•()
+ ;
+ static method values() → core::int
+ return 42;
+}
+abstract class E3 extends core::Enum {
+ synthetic constructor •() → self::E3
+ : super core::Enum::•()
+ ;
+ set values(core::num x) → void {}
+}
+abstract class E4 extends core::Enum {
+ synthetic constructor •() → self::E4
+ : super core::Enum::•()
+ ;
+ static set values(core::num x) → void {}
+}
+abstract class E5 extends core::Enum {
+ synthetic constructor •() → self::E5
+ : super core::Enum::•()
+ ;
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.textual_outline.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.textual_outline.expect
new file mode 100644
index 0000000..a098e65
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.textual_outline.expect
@@ -0,0 +1,39 @@
+mixin M1 on Enum {
+ final int values = 42;
+}
+mixin M2 on Enum {
+ static final int values = 42;
+}
+mixin M3 on Enum {
+ void set values(String x) {}
+}
+mixin M4 on Enum {
+ static void set values(String x) {}
+}
+mixin M5 on Enum {
+ num get values => 0;
+ void set values(num x) {}
+}
+
+abstract class E1 extends Enum {
+ int values() => 42;
+}
+
+abstract class E2 extends Enum {
+ static int values() => 42;
+}
+
+abstract class E3 extends Enum {
+ void set values(num x) {}
+}
+
+abstract class E4 extends Enum {
+ static void set values(num x) {}
+}
+
+abstract class E5 extends Enum {
+ num get values => 0;
+ void set values(num x) {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..ab86f28
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.textual_outline_modelled.expect
@@ -0,0 +1,38 @@
+abstract class E1 extends Enum {
+ int values() => 42;
+}
+
+abstract class E2 extends Enum {
+ static int values() => 42;
+}
+
+abstract class E3 extends Enum {
+ void set values(num x) {}
+}
+
+abstract class E4 extends Enum {
+ static void set values(num x) {}
+}
+
+abstract class E5 extends Enum {
+ num get values => 0;
+ void set values(num x) {}
+}
+
+main() {}
+mixin M1 on Enum {
+ final int values = 42;
+}
+mixin M2 on Enum {
+ static final int values = 42;
+}
+mixin M3 on Enum {
+ void set values(String x) {}
+}
+mixin M4 on Enum {
+ static void set values(String x) {}
+}
+mixin M5 on Enum {
+ num get values => 0;
+ void set values(num x) {}
+}
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.expect
new file mode 100644
index 0000000..5326e00
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.expect
@@ -0,0 +1,91 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:6:13: Error: 'M1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// final int values = 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:14:12: Error: 'M3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(String x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:22:11: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:23:12: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:27:7: Error: 'E1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// int values() => 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:35:12: Error: 'E3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:43:11: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:44:12: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M1 extends core::Enum /*isMixinDeclaration*/ {
+ final field core::int values = 42;
+}
+abstract class M2 extends core::Enum /*isMixinDeclaration*/ {
+ static final field core::int values = 42;
+}
+abstract class M3 extends core::Enum /*isMixinDeclaration*/ {
+ set values(core::String x) → void {}
+}
+abstract class M4 extends core::Enum /*isMixinDeclaration*/ {
+ static set values(core::String x) → void {}
+}
+abstract class M5 extends core::Enum /*isMixinDeclaration*/ {
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+abstract class E1 extends core::Enum {
+ synthetic constructor •() → self::E1
+ : super core::Enum::•()
+ ;
+ method values() → core::int
+ return 42;
+}
+abstract class E2 extends core::Enum {
+ synthetic constructor •() → self::E2
+ : super core::Enum::•()
+ ;
+ static method values() → core::int
+ return 42;
+}
+abstract class E3 extends core::Enum {
+ synthetic constructor •() → self::E3
+ : super core::Enum::•()
+ ;
+ set values(core::num x) → void {}
+}
+abstract class E4 extends core::Enum {
+ synthetic constructor •() → self::E4
+ : super core::Enum::•()
+ ;
+ static set values(core::num x) → void {}
+}
+abstract class E5 extends core::Enum {
+ synthetic constructor •() → self::E5
+ : super core::Enum::•()
+ ;
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.modular.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.modular.expect
new file mode 100644
index 0000000..5326e00
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.modular.expect
@@ -0,0 +1,91 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:6:13: Error: 'M1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// final int values = 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:14:12: Error: 'M3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(String x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:22:11: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:23:12: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:27:7: Error: 'E1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// int values() => 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:35:12: Error: 'E3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:43:11: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:44:12: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M1 extends core::Enum /*isMixinDeclaration*/ {
+ final field core::int values = 42;
+}
+abstract class M2 extends core::Enum /*isMixinDeclaration*/ {
+ static final field core::int values = 42;
+}
+abstract class M3 extends core::Enum /*isMixinDeclaration*/ {
+ set values(core::String x) → void {}
+}
+abstract class M4 extends core::Enum /*isMixinDeclaration*/ {
+ static set values(core::String x) → void {}
+}
+abstract class M5 extends core::Enum /*isMixinDeclaration*/ {
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+abstract class E1 extends core::Enum {
+ synthetic constructor •() → self::E1
+ : super core::Enum::•()
+ ;
+ method values() → core::int
+ return 42;
+}
+abstract class E2 extends core::Enum {
+ synthetic constructor •() → self::E2
+ : super core::Enum::•()
+ ;
+ static method values() → core::int
+ return 42;
+}
+abstract class E3 extends core::Enum {
+ synthetic constructor •() → self::E3
+ : super core::Enum::•()
+ ;
+ set values(core::num x) → void {}
+}
+abstract class E4 extends core::Enum {
+ synthetic constructor •() → self::E4
+ : super core::Enum::•()
+ ;
+ static set values(core::num x) → void {}
+}
+abstract class E5 extends core::Enum {
+ synthetic constructor •() → self::E5
+ : super core::Enum::•()
+ ;
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.outline.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.outline.expect
new file mode 100644
index 0000000..7152d79
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.outline.expect
@@ -0,0 +1,93 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:6:13: Error: 'M1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// final int values = 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:14:12: Error: 'M3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(String x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:22:11: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:23:12: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:27:7: Error: 'E1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// int values() => 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:35:12: Error: 'E3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:43:11: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:44:12: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M1 extends core::Enum /*isMixinDeclaration*/ {
+ final field core::int values;
+}
+abstract class M2 extends core::Enum /*isMixinDeclaration*/ {
+ static final field core::int values;
+}
+abstract class M3 extends core::Enum /*isMixinDeclaration*/ {
+ set values(core::String x) → void
+ ;
+}
+abstract class M4 extends core::Enum /*isMixinDeclaration*/ {
+ static set values(core::String x) → void
+ ;
+}
+abstract class M5 extends core::Enum /*isMixinDeclaration*/ {
+ get values() → core::num
+ ;
+ set values(core::num x) → void
+ ;
+}
+abstract class E1 extends core::Enum {
+ synthetic constructor •() → self::E1
+ ;
+ method values() → core::int
+ ;
+}
+abstract class E2 extends core::Enum {
+ synthetic constructor •() → self::E2
+ ;
+ static method values() → core::int
+ ;
+}
+abstract class E3 extends core::Enum {
+ synthetic constructor •() → self::E3
+ ;
+ set values(core::num x) → void
+ ;
+}
+abstract class E4 extends core::Enum {
+ synthetic constructor •() → self::E4
+ ;
+ static set values(core::num x) → void
+ ;
+}
+abstract class E5 extends core::Enum {
+ synthetic constructor •() → self::E5
+ ;
+ get values() → core::num
+ ;
+ set values(core::num x) → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.transformed.expect b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.transformed.expect
new file mode 100644
index 0000000..5326e00
--- /dev/null
+++ b/pkg/front_end/testcases/enhanced_enums/issue48388.dart.weak.transformed.expect
@@ -0,0 +1,91 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:6:13: Error: 'M1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// final int values = 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:14:12: Error: 'M3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(String x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:22:11: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:23:12: Error: 'M5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:27:7: Error: 'E1' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// int values() => 42; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:35:12: Error: 'E3' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:43:11: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// num get values => 0; // Error.
+// ^^^^^^
+//
+// pkg/front_end/testcases/enhanced_enums/issue48388.dart:44:12: Error: 'E5' has 'Enum' as a superinterface and can't contain non-static member with name 'values'.
+// void set values(num x) {} // Error.
+// ^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M1 extends core::Enum /*isMixinDeclaration*/ {
+ final field core::int values = 42;
+}
+abstract class M2 extends core::Enum /*isMixinDeclaration*/ {
+ static final field core::int values = 42;
+}
+abstract class M3 extends core::Enum /*isMixinDeclaration*/ {
+ set values(core::String x) → void {}
+}
+abstract class M4 extends core::Enum /*isMixinDeclaration*/ {
+ static set values(core::String x) → void {}
+}
+abstract class M5 extends core::Enum /*isMixinDeclaration*/ {
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+abstract class E1 extends core::Enum {
+ synthetic constructor •() → self::E1
+ : super core::Enum::•()
+ ;
+ method values() → core::int
+ return 42;
+}
+abstract class E2 extends core::Enum {
+ synthetic constructor •() → self::E2
+ : super core::Enum::•()
+ ;
+ static method values() → core::int
+ return 42;
+}
+abstract class E3 extends core::Enum {
+ synthetic constructor •() → self::E3
+ : super core::Enum::•()
+ ;
+ set values(core::num x) → void {}
+}
+abstract class E4 extends core::Enum {
+ synthetic constructor •() → self::E4
+ : super core::Enum::•()
+ ;
+ static set values(core::num x) → void {}
+}
+abstract class E5 extends core::Enum {
+ synthetic constructor •() → self::E5
+ : super core::Enum::•()
+ ;
+ get values() → core::num
+ return 0;
+ set values(core::num x) → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48402.dart b/pkg/front_end/testcases/general/issue48402.dart
new file mode 100644
index 0000000..d336e24
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48402.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2022, 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.
+
+abstract class I {
+ String get member1;
+ String get procedure;
+ void set setter(String value);
+ void set fieldSetter(String value);
+ void set setterVsGetter(num value);
+ double get getterVsSetter;
+}
+
+class A implements I {
+ // Check for unsorted names of members.
+ static String member5 = "member5";
+ static String member4 = "member4";
+ static String member3 = "member3";
+ static String member1 = "member1"; // Error.
+ static String member2 = "member2";
+
+ static void procedure() {} // Error.
+
+ static void set setter(String value) {} // Error.
+
+ static String fieldSetter = "fieldSetter"; // Error.
+
+ static num get setterVsGetter => 0; // Error.
+
+ static void set getterVsSetter(double value) {} // Error.
+
+ dynamic noSuchMethod(Invocation i) => "foo";
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48402.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue48402.dart.textual_outline.expect
new file mode 100644
index 0000000..5a8834c
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48402.dart.textual_outline.expect
@@ -0,0 +1,24 @@
+abstract class I {
+ String get member1;
+ String get procedure;
+ void set setter(String value);
+ void set fieldSetter(String value);
+ void set setterVsGetter(num value);
+ double get getterVsSetter;
+}
+
+class A implements I {
+ static String member5 = "member5";
+ static String member4 = "member4";
+ static String member3 = "member3";
+ static String member1 = "member1";
+ static String member2 = "member2";
+ static void procedure() {}
+ static void set setter(String value) {}
+ static String fieldSetter = "fieldSetter";
+ static num get setterVsGetter => 0;
+ static void set getterVsSetter(double value) {}
+ dynamic noSuchMethod(Invocation i) => "foo";
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48402.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue48402.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..9ae4cda
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48402.dart.textual_outline_modelled.expect
@@ -0,0 +1,24 @@
+abstract class I {
+ String get member1;
+ String get procedure;
+ double get getterVsSetter;
+ void set fieldSetter(String value);
+ void set setter(String value);
+ void set setterVsGetter(num value);
+}
+
+class A implements I {
+ dynamic noSuchMethod(Invocation i) => "foo";
+ static String fieldSetter = "fieldSetter";
+ static String member1 = "member1";
+ static String member2 = "member2";
+ static String member3 = "member3";
+ static String member4 = "member4";
+ static String member5 = "member5";
+ static num get setterVsGetter => 0;
+ static void procedure() {}
+ static void set getterVsSetter(double value) {}
+ static void set setter(String value) {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48402.dart.weak.expect b/pkg/front_end/testcases/general/issue48402.dart.weak.expect
new file mode 100644
index 0000000..c9cdfb3
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48402.dart.weak.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48402.dart:19:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String member1 = "member1"; // Error.
+// ^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:6:14: Context: This is the inherited member.
+// String get member1;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:22:15: Error: Can't declare a member that conflicts with an inherited one.
+// static void procedure() {} // Error.
+// ^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:7:14: Context: This is the inherited member.
+// String get procedure;
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:26:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String fieldSetter = "fieldSetter"; // Error.
+// ^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:9:12: Context: This is the inherited member.
+// void set fieldSetter(String value);
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:28:18: Error: Can't declare a member that conflicts with an inherited one.
+// static num get setterVsGetter => 0; // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:10:12: Context: This is the inherited member.
+// void set setterVsGetter(num value);
+// ^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:24:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set setter(String value) {} // Error.
+// ^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:8:12: Context: This is the inherited member.
+// void set setter(String value);
+// ^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:30:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set getterVsSetter(double value) {} // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:11:14: Context: This is the inherited member.
+// double get getterVsSetter;
+// ^^^^^^^^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class I extends core::Object {
+ synthetic constructor •() → self::I
+ : super core::Object::•()
+ ;
+ abstract get member1() → core::String;
+ abstract get procedure() → core::String;
+ abstract set setter(core::String value) → void;
+ abstract set fieldSetter(core::String value) → void;
+ abstract set setterVsGetter(core::num value) → void;
+ abstract get getterVsSetter() → core::double;
+}
+class A extends core::Object implements self::I {
+ static field core::String member5 = "member5";
+ static field core::String member4 = "member4";
+ static field core::String member3 = "member3";
+ static field core::String member1 = "member1";
+ static field core::String member2 = "member2";
+ static field core::String fieldSetter = "fieldSetter";
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ static method procedure() → void {}
+ static set setter(core::String value) → void {}
+ static get setterVsGetter() → core::num
+ return 0;
+ static set getterVsSetter(core::double value) → void {}
+ method noSuchMethod(core::Invocation i) → dynamic
+ return "foo";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48402.dart.weak.modular.expect b/pkg/front_end/testcases/general/issue48402.dart.weak.modular.expect
new file mode 100644
index 0000000..c9cdfb3
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48402.dart.weak.modular.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48402.dart:19:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String member1 = "member1"; // Error.
+// ^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:6:14: Context: This is the inherited member.
+// String get member1;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:22:15: Error: Can't declare a member that conflicts with an inherited one.
+// static void procedure() {} // Error.
+// ^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:7:14: Context: This is the inherited member.
+// String get procedure;
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:26:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String fieldSetter = "fieldSetter"; // Error.
+// ^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:9:12: Context: This is the inherited member.
+// void set fieldSetter(String value);
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:28:18: Error: Can't declare a member that conflicts with an inherited one.
+// static num get setterVsGetter => 0; // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:10:12: Context: This is the inherited member.
+// void set setterVsGetter(num value);
+// ^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:24:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set setter(String value) {} // Error.
+// ^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:8:12: Context: This is the inherited member.
+// void set setter(String value);
+// ^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:30:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set getterVsSetter(double value) {} // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:11:14: Context: This is the inherited member.
+// double get getterVsSetter;
+// ^^^^^^^^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class I extends core::Object {
+ synthetic constructor •() → self::I
+ : super core::Object::•()
+ ;
+ abstract get member1() → core::String;
+ abstract get procedure() → core::String;
+ abstract set setter(core::String value) → void;
+ abstract set fieldSetter(core::String value) → void;
+ abstract set setterVsGetter(core::num value) → void;
+ abstract get getterVsSetter() → core::double;
+}
+class A extends core::Object implements self::I {
+ static field core::String member5 = "member5";
+ static field core::String member4 = "member4";
+ static field core::String member3 = "member3";
+ static field core::String member1 = "member1";
+ static field core::String member2 = "member2";
+ static field core::String fieldSetter = "fieldSetter";
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ static method procedure() → void {}
+ static set setter(core::String value) → void {}
+ static get setterVsGetter() → core::num
+ return 0;
+ static set getterVsSetter(core::double value) → void {}
+ method noSuchMethod(core::Invocation i) → dynamic
+ return "foo";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48402.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue48402.dart.weak.outline.expect
new file mode 100644
index 0000000..a9e90d2
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48402.dart.weak.outline.expect
@@ -0,0 +1,81 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48402.dart:19:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String member1 = "member1"; // Error.
+// ^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:6:14: Context: This is the inherited member.
+// String get member1;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:22:15: Error: Can't declare a member that conflicts with an inherited one.
+// static void procedure() {} // Error.
+// ^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:7:14: Context: This is the inherited member.
+// String get procedure;
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:26:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String fieldSetter = "fieldSetter"; // Error.
+// ^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:9:12: Context: This is the inherited member.
+// void set fieldSetter(String value);
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:28:18: Error: Can't declare a member that conflicts with an inherited one.
+// static num get setterVsGetter => 0; // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:10:12: Context: This is the inherited member.
+// void set setterVsGetter(num value);
+// ^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:24:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set setter(String value) {} // Error.
+// ^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:8:12: Context: This is the inherited member.
+// void set setter(String value);
+// ^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:30:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set getterVsSetter(double value) {} // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:11:14: Context: This is the inherited member.
+// double get getterVsSetter;
+// ^^^^^^^^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class I extends core::Object {
+ synthetic constructor •() → self::I
+ ;
+ abstract get member1() → core::String;
+ abstract get procedure() → core::String;
+ abstract set setter(core::String value) → void;
+ abstract set fieldSetter(core::String value) → void;
+ abstract set setterVsGetter(core::num value) → void;
+ abstract get getterVsSetter() → core::double;
+}
+class A extends core::Object implements self::I {
+ static field core::String member5;
+ static field core::String member4;
+ static field core::String member3;
+ static field core::String member1;
+ static field core::String member2;
+ static field core::String fieldSetter;
+ synthetic constructor •() → self::A
+ ;
+ static method procedure() → void
+ ;
+ static set setter(core::String value) → void
+ ;
+ static get setterVsGetter() → core::num
+ ;
+ static set getterVsSetter(core::double value) → void
+ ;
+ method noSuchMethod(core::Invocation i) → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/issue48402.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue48402.dart.weak.transformed.expect
new file mode 100644
index 0000000..c9cdfb3
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48402.dart.weak.transformed.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48402.dart:19:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String member1 = "member1"; // Error.
+// ^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:6:14: Context: This is the inherited member.
+// String get member1;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:22:15: Error: Can't declare a member that conflicts with an inherited one.
+// static void procedure() {} // Error.
+// ^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:7:14: Context: This is the inherited member.
+// String get procedure;
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:26:17: Error: Can't declare a member that conflicts with an inherited one.
+// static String fieldSetter = "fieldSetter"; // Error.
+// ^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:9:12: Context: This is the inherited member.
+// void set fieldSetter(String value);
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:28:18: Error: Can't declare a member that conflicts with an inherited one.
+// static num get setterVsGetter => 0; // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:10:12: Context: This is the inherited member.
+// void set setterVsGetter(num value);
+// ^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:24:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set setter(String value) {} // Error.
+// ^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:8:12: Context: This is the inherited member.
+// void set setter(String value);
+// ^^^^^^
+//
+// pkg/front_end/testcases/general/issue48402.dart:30:19: Error: Can't declare a member that conflicts with an inherited one.
+// static void set getterVsSetter(double value) {} // Error.
+// ^^^^^^^^^^^^^^
+// pkg/front_end/testcases/general/issue48402.dart:11:14: Context: This is the inherited member.
+// double get getterVsSetter;
+// ^^^^^^^^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class I extends core::Object {
+ synthetic constructor •() → self::I
+ : super core::Object::•()
+ ;
+ abstract get member1() → core::String;
+ abstract get procedure() → core::String;
+ abstract set setter(core::String value) → void;
+ abstract set fieldSetter(core::String value) → void;
+ abstract set setterVsGetter(core::num value) → void;
+ abstract get getterVsSetter() → core::double;
+}
+class A extends core::Object implements self::I {
+ static field core::String member5 = "member5";
+ static field core::String member4 = "member4";
+ static field core::String member3 = "member3";
+ static field core::String member1 = "member1";
+ static field core::String member2 = "member2";
+ static field core::String fieldSetter = "fieldSetter";
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ static method procedure() → void {}
+ static set setter(core::String value) → void {}
+ static get setterVsGetter() → core::num
+ return 0;
+ static set getterVsSetter(core::double value) → void {}
+ method noSuchMethod(core::Invocation i) → dynamic
+ return "foo";
+}
+static method main() → dynamic {}
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index 164c4aa..d79ce34 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -688,7 +688,7 @@
@override
DecoratedType? visitClassTypeAlias(ClassTypeAlias node) {
- _dispatch(node.superclass2);
+ _dispatch(node.superclass);
_dispatch(node.implementsClause);
_dispatch(node.withClause);
var classElement = node.declaredElement!;
@@ -782,7 +782,7 @@
DecoratedType? visitConstructorDeclaration(ConstructorDeclaration node) {
_fieldsNotInitializedByConstructor =
_fieldsNotInitializedAtDeclaration!.toSet();
- _dispatch(node.redirectedConstructor?.type2.typeArguments);
+ _dispatch(node.redirectedConstructor?.type.typeArguments);
_handleExecutableDeclaration(
node,
node.declaredElement!,
@@ -1188,7 +1188,7 @@
var typeParameters = callee.enclosingElement.typeParameters;
Iterable<DartType?> typeArgumentTypes;
List<DecoratedType> decoratedTypeArguments;
- var typeArguments = node.constructorName.type2.typeArguments;
+ var typeArguments = node.constructorName.type.typeArguments;
late List<EdgeOrigin> parameterEdgeOrigins;
var target =
NullabilityNodeTarget.text('constructed type').withCodeRef(node);
@@ -2559,7 +2559,7 @@
var callee = redirectedConstructor.staticElement!.declaration;
var redirectedClass = callee.enclosingElement;
var calleeType = _variables!.decoratedElementType(callee);
- var typeArguments = redirectedConstructor.type2.typeArguments;
+ var typeArguments = redirectedConstructor.type.typeArguments;
var typeArgumentTypes =
typeArguments?.arguments.map((t) => t.type).toList();
_handleInvocationArguments(
diff --git a/pkg/nnbd_migration/lib/src/node_builder.dart b/pkg/nnbd_migration/lib/src/node_builder.dart
index ac2cf60..965e616 100644
--- a/pkg/nnbd_migration/lib/src/node_builder.dart
+++ b/pkg/nnbd_migration/lib/src/node_builder.dart
@@ -135,7 +135,7 @@
node.nativeClause?.accept(this);
node.members.accept(this);
var classElement = node.declaredElement!;
- _handleSupertypeClauses(node, classElement, node.extendsClause?.superclass2,
+ _handleSupertypeClauses(node, classElement, node.extendsClause?.superclass,
node.withClause, node.implementsClause, null);
var constructors = classElement.constructors;
if (constructors.length == 1) {
@@ -161,7 +161,7 @@
node.name.accept(this);
node.typeParameters?.accept(this);
var classElement = node.declaredElement!;
- _handleSupertypeClauses(node, classElement, node.superclass2,
+ _handleSupertypeClauses(node, classElement, node.superclass,
node.withClause, node.implementsClause, null);
for (var constructorElement in classElement.constructors) {
assert(constructorElement.isSynthetic);
@@ -208,7 +208,7 @@
@override
DecoratedType? visitConstructorName(ConstructorName node) {
_pushNullabilityNodeTarget(NullabilityNodeTarget.text('constructed type'),
- () => node.type2.accept(this));
+ () => node.type.accept(this));
node.name?.accept(this);
return null;
}
@@ -921,13 +921,13 @@
var supertypes = <NamedType?>[];
supertypes.add(superclass);
if (withClause != null) {
- supertypes.addAll(withClause.mixinTypes2);
+ supertypes.addAll(withClause.mixinTypes);
}
if (implementsClause != null) {
- supertypes.addAll(implementsClause.interfaces2);
+ supertypes.addAll(implementsClause.interfaces);
}
if (onClause != null) {
- supertypes.addAll(onClause.superclassConstraints2);
+ supertypes.addAll(onClause.superclassConstraints);
}
var decoratedSupertypes = <ClassElement, DecoratedType?>{};
_pushNullabilityNodeTarget(
diff --git a/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart b/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart
index 5c2e296..8af9550 100644
--- a/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart
+++ b/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart
@@ -31,7 +31,7 @@
final parent = node.parent;
if (parent is ConstructorName) {
// We only need to visit C in `new C()`, just `int` in `new C<int>()`.
- return parent.type2 != node;
+ return parent.type != node;
}
return true;
diff --git a/pkg/wasm_builder/OWNERS b/pkg/wasm_builder/OWNERS
new file mode 100644
index 0000000..2e908ab
--- /dev/null
+++ b/pkg/wasm_builder/OWNERS
@@ -0,0 +1 @@
+file:/tools/OWNERS_WASM
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index c928e03..778673b 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -287,8 +287,8 @@
V(_OneByteString, get:hashCode, OneByteString_getHashCode, 0x75e0d454) \
V(_OneByteString, _substringUncheckedNative, \
OneByteString_substringUnchecked, 0x9b18195e) \
- V(_OneByteString, ==, OneByteString_equality, 0xb50039a8) \
- V(_TwoByteString, ==, TwoByteString_equality, 0xb50039a8) \
+ V(_OneByteString, ==, OneByteString_equality, 0xb5003d69) \
+ V(_TwoByteString, ==, TwoByteString_equality, 0xb5003d69) \
V(_Type, get:hashCode, Type_getHashCode, 0x75e0d454) \
V(_Type, ==, Type_equality, 0x465868ae) \
V(_FunctionType, get:hashCode, FunctionType_getHashCode, 0x75e0d454) \
diff --git a/sdk/lib/_internal/vm/lib/string_patch.dart b/sdk/lib/_internal/vm/lib/string_patch.dart
index c62a03a..0a51f33 100644
--- a/sdk/lib/_internal/vm/lib/string_patch.dart
+++ b/sdk/lib/_internal/vm/lib/string_patch.dart
@@ -986,6 +986,9 @@
@pragma("vm:recognized", "asm-intrinsic")
@pragma("vm:exact-result-type", bool)
+ // Intrinsic is more efficient than an inlined body even for the small
+ // strings.
+ @pragma('vm:never-inline')
bool operator ==(Object other) {
return super == other;
}
@@ -1332,6 +1335,9 @@
@pragma("vm:recognized", "asm-intrinsic")
@pragma("vm:exact-result-type", bool)
+ // Intrinsic is more efficient than an inlined body even for the small
+ // strings.
+ @pragma('vm:never-inline')
bool operator ==(Object other) {
return super == other;
}
diff --git a/sdk/lib/_internal/wasm/OWNERS b/sdk/lib/_internal/wasm/OWNERS
new file mode 100644
index 0000000..2e908ab
--- /dev/null
+++ b/sdk/lib/_internal/wasm/OWNERS
@@ -0,0 +1 @@
+file:/tools/OWNERS_WASM
diff --git a/sdk/lib/wasm/OWNERS b/sdk/lib/wasm/OWNERS
new file mode 100644
index 0000000..2e908ab
--- /dev/null
+++ b/sdk/lib/wasm/OWNERS
@@ -0,0 +1 @@
+file:/tools/OWNERS_WASM
diff --git a/tools/OWNERS_WASM b/tools/OWNERS_WASM
new file mode 100644
index 0000000..ee153f1
--- /dev/null
+++ b/tools/OWNERS_WASM
@@ -0,0 +1,3 @@
+askesc@google.com
+joshualitt@google.com
+kustermann@google.com
diff --git a/tools/VERSION b/tools/VERSION
index 6a9c5f7..7febf05 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 116
+PRERELEASE 117
PRERELEASE_PATCH 0
\ No newline at end of file