Version 2.16.0-38.0.dev
Merge commit 'b1955d63ad678b651b09db3dd286136c4463f36b' into 'dev'
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index d5d6cec..3bbe4f6 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -2813,6 +2813,9 @@
if (identical(node.type, _oldNode)) {
node.type = _newNode as TypeAnnotation;
return true;
+ } else if (identical(node.typeParameters, _oldNode)) {
+ node.typeParameters = _newNode as TypeParameterList;
+ return true;
} else if (identical(node.parameters, _oldNode)) {
node.parameters = _newNode as FormalParameterList;
return true;
diff --git a/pkg/analyzer/lib/src/test_utilities/find_node.dart b/pkg/analyzer/lib/src/test_utilities/find_node.dart
index 21b51e7..3c22e00 100644
--- a/pkg/analyzer/lib/src/test_utilities/find_node.dart
+++ b/pkg/analyzer/lib/src/test_utilities/find_node.dart
@@ -344,6 +344,10 @@
return _node(search, (n) => n is SuperConstructorInvocation);
}
+ SuperFormalParameter superFormalParameter(String search) {
+ return _node(search, (n) => n is SuperFormalParameter);
+ }
+
SwitchStatement switchStatement(String search) {
return _node(search, (n) => n is SwitchStatement);
}
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index cc7633c..20115cd 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -2,9 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/ast/ast_factory.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/generated/java_engine.dart';
@@ -1464,7 +1466,7 @@
try {} on E2 catch (e2, st2) {}
}
''');
- _assertReplaceList<CatchClause>(
+ _assertReplace2<CatchClause>(
destination: findNode.catchClause('(e,'),
source: findNode.catchClause('(e2,'),
getters: [
@@ -2118,6 +2120,30 @@
node, Getter_NodeReplacerTest_test_superConstructorInvocation_2());
}
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/47741')
+ void test_superFormalParameter() {
+ var findNode = _parseStringToFindNode(r'''
+class A {
+ A(int foo<T>(int a));
+}
+
+class B extends A {
+ B.sub1(double super.bar1<T1>(int a1),);
+ B.sub2(double super.bar2<T2>(int a2),);
+}
+''');
+ _assertReplace2<SuperFormalParameter>(
+ destination: findNode.superFormalParameter('bar1'),
+ source: findNode.superFormalParameter('bar2'),
+ getters: [
+ (node) => node.type!,
+ (node) => node.identifier,
+ (node) => node.typeParameters!,
+ (node) => node.parameters!,
+ ],
+ );
+ }
+
void test_switchCase() {
SwitchCase node = AstTestFactory.switchCase2([AstTestFactory.label2("l")],
AstTestFactory.integer(0), [AstTestFactory.block()]);
@@ -2262,7 +2288,7 @@
}
}
- void _assertReplaceList<T extends AstNode>({
+ void _assertReplace2<T extends AstNode>({
required T destination,
required T source,
required List<AstNode Function(T node)> getters,
@@ -2279,7 +2305,15 @@
}
FindNode _parseStringToFindNode(String content) {
- var parseResult = parseString(content: content);
+ var parseResult = parseString(
+ content: content,
+ featureSet: FeatureSet.fromEnableFlags2(
+ sdkLanguageVersion: ExperimentStatus.currentVersion,
+ flags: [
+ Feature.super_parameters.enableString,
+ ],
+ ),
+ );
return FindNode(parseResult.content, parseResult.unit);
}
diff --git a/tools/VERSION b/tools/VERSION
index fb38f54..8488061 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 37
+PRERELEASE 38
PRERELEASE_PATCH 0
\ No newline at end of file