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

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1804743002: Fix generation of getters and fields in quick fixes (issue 25691) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.correction.fix; 5 library test.services.correction.fix;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 void f(Object p) { 1397 void f(Object p) {
1398 p == b.test; 1398 p == b.test;
1399 } 1399 }
1400 } 1400 }
1401 class B { 1401 class B {
1402 var test; 1402 var test;
1403 } 1403 }
1404 '''); 1404 ''');
1405 } 1405 }
1406 1406
1407 test_createField_getter_qualified_propagatedType() async {
1408 resolveTestUnit('''
1409 class A {
1410 A get self => this;
1411 }
1412 main() {
1413 var a = new A();
1414 int v = a.self.test;
1415 }
1416 ''');
1417 await assertHasFix(
1418 DartFixKind.CREATE_FIELD,
1419 '''
1420 class A {
1421 int test;
1422
1423 A get self => this;
1424 }
1425 main() {
1426 var a = new A();
1427 int v = a.self.test;
1428 }
1429 ''');
1430 }
1431
1407 test_createField_getter_unqualified_instance_asInvocationArgument() async { 1432 test_createField_getter_unqualified_instance_asInvocationArgument() async {
1408 resolveTestUnit(''' 1433 resolveTestUnit('''
1409 class A { 1434 class A {
1410 main() { 1435 main() {
1411 f(test); 1436 f(test);
1412 } 1437 }
1413 } 1438 }
1414 f(String s) {} 1439 f(String s) {}
1415 '''); 1440 ''');
1416 await assertHasFix( 1441 await assertHasFix(
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 void f(Object p) { 2001 void f(Object p) {
1977 p == b.test; 2002 p == b.test;
1978 } 2003 }
1979 } 2004 }
1980 class B { 2005 class B {
1981 get test => null; 2006 get test => null;
1982 } 2007 }
1983 '''); 2008 ''');
1984 } 2009 }
1985 2010
2011 test_createGetter_qualified_propagatedType() async {
2012 resolveTestUnit('''
2013 class A {
2014 A get self => this;
2015 }
2016 main() {
2017 var a = new A();
2018 int v = a.self.test;
2019 }
2020 ''');
2021 await assertHasFix(
2022 DartFixKind.CREATE_GETTER,
2023 '''
2024 class A {
2025 A get self => this;
2026
2027 int get test => null;
2028 }
2029 main() {
2030 var a = new A();
2031 int v = a.self.test;
2032 }
2033 ''');
2034 }
2035
1986 test_createGetter_setterContext() async { 2036 test_createGetter_setterContext() async {
1987 resolveTestUnit(''' 2037 resolveTestUnit('''
1988 class A { 2038 class A {
1989 } 2039 }
1990 main(A a) { 2040 main(A a) {
1991 a.test = 42; 2041 a.test = 42;
1992 } 2042 }
1993 '''); 2043 ''');
1994 await assertNoFix(DartFixKind.CREATE_GETTER); 2044 await assertNoFix(DartFixKind.CREATE_GETTER);
1995 } 2045 }
(...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after
5234 @override 5284 @override
5235 void t() { } 5285 void t() { }
5236 } 5286 }
5237 '''); 5287 ''');
5238 } 5288 }
5239 5289
5240 void verifyResult(String expectedResult) { 5290 void verifyResult(String expectedResult) {
5241 expect(resultCode, expectedResult); 5291 expect(resultCode, expectedResult);
5242 } 5292 }
5243 } 5293 }
OLDNEW
« 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