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

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

Issue 2650763002: Revert "Deprecate the use of `Function` as a class." (Closed)
Patch Set: 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
1006 test_divisionOptimization_double() async { 947 test_divisionOptimization_double() async {
1007 Source source = addSource(r''' 948 Source source = addSource(r'''
1008 f(double x, double y) { 949 f(double x, double y) {
1009 var v = (x / y).toInt(); 950 var v = (x / y).toInt();
1010 }'''); 951 }''');
1011 await computeAnalysisResult(source); 952 await computeAnalysisResult(source);
1012 assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]); 953 assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
1013 verify([source]); 954 verify([source]);
1014 } 955 }
1015 956
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
4092 n() { 4033 n() {
4093 var a = m(), b = m(); 4034 var a = m(), b = m();
4094 } 4035 }
4095 }'''); 4036 }''');
4096 await computeAnalysisResult(source); 4037 await computeAnalysisResult(source);
4097 assertErrors( 4038 assertErrors(
4098 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 4039 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
4099 verify([source]); 4040 verify([source]);
4100 } 4041 }
4101 } 4042 }
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