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

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

Issue 1936873002: Warn about @deprecated positional parameters (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/analyzer/lib/src/generated/resolver.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) 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/src/generated/engine.dart'; 7 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
9 import 'package:analyzer/src/generated/source_io.dart'; 9 import 'package:analyzer/src/generated/source_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 class A { 651 class A {
652 @deprecated 652 @deprecated
653 m() {} 653 m() {}
654 n() {m();} 654 n() {m();}
655 }'''); 655 }''');
656 computeLibrarySourceErrors(source); 656 computeLibrarySourceErrors(source);
657 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); 657 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
658 verify([source]); 658 verify([source]);
659 } 659 }
660 660
661 void test_deprecatedAnnotationUse_positional() {
662 Source source = addSource(r'''
663 class A {
664 m([@deprecated int x]) {}
665 n() {m(1);}
666 }''');
667 computeLibrarySourceErrors(source);
668 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
669 verify([source]);
670 }
671
672 void test_deprecatedAnnotationUse_named() {
673 Source source = addSource(r'''
674 class A {
675 m({@deprecated int x}) {}
676 n() {m(x: 1);}
677 }''');
678 computeLibrarySourceErrors(source);
679 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
680 verify([source]);
681 }
682
661 void test_deprecatedAnnotationUse_export() { 683 void test_deprecatedAnnotationUse_export() {
662 Source source = addSource("export 'deprecated_library.dart';"); 684 Source source = addSource("export 'deprecated_library.dart';");
663 addNamedSource( 685 addNamedSource(
664 "/deprecated_library.dart", 686 "/deprecated_library.dart",
665 r''' 687 r'''
666 @deprecated 688 @deprecated
667 library deprecated_library; 689 library deprecated_library;
668 class A {}'''); 690 class A {}''');
669 computeLibrarySourceErrors(source); 691 computeLibrarySourceErrors(source);
670 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); 692 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
(...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after
3312 n() { 3334 n() {
3313 var a = m(), b = m(); 3335 var a = m(), b = m();
3314 } 3336 }
3315 }'''); 3337 }''');
3316 computeLibrarySourceErrors(source); 3338 computeLibrarySourceErrors(source);
3317 assertErrors( 3339 assertErrors(
3318 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 3340 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
3319 verify([source]); 3341 verify([source]);
3320 } 3342 }
3321 } 3343 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698