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

Side by Side Diff: pkg/analyzer/test/generated/hint_code_test.dart

Issue 2983293002: Remove toplevel inference restriction hints, and restore as much (Closed)
Patch Set: Keep error filter Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analyzer.test.generated.hint_code_test; 5 library analyzer.test.generated.hint_code_test;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/parser.dart'; 10 import 'package:analyzer/src/generated/parser.dart';
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 main() { 2580 main() {
2581 List dynamicList = [ ]; 2581 List dynamicList = [ ];
2582 List<int> list = dynamicList; 2582 List<int> list = dynamicList;
2583 print(list); 2583 print(list);
2584 }'''); 2584 }''');
2585 await computeAnalysisResult(source); 2585 await computeAnalysisResult(source);
2586 assertErrors(source, [StrongModeCode.DOWN_CAST_COMPOSITE]); 2586 assertErrors(source, [StrongModeCode.DOWN_CAST_COMPOSITE]);
2587 verify([source]); 2587 verify([source]);
2588 } 2588 }
2589 2589
2590 test_strongMode_topLevelInstanceGetter() async {
2591 resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
2592 Source source = addSource(r'''
2593 class A {
2594 int get g => 0;
2595 }
2596 var a = new A();
2597 var b = a.g;
2598 ''');
2599 await computeAnalysisResult(source);
2600 assertErrors(source, [StrongModeCode.TOP_LEVEL_INSTANCE_GETTER]);
2601 verify([source]);
2602 }
2603
2604 test_typeCheck_type_is_Null() async { 2590 test_typeCheck_type_is_Null() async {
2605 Source source = addSource(r''' 2591 Source source = addSource(r'''
2606 m(i) { 2592 m(i) {
2607 bool b = i is Null; 2593 bool b = i is Null;
2608 }'''); 2594 }''');
2609 await computeAnalysisResult(source); 2595 await computeAnalysisResult(source);
2610 assertErrors(source, [HintCode.TYPE_CHECK_IS_NULL]); 2596 assertErrors(source, [HintCode.TYPE_CHECK_IS_NULL]);
2611 verify([source]); 2597 verify([source]);
2612 } 2598 }
2613 2599
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
4268 n() { 4254 n() {
4269 var a = m(), b = m(); 4255 var a = m(), b = m();
4270 } 4256 }
4271 }'''); 4257 }''');
4272 await computeAnalysisResult(source); 4258 await computeAnalysisResult(source);
4273 assertErrors( 4259 assertErrors(
4274 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 4260 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
4275 verify([source]); 4261 verify([source]);
4276 } 4262 }
4277 } 4263 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/strong_mode.dart ('k') | pkg/analyzer/test/src/summary/linker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698