|
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
|
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
|
Total messages: 5 (2 generated)
|