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

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

Issue 1487683006: Fix for exception in FixProcessor._addFix_illegalAsyncReturnType. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 '''); 2593 ''');
2594 await assertHasFix( 2594 await assertHasFix(
2595 DartFixKind.INSERT_SEMICOLON, 2595 DartFixKind.INSERT_SEMICOLON,
2596 ''' 2596 '''
2597 main() { 2597 main() {
2598 print(0); 2598 print(0);
2599 } 2599 }
2600 '''); 2600 ''');
2601 } 2601 }
2602 2602
2603 test_illegalAsyncReturnType_adjacentNodes() async {
2604 errorFilter = (AnalysisError error) {
2605 return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
2606 };
2607 resolveTestUnit('''
2608 import 'dart:async';
2609 var v;int main() async => 0;
2610 ''');
2611 await assertHasFix(
2612 DartFixKind.REPLACE_RETURN_TYPE_FUTURE,
2613 '''
2614 import 'dart:async';
2615 var v;Future<int> main() async => 0;
2616 ''');
2617 }
2618
2603 test_illegalAsyncReturnType_asyncLibrary_import() async { 2619 test_illegalAsyncReturnType_asyncLibrary_import() async {
2604 errorFilter = (AnalysisError error) { 2620 errorFilter = (AnalysisError error) {
2605 return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE; 2621 return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
2606 }; 2622 };
2607 resolveTestUnit(''' 2623 resolveTestUnit('''
2608 library main; 2624 library main;
2609 int main() async { 2625 int main() async {
2610 } 2626 }
2611 '''); 2627 ''');
2612 await assertHasFix( 2628 await assertHasFix(
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after
4690 int offset = resultCode.indexOf(search); 4706 int offset = resultCode.indexOf(search);
4691 positions.add(new Position(testFile, offset)); 4707 positions.add(new Position(testFile, offset));
4692 } 4708 }
4693 return positions; 4709 return positions;
4694 } 4710 }
4695 4711
4696 void _performAnalysis() { 4712 void _performAnalysis() {
4697 while (context.performAnalysisTask().hasMoreWork); 4713 while (context.performAnalysisTask().hasMoreWork);
4698 } 4714 }
4699 } 4715 }
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