mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:01:30 +00:00
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:
parent
86ae2c8df9
commit
70f6e16c97
2 changed files with 27 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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'''
|
||||
|
|
Loading…
Reference in a new issue