fix #27363, support @checked on fields

Just needed to have the synthetic setter param look for metadata on the field.

R=leafp@google.com

Review URL: https://codereview.chromium.org/2346143003 .
This commit is contained in:
John Messerly 2016-09-16 18:20:23 -07:00
parent 86ae2c8df9
commit 70f6e16c97
2 changed files with 27 additions and 0 deletions

View file

@ -7197,6 +7197,19 @@ class ParameterElementImpl_ofImplicitSetter extends ParameterElementImpl {
parameterKind = ParameterKind.REQUIRED;
}
@override
bool get isCovariant {
if (inheritsCovariant) {
return true;
}
for (ElementAnnotationImpl annotation in setter.variable.metadata) {
if (annotation.isCovariant) {
return true;
}
}
return false;
}
@override
DartType get type => setter.variable.type;

View file

@ -532,6 +532,20 @@ class G_error extends E implements D {
''');
}
void test_covariantOverride_fields() {
_addMetaLibrary();
checkFile(r'''
import 'meta.dart';
class A {
get foo => '';
set foo(_) {}
}
class B extends A {
@checked int foo;
}
''');
}
void test_covariantOverride_leastUpperBound() {
_addMetaLibrary();
checkFile(r'''