Index: pkg/analyzer/test/generated/resolver_test.dart |
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart |
index 37c0d6bb90c03112f77ab6f27bee66ff39dfa908..738291692958af66976db6ddd7f651501281efd6 100644 |
--- a/pkg/analyzer/test/generated/resolver_test.dart |
+++ b/pkg/analyzer/test/generated/resolver_test.dart |
@@ -913,6 +913,23 @@ var v = const A('foo');'''); |
verify([source]); |
} |
+ void test_fieldTypeMismatch_generic() { |
+ Source source = addSource(r''' |
+class C<T> { |
+ final T x = y; |
+ const C(); |
+} |
+const y = 1; |
+var v = const C<String>(); |
+'''); |
+ resolve(source); |
+ assertErrors(source, [ |
+ CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH, |
+ HintCode.INVALID_ASSIGNMENT |
+ ]); |
+ verify([source]); |
+ } |
+ |
void test_fieldTypeMismatch_unresolved() { |
Source source = addSource(r''' |
class A { |
@@ -928,6 +945,20 @@ var v = const A('foo');'''); |
verify([source]); |
} |
+ void test_fieldTypeOk_generic() { |
+ Source source = addSource(r''' |
+class C<T> { |
+ final T x = y; |
+ const C(); |
+} |
+const y = 1; |
+var v = const C<int>(); |
+'''); |
+ resolve(source); |
+ assertErrors(source, [HintCode.INVALID_ASSIGNMENT]); |
+ verify([source]); |
+ } |
+ |
void test_fieldTypeOk_null() { |
Source source = addSource(r''' |
class A { |