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

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

Issue 1151183003: Issue 23551. Fix for using type parameters of the enclosed classes in 'Create Missing Overrides' Qu… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 'package:analysis_server/edit/fix/fix_core.dart'; 7 import 'package:analysis_server/edit/fix/fix_core.dart';
8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; 8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
9 import 'package:analysis_server/src/services/correction/fix.dart'; 9 import 'package:analysis_server/src/services/correction/fix.dart';
10 import 'package:analysis_server/src/services/correction/fix_internal.dart'; 10 import 'package:analysis_server/src/services/correction/fix_internal.dart';
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 1538
1539 class B extends A { 1539 class B extends A {
1540 @override 1540 @override
1541 forEach(int f(double p1, String p2)) { 1541 forEach(int f(double p1, String p2)) {
1542 // TODO: implement forEach 1542 // TODO: implement forEach
1543 } 1543 }
1544 } 1544 }
1545 '''); 1545 ''');
1546 } 1546 }
1547 1547
1548 void test_createMissingOverrides_generics() { 1548 void test_createMissingOverrides_generics_typeArguments() {
1549 resolveTestUnit(''' 1549 resolveTestUnit('''
1550 class Iterator<T> { 1550 class Iterator<T> {
1551 } 1551 }
1552 1552
1553 abstract class IterableMixin<T> { 1553 abstract class IterableMixin<T> {
1554 Iterator<T> get iterator; 1554 Iterator<T> get iterator;
1555 } 1555 }
1556 1556
1557 class Test extends IterableMixin<int> { 1557 class Test extends IterableMixin<int> {
1558 } 1558 }
1559 '''); 1559 ''');
1560 assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' 1560 assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, '''
1561 class Iterator<T> { 1561 class Iterator<T> {
1562 } 1562 }
1563 1563
1564 abstract class IterableMixin<T> { 1564 abstract class IterableMixin<T> {
1565 Iterator<T> get iterator; 1565 Iterator<T> get iterator;
1566 } 1566 }
1567 1567
1568 class Test extends IterableMixin<int> { 1568 class Test extends IterableMixin<int> {
1569 // TODO: implement iterator 1569 // TODO: implement iterator
1570 @override 1570 @override
1571 Iterator<int> get iterator => null; 1571 Iterator<int> get iterator => null;
1572 } 1572 }
1573 '''); 1573 ''');
1574 } 1574 }
1575 1575
1576 void test_createMissingOverrides_generics_typeParameters() {
1577 resolveTestUnit('''
1578 abstract class ItemProvider<T> {
1579 List<T> getItems();
1580 }
1581
1582 class Test<V> extends ItemProvider<V> {
1583 }
1584 ''');
1585 assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, '''
1586 abstract class ItemProvider<T> {
1587 List<T> getItems();
1588 }
1589
1590 class Test<V> extends ItemProvider<V> {
1591 @override
1592 List<V> getItems() {
1593 // TODO: implement getItems
1594 }
1595 }
1596 ''');
1597 }
1598
1576 void test_createMissingOverrides_getter() { 1599 void test_createMissingOverrides_getter() {
1577 resolveTestUnit(''' 1600 resolveTestUnit('''
1578 abstract class A { 1601 abstract class A {
1579 get g1; 1602 get g1;
1580 int get g2; 1603 int get g2;
1581 } 1604 }
1582 1605
1583 class B extends A { 1606 class B extends A {
1584 } 1607 }
1585 '''); 1608 ''');
(...skipping 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3760 3783
3761 List<Position> _findResultPositions(List<String> searchStrings) { 3784 List<Position> _findResultPositions(List<String> searchStrings) {
3762 List<Position> positions = <Position>[]; 3785 List<Position> positions = <Position>[];
3763 for (String search in searchStrings) { 3786 for (String search in searchStrings) {
3764 int offset = resultCode.indexOf(search); 3787 int offset = resultCode.indexOf(search);
3765 positions.add(new Position(testFile, offset)); 3788 positions.add(new Position(testFile, offset));
3766 } 3789 }
3767 return positions; 3790 return positions;
3768 } 3791 }
3769 } 3792 }
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