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

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

Issue 2045353002: @required support for super and redirecting cons (#26642). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: FunctionExpressionInvocations Created 4 years, 6 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 77b127fe4ca8a12414c1c1879e0015a818363cb4..0c3e3f60a7a036b05e94f89f41ffd5609c9c70e7 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -1830,6 +1830,37 @@ main() {
verify([source]);
}
+ void test_required_constructor_param_redirecting_cons_call() {
+ Source source = addSource(r'''
+import 'package:meta/meta.dart';
+
+class C {
+ C({@required int x});
+ C.named() : this();
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
+ verify([source]);
+ }
+
+ void test_required_constructor_param_super_call() {
+ Source source = addSource(r'''
+import 'package:meta/meta.dart';
+
+class C {
+ C({@Required('must specify an `a`') int a}) {}
+}
+
+class D extends C {
+ D() : super();
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
+ verify([source]);
+ }
+
void test_required_function_param() {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1883,6 +1914,23 @@ f() {
verify([source]);
}
+ void test_required_typedef_function_param() {
+ Source source = addSource(r'''
+import 'package:meta/meta.dart';
+
+String test(C c) => c.m()();
+
+typedef String F({@required String x});
+
+class C {
+ F m() => ({@required String x}) => null;
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
+ verify([source]);
+ }
+
void test_typeCheck_type_is_Null() {
Source source = addSource(r'''
m(i) {
« 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