File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
pkg/dev_compiler/lib/src/kernel Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3316,10 +3316,15 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
33163316 // In the body of an `async`, `await` is generated simply as `yield`.
33173317 var gen = emitGeneratorFn ((_) => []);
33183318 // Return type of an async body is `Future<flatten(T)>`, where T is the
3319- // declared return type.
3320- var returnType = _types.flatten (function
3319+ // declared return type, unless T is Object. In that case the Object refers
3320+ // to a return type of `Future<Object?>`.
3321+ // TODO(nshahan) Use the Future type value when available on a FunctionNode.
3322+ var declaredReturnType = function
33213323 .computeThisFunctionType (_currentLibrary.nonNullable)
3322- .returnType);
3324+ .returnType;
3325+ var returnType = _coreTypes.isObject (declaredReturnType)
3326+ ? _coreTypes.objectNullableRawType
3327+ : _types.flatten (declaredReturnType);
33233328 return js.call ('#.async(#, #)' ,
33243329 [emitLibraryName (_coreTypes.asyncLibrary), _emitType (returnType), gen]);
33253330 }
You can’t perform that action at this time.
0 commit comments