mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
Avoid a downcast error
The field that we use to hold redirecting constructors is a Kernel field, and not a ShadowField. Fixes https://github.com/dart-lang/sdk/issues/34715 Change-Id: Iea2ce41f0229a7b9c2354bf3c6c3b586a3ffec33 Reviewed-on: https://dart-review.googlesource.com/c/78540 Reviewed-by: Peter von der Ahé <ahe@google.com> Reviewed-by: Daniel Hillerström <hillerstrom@google.com> Commit-Queue: Kevin Millikin <kmillikin@google.com>
This commit is contained in:
parent
0566f5fa27
commit
9d150c6443
1 changed files with 3 additions and 2 deletions
|
@ -8,6 +8,7 @@ import 'package:kernel/ast.dart'
|
|||
DartType,
|
||||
DartTypeVisitor,
|
||||
DynamicType,
|
||||
Field,
|
||||
FunctionType,
|
||||
InterfaceType,
|
||||
TypeParameter,
|
||||
|
@ -278,9 +279,9 @@ abstract class TypeInferenceEngine {
|
|||
|
||||
void inferInitializingFormal(VariableDeclaration formal, Constructor parent) {
|
||||
if (formal.type == null) {
|
||||
for (ShadowField field in parent.enclosingClass.fields) {
|
||||
for (Field field in parent.enclosingClass.fields) {
|
||||
if (field.name.name == formal.name) {
|
||||
if (field.inferenceNode != null) {
|
||||
if (field is ShadowField && field.inferenceNode != null) {
|
||||
field.inferenceNode.resolve();
|
||||
}
|
||||
formal.type = field.type;
|
||||
|
|
Loading…
Reference in a new issue