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

Issue 2873813002: Implement type inference of method invocations in Fasta. (Closed)

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

Description

Implement type inference of method invocations in Fasta. R=scheglov@google.com Committed: https://github.com/dart-lang/sdk/commit/6e499b16cf7dbf3332d134999b35ece30d23bb65

Patch Set 1 #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+424 lines, -42 lines) Patch
M pkg/front_end/front_end.iml View 1 chunk +1 line, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart View 3 chunks +38 lines, -15 lines 0 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart View 9 chunks +156 lines, -11 lines 10 comments Download
M pkg/front_end/test/fasta/strong.status View 4 chunks +0 lines, -12 lines 0 comments Download
M pkg/front_end/testcases/inference/infer_binary_custom.dart View 1 chunk +5 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/infer_binary_custom.dart.strong.expect View 1 chunk +19 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/infer_generic_method_type_named.dart.strong.expect View 1 chunk +14 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/infer_generic_method_type_positional.dart.strong.expect View 1 chunk +14 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/infer_generic_method_type_positional2.dart.strong.expect View 1 chunk +14 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/infer_prefix_expression_custom.dart View 1 chunk +6 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/infer_prefix_expression_custom.dart.strong.expect View 1 chunk +21 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/inferred_type_custom_binary_op.dart View 1 chunk +6 lines, -1 line 0 comments Download
A pkg/front_end/testcases/inference/inferred_type_custom_binary_op.dart.strong.expect View 1 chunk +17 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/inferred_type_custom_binary_op_via_interface.dart View 1 chunk +4 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/inferred_type_custom_binary_op_via_interface.dart.strong.expect View 1 chunk +21 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/inferred_type_custom_index_op.dart View 1 chunk +1 line, -1 line 0 comments Download
A pkg/front_end/testcases/inference/inferred_type_custom_index_op.dart.strong.expect View 1 chunk +15 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/inferred_type_custom_index_op_via_interface.dart View 1 chunk +3 lines, -1 line 0 comments Download
A pkg/front_end/testcases/inference/inferred_type_custom_index_op_via_interface.dart.strong.expect View 1 chunk +21 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/inferred_type_custom_unary_op.dart View 1 chunk +6 lines, -1 line 0 comments Download
A pkg/front_end/testcases/inference/inferred_type_custom_unary_op.dart.strong.expect View 1 chunk +17 lines, -0 lines 0 comments Download
M pkg/front_end/testcases/inference/inferred_type_custom_unary_op_via_interface.dart View 1 chunk +4 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/inferred_type_custom_unary_op_via_interface.dart.strong.expect View 1 chunk +21 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (2 generated)
Paul Berry
3 years, 7 months ago (2017-05-09 23:03:24 UTC) #2
scheglov
LGTM https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart File pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart (right): https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart#newcode414 pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart:414: /// is the name fo the method. [explicitTypeArguments] ...
3 years, 7 months ago (2017-05-09 23:45:57 UTC) #3
Paul Berry
Committed patchset #1 (id:1) manually as 6e499b16cf7dbf3332d134999b35ece30d23bb65 (presubmit successful).
3 years, 7 months ago (2017-05-09 23:51:09 UTC) #5
Leaf
https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart File pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart (right): https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart#newcode432 pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart:432: // inferConstructorInvocation? The specification is definitely intended to treat ...
3 years, 7 months ago (2017-05-10 04:23:10 UTC) #6
Paul Berry
3 years, 7 months ago (2017-05-10 16:24:29 UTC) #7
Message was sent while issue was closed.
https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta...
File pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart (right):

https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart:414: /// is the
name fo the method.  [explicitTypeArguments] is the set of type
On 2017/05/09 23:45:57, scheglov wrote:
> /fo/of/s

Done.

https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart:432: //
inferConstructorInvocation?
On 2017/05/10 04:23:09, Leaf wrote:
> The specification is definitely intended to treat these equivalently.  That
is,
> a constructor call is just like a call to a static function with the
appropriate
> generic type signature.

Acknowledged.  The TODO comment is mostly because I wanted to get stuff working
before I was sure exactly what code should be shared.  I'll refactor this stuff
in a follow-up CL.

https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart:459:
Substitution.fromPairs(memberTypeParameters, inferredTypes);
On 2017/05/10 04:23:09, Leaf wrote:
> Is this right?  Looking at class Substitution from kernel, it doesn't look
like
> it does anything reasonable with a null inferredTypes.  Should this be
> explicitTypeArguments?

Whoops, you're right.  I wonder why this didn't cause any exceptions in my test
runs--I'll investigate and follow up with a fix.

https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart:587: FunctionType
_getCalleeFunctionType(DartType receiverType, Name methodName) {
On 2017/05/10 04:23:09, Leaf wrote:
> Surely this should be factored out somewhere?  Or does nothing else really
ever
> need to do this after inference has happened (presumably because the type is
> attached to the node or somesuch)?

Hmm, I'm not sure.  Kernel has a slot for interfaceTarget which I'm not yet
filling.  Presumably once I fill it, it will carry enough information so that
clients can derive whatever information they need.

I'll investigate and follow up.

https://codereview.chromium.org/2873813002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart:628: //
TODO(paulberry): is there a kernel function that does this binary search?
On 2017/05/10 04:23:09, Leaf wrote:
> There's just got to be...otherwise something is very wrong.

I dug a little deeper and all I've found is see some code in
TypeCheckingVisitor.handleFunctionCall that does a linear search.  I'll make a
follow up CL that moves the binary search into kernel and refactors
TypeCheckingVisitor.handleFunctionCall to use it.

Powered by Google App Engine
This is Rietveld 408576698