Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Issue 1555603002: Fix downwards inference for async and generator functions. (Closed)

Created:
4 years, 11 months ago by Leaf
Modified:
4 years, 11 months ago
Reviewers:
Bob Nystrom
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+359 lines, -52 lines) Patch
M pkg/analyzer/lib/src/generated/resolver.dart View 1 2 3 7 chunks +58 lines, -15 lines 0 comments Download
M pkg/analyzer/test/generated/resolver_test.dart View 1 2 3 25 chunks +301 lines, -37 lines 0 comments Download

Messages

Total messages: 7 (3 generated)
Leaf
4 years, 11 months ago (2015-12-29 22:41:34 UTC) #3
Bob Nystrom
lgtm https://codereview.chromium.org/1555603002/diff/40001/pkg/analyzer/lib/src/generated/resolver.dart File pkg/analyzer/lib/src/generated/resolver.dart (right): https://codereview.chromium.org/1555603002/diff/40001/pkg/analyzer/lib/src/generated/resolver.dart#newcode5435 pkg/analyzer/lib/src/generated/resolver.dart:5435: (_returnStack.isNotEmpty) ? _returnStack.last : null; Nit: the parentheses ...
4 years, 11 months ago (2015-12-30 01:03:39 UTC) #4
Leaf
https://codereview.chromium.org/1555603002/diff/40001/pkg/analyzer/lib/src/generated/resolver.dart File pkg/analyzer/lib/src/generated/resolver.dart (right): https://codereview.chromium.org/1555603002/diff/40001/pkg/analyzer/lib/src/generated/resolver.dart#newcode5435 pkg/analyzer/lib/src/generated/resolver.dart:5435: (_returnStack.isNotEmpty) ? _returnStack.last : null; On 2015/12/30 01:03:39, Bob ...
4 years, 11 months ago (2015-12-30 18:28:07 UTC) #5
Leaf
4 years, 11 months ago (2015-12-30 18:35:38 UTC) #7
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
a5addef3181bcf2576629d334aa6eb6a1322b425 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698