[dart2wasm] Fix invalid closure return type in async* lowering

dart2wasm lowering of async* methods includes call to Stream.where
which takes a closure. The return type of that closure was incorrectly
set to Object?, while it should be bool.

This incorrect static type becomes a problem with more precise
handling of closures in TFA.

Issue: https://github.com/dart-lang/sdk/issues/39692
Change-Id: I35a8a6b198413d564e091a935a8beaff15d6d541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This commit is contained in:
Alexander Markov
2023-12-01 14:06:18 +00:00
committed by Commit Queue
parent 0310e41f2c
commit 927091e8ac
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -590,7 +590,7 @@ class _WasmTransformer extends Transformer {
ReturnStatement(VariableGet(whereKeep)),
]),
positionalParameters: [whereFilterArg],
returnType: coreTypes.objectNullableRawType));
returnType: coreTypes.boolNonNullableRawType));
Procedure whereProc =
coreTypes.index.getProcedure('dart:async', 'Stream', 'where');
@@ -104,7 +104,7 @@ static method asyncMethod(asy::Stream<core::int> stream) → asy::Stream<core::i
if(!#isEven)
value.{asy::Completer::complete}(#C2){([FutureOr<core::bool>?]) → void};
return value;
}){((core::Object?) → FutureOr<core::Object?>) → asy::Stream<core::Object?>}.{asy::Stream::where}((synthesized core::Object? value) → core::Object? {
}){((core::Object?) → FutureOr<core::Object?>) → asy::Stream<core::Object?>}.{asy::Stream::where}((synthesized core::Object? value) → core::bool {
if(#isFirst) {
#isFirst = #C1;
return #C1;