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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/hint_code_test.dart
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index 52b0febf25bf92c570fbce05e5e66a5dc5004015..013ffe281867cbdeca13e8d22ea0a64e127811ab 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -944,6 +944,65 @@ class B extends A {
verify([source]);
}
+ test_deprecatedFunction_class() async {
+ Source source = addSource(r'''
+class Function {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION]);
+ verify([source]);
+ }
+
+ test_deprecatedFunction_extends() async {
+ Source source = addSource(r'''
+class A extends Function {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ HintCode.DEPRECATED_EXTENDS_FUNCTION,
+ StaticWarningCode.FUNCTION_WITHOUT_CALL
+ ]);
+ verify([source]);
+ }
+
+ test_deprecatedFunction_extends2() async {
+ Source source = addSource(r'''
+class Function {}
+class A extends Function {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
+ HintCode.DEPRECATED_EXTENDS_FUNCTION
+ ]);
+ verify([source]);
+ }
+
+ test_deprecatedFunction_mixin() async {
+ Source source = addSource(r'''
+class A extends Object with Function {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ HintCode.DEPRECATED_MIXIN_FUNCTION,
+ StaticWarningCode.FUNCTION_WITHOUT_CALL
+ ]);
+ verify([source]);
+ }
+
+ test_deprecatedFunction_mixin2() async {
+ Source source = addSource(r'''
+class Function {}
+class A extends Object with Function {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
+ HintCode.DEPRECATED_MIXIN_FUNCTION
+ ]);
+ verify([source]);
+ }
+
test_divisionOptimization_double() async {
Source source = addSource(r'''
f(double x, double y) {
« 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