5c0e0922d0
In order to address https://github.com/dart-lang/language/issues/731 (improved type inference for `fold` etc.) we're going to need to sometimes defer analysis of invocation arguments that are closures, so that closure parameters can have their types inferred based on other parameters. To avoid annoying the user with inconsistent behaviors, we defer analysis of closures in all circumstances, even if it's not necessary to do so for type inference purposes. This has a minor user-visible effect: if an invocation contains some closures and some non-closures, any demotions that happen due to write captures in the closures are postponed until the end of the invocation; this means that the write-captured variables remain promoted for other invocation arguments, even if those arguments appear after the closure. This is safe because there is no way for the closure to be called until after all of the other invocation arguments are evaluated. See the language tests in this CL for details. Note that this change only has an effect when the experimental feature `inference-update-1` is enabled. Change-Id: I283fc5eb07af2aeca0a06d523011d8c4617fbad7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237720 Reviewed-by: Samuel Rawlins <srawlins@google.com> Commit-Queue: Paul Berry <paulberry@google.com>