Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(778)

Unified Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1664423002: Issue 25650. Generate unique parameter names when create a method or function. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index e01bf040e2563b5369bd7b1a0fd24a7d4b605bb0..dfb6a600fb09ed2d681c8cf48852012b60ded840 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -3782,6 +3782,32 @@ main() {
''');
}
+ test_undefinedFunction_create_duplicateArgumentNames() async {
+ resolveTestUnit('''
+class C {
+ int x;
+}
+
+foo(C c1, C c2) {
+ bar(c1.x, c2.x);
+}
+''');
+ await assertHasFix(
+ DartFixKind.CREATE_FUNCTION,
+ '''
+class C {
+ int x;
+}
+
+foo(C c1, C c2) {
+ bar(c1.x, c2.x);
+}
+
+void bar(int x, int x2) {
+}
+''');
+ }
+
test_undefinedFunction_create_dynamicArgument() async {
resolveTestUnit('''
main() {
@@ -4433,6 +4459,34 @@ main() {
await assertNoFix(DartFixKind.CREATE_METHOD);
}
+ test_undefinedMethod_createUnqualified_duplicateArgumentNames() async {
+ resolveTestUnit('''
+class C {
+ int x;
+}
+
+class D {
+ foo(C c1, C c2) {
+ bar(c1.x, c2.x);
+ }
+}''');
+ await assertHasFix(
+ DartFixKind.CREATE_METHOD,
+ '''
+class C {
+ int x;
+}
+
+class D {
+ foo(C c1, C c2) {
+ bar(c1.x, c2.x);
+ }
+
+ void bar(int x, int x2) {
+ }
+}''');
+ }
+
test_undefinedMethod_createUnqualified_parameters() async {
resolveTestUnit('''
class A {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698