From 72f1c288bc7280f7eae77f717f13caf75cd53440 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Fri, 14 Jul 2023 00:24:07 +0000 Subject: [PATCH] [dart2js] Bailout tracing when hitting return values of async members. When tracing closures, we accidentally ignored the fact that returning from a non-async function allows the value to flow in other ways (e.g. through the completion of a future). This changes the node tracer to always consider the async marker when looking at values that flow into 'MemberInformation' information nodes, which are the nodes we use to represent the returned value of a method. Fixes #52825 Change-Id: I3322e105dc9612f47a516a17f9465bf1002a9f87 Fixed: 52825 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312708 Commit-Queue: Sigmund Cherem Reviewed-by: Stephen Adams Reviewed-by: Nate Biggs --- pkg/compiler/lib/src/inferrer/node_tracer.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/compiler/lib/src/inferrer/node_tracer.dart b/pkg/compiler/lib/src/inferrer/node_tracer.dart index 058042cf0f3..736bf560552 100644 --- a/pkg/compiler/lib/src/inferrer/node_tracer.dart +++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart @@ -564,6 +564,9 @@ abstract class TracerVisitor implements TypeInformationVisitor { return cls != null && cls.isClosure; } + bool isAsync(MemberEntity element) => + element is FunctionEntity && element.asyncMarker == AsyncMarker.ASYNC; + @override void visitMemberTypeInformation(MemberTypeInformation info) { if (info.isClosurized) { @@ -572,6 +575,9 @@ abstract class TracerVisitor implements TypeInformationVisitor { if (isClosure(info.member)) { bailout('Returned from a closure'); } + if (isAsync(info.member)) { + bailout('Returned from an async method'); + } final member = info.member; if (member is FieldEntity &&