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

Unified Diff: pkg/analyzer/test/generated/hint_code_test.dart

Issue 2643073002: 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 side-by-side diff with in-line comments
Download patch
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..d046870e02c53eed5b42310fd5bda25de398e81b 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -944,6 +944,78 @@ 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_implements() async {
+ Source source = addSource(r'''
+class A implements Function {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ HintCode.DEPRECATED_IMPLEMENTS_FUNCTION,
+ StaticWarningCode.FUNCTION_WITHOUT_CALL
+ ]);
+ verify([source]);
+ }
+
+ test_deprecatedFunction_implements2() async {
+ Source source = addSource(r'''
+class Function {}
+class A implements Function {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
+ HintCode.DEPRECATED_IMPLEMENTS_FUNCTION
+ ]);
+ verify([source]);
+ }
+
+ test_deprecatedFunction_mixin() async {
Brian Wilkerson 2017/01/19 18:16:05 Perhaps split this into two tests (one with and on
floitsch 2017/01/19 18:22:49 Done.
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698