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

Issue 2935323002: Lift nearly all top-level type inference restrictions. (Closed)

Created:
3 years, 6 months ago by Paul Berry
Modified:
3 years, 6 months ago
Reviewers:
Leaf, ahe, scheglov
CC:
reviews_dartlang.org, dart-fe-team+reviews_google.com
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Lift nearly all top-level type inference restrictions. This CL lifts all of the restrictions on top level type inference except for one: the restriction that expressions used for top level type inference cannot depend on the types of instance getters, instance setters, or instance fields. (That restriction will be lifted in a later CL). The technique is: to determine the dependencies of an expression, rather than recurse through the expression applying the rules for what constitutes an "immediately evident" expression, we simply do a dry run of the inference algorithm and record what static fields were accessed. To avoid recording bogus dependencies on fields whose type doesn't matter, this dry run skips subexpressions whose type isn't needed. To facilitate experimentation, I've left the old code in place, but disabled it using a const bool `extendedTopLevelInference`. The old code can be re-enabled by setting this bool to `false`. Once we are sure that we want to proceed with this approach, we can remove the old code. Note that this makes the behavior begin to diverge with analyzer behavior, so I've created a new test directory: pkg/front_end/testcases/inference_new/, to hold test cases which aren't expected to match analyzer. Analyzer is only tested against the test cases in pkg/front_end/testcases/inference/. R=scheglov@google.com Committed: https://github.com/dart-lang/sdk/commit/44f19d1a602b5224b9cdad74e8843166ae14d84a

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+272 lines, -49 lines) Patch
M pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart View 8 chunks +76 lines, -10 lines 0 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart View 3 chunks +34 lines, -4 lines 0 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart View 5 chunks +15 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart View 6 chunks +38 lines, -3 lines 0 comments Download
M pkg/front_end/test/fasta/kompile.status View 1 chunk +2 lines, -0 lines 0 comments Download
M pkg/front_end/test/fasta/strong.status View 1 chunk +0 lines, -2 lines 0 comments Download
D pkg/front_end/testcases/inference/infer_assign_to_index.dart View 1 chunk +0 lines, -12 lines 0 comments Download
D pkg/front_end/testcases/inference/infer_assign_to_index.dart.strong.expect View 1 chunk +0 lines, -7 lines 0 comments Download
M pkg/front_end/testcases/inference/infer_assign_to_ref.dart View 1 chunk +0 lines, -2 lines 0 comments Download
M pkg/front_end/testcases/inference/infer_assign_to_ref.dart.strong.expect View 1 chunk +0 lines, -2 lines 0 comments Download
M pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart View 1 chunk +2 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect View 1 chunk +53 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/inferred_type_cascade.dart View 1 chunk +2 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/inferred_type_cascade.dart.strong.expect View 1 chunk +14 lines, -0 lines 0 comments Download
A + pkg/front_end/testcases/inference_new/infer_assign_to_index.dart View 1 chunk +1 line, -2 lines 0 comments Download
A + pkg/front_end/testcases/inference_new/infer_assign_to_index.dart.direct.expect View 1 chunk +1 line, -1 line 0 comments Download
A pkg/front_end/testcases/inference_new/infer_assign_to_index.dart.outline.expect View 1 chunk +8 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference_new/infer_assign_to_index.dart.strong.expect View 1 chunk +7 lines, -0 lines 0 comments Download
A + pkg/front_end/testcases/inference_new/infer_assign_to_ref.dart View 1 chunk +1 line, -1 line 0 comments Download
A + pkg/front_end/testcases/inference_new/infer_assign_to_ref.dart.direct.expect View 1 chunk +2 lines, -2 lines 0 comments Download
A pkg/front_end/testcases/inference_new/infer_assign_to_ref.dart.outline.expect View 1 chunk +15 lines, -0 lines 0 comments Download
A + pkg/front_end/testcases/inference_new/infer_assign_to_ref.dart.strong.expect View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5 (2 generated)
Paul Berry
Background info for Konstantin and Peter: Today Leaf, Florian, and Kevin asked me to experiment ...
3 years, 6 months ago (2017-06-14 21:51:51 UTC) #2
scheglov
LGTM
3 years, 6 months ago (2017-06-14 22:16:58 UTC) #3
Paul Berry
3 years, 6 months ago (2017-06-15 03:34:12 UTC) #5
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
44f19d1a602b5224b9cdad74e8843166ae14d84a (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698