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

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

Issue 1436433002: Issue 24751. Report a compile time error when @static_field is used with arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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.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/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 743399e0a9a458a8df5142dfc746d3127cdc64f5..851a4ee69047ad753d280cbedd668fa751bf81b3 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -222,6 +222,46 @@ class N {}''');
verify([source]);
}
+ void test_annotationWithNotClass() {
+ Source source = addSource('''
+class Property {
+ final int value;
+ const Property(this.value);
+}
+
+const Property property = const Property(42);
+
+@property(123)
+main() {
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
+ verify([source]);
+ }
+
+ void test_annotationWithNotClass_prefixed() {
+ addNamedSource(
+ "/annotations.dart",
+ r'''
+class Property {
+ final int value;
+ const Property(this.value);
+}
+
+const Property property = const Property(42);
+''');
+ Source source = addSource('''
+import 'annotations.dart' as pref;
+@pref.property(123)
+main() {
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
+ verify([source]);
+ }
+
void test_async_used_as_identifier_in_annotation() {
Source source = addSource('''
const int async = 0;
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698