DescriptionFix strong mode downwards inference for async and generator functions.
Downwards inference pushes the declared return type of a function down into the body in order to infer types for the returned or yielded values. The asynchronous and generator cases were not being fully handled correctly.
This CL changes the return context stack kept by the inference context to contain the type expected to be returned or yielded (rather than the declared return type). At each return/yield statement, this return/yield type is used to infer types for the returned/yielded expression. At each yield* statement, the return/yield type is wrapped into the appropriate stream/iterable type.
This CL also adds future flattening when doing downwards inference on awaited expressions to avoid inferring nested future types.
BUG=
R=rnystrom@google.com
Committed: https://github.com/dart-lang/sdk/commit/a5addef3181bcf2576629d334aa6eb6a1322b425
Patch Set 1 #Patch Set 2 : #Patch Set 3 : #
Total comments: 14
Patch Set 4 : Address comments #
Messages
Total messages: 7 (3 generated)
|