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:
committed by
commit-bot@chromium.org
parent
0566f5fa27
commit
9d150c6443
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user