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

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

Issue 2643073002: Deprecate the use of `Function` as a class. (Closed)
Patch Set: Update type. Created 3 years, 11 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/error_verifier.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/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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 A.named() {} 937 A.named() {}
938 } 938 }
939 class B extends A { 939 class B extends A {
940 B() : super.named() {} 940 B() : super.named() {}
941 }'''); 941 }''');
942 await computeAnalysisResult(source); 942 await computeAnalysisResult(source);
943 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); 943 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
944 verify([source]); 944 verify([source]);
945 } 945 }
946 946
947 test_deprecatedFunction_class() async {
948 Source source = addSource(r'''
949 class Function {}
950 ''');
951 await computeAnalysisResult(source);
952 assertErrors(source, [HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION]);
953 verify([source]);
954 }
955
956 test_deprecatedFunction_extends() async {
957 Source source = addSource(r'''
958 class A extends Function {}
959 ''');
960 await computeAnalysisResult(source);
961 assertErrors(source, [
962 HintCode.DEPRECATED_EXTENDS_FUNCTION,
963 StaticWarningCode.FUNCTION_WITHOUT_CALL
964 ]);
965 verify([source]);
966 }
967
968 test_deprecatedFunction_extends2() async {
969 Source source = addSource(r'''
970 class Function {}
971 class A extends Function {}
972 ''');
973 await computeAnalysisResult(source);
974 assertErrors(source, [
975 HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
976 HintCode.DEPRECATED_EXTENDS_FUNCTION
977 ]);
978 verify([source]);
979 }
980
981 test_deprecatedFunction_mixin() async {
982 Source source = addSource(r'''
983 class A extends Object with Function {}
984 ''');
985 await computeAnalysisResult(source);
986 assertErrors(source, [
987 HintCode.DEPRECATED_MIXIN_FUNCTION,
988 StaticWarningCode.FUNCTION_WITHOUT_CALL
989 ]);
990 verify([source]);
991 }
992
993 test_deprecatedFunction_mixin2() async {
994 Source source = addSource(r'''
995 class Function {}
996 class A extends Object with Function {}
997 ''');
998 await computeAnalysisResult(source);
999 assertErrors(source, [
1000 HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
1001 HintCode.DEPRECATED_MIXIN_FUNCTION
1002 ]);
1003 verify([source]);
1004 }
1005
947 test_divisionOptimization_double() async { 1006 test_divisionOptimization_double() async {
948 Source source = addSource(r''' 1007 Source source = addSource(r'''
949 f(double x, double y) { 1008 f(double x, double y) {
950 var v = (x / y).toInt(); 1009 var v = (x / y).toInt();
951 }'''); 1010 }''');
952 await computeAnalysisResult(source); 1011 await computeAnalysisResult(source);
953 assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]); 1012 assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
954 verify([source]); 1013 verify([source]);
955 } 1014 }
956 1015
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
4033 n() { 4092 n() {
4034 var a = m(), b = m(); 4093 var a = m(), b = m();
4035 } 4094 }
4036 }'''); 4095 }''');
4037 await computeAnalysisResult(source); 4096 await computeAnalysisResult(source);
4038 assertErrors( 4097 assertErrors(
4039 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 4098 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
4040 verify([source]); 4099 verify([source]);
4041 } 4100 }
4042 } 4101 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698