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

Issue 2828693003: Add local type inference logic for integer literals. (Closed)

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

Description

Add local type inference logic for integer literals. This CL introduces Fasta's first type inference rule, and hooks it up to all the necessary testing infrastructure. The rule is that a local variable whose initializer is an integer literal should have an inferred type of int. Only variables occurring at top level within a method are inferred (we don't yet recurse inside sub-blocks). Additional type inference rules will be added in follow-up CLs. R=ahe@google.com Committed: https://github.com/dart-lang/sdk/commit/e8e8359cdf7039b562ea8c4541625f93db763a0e

Patch Set 1 #

Patch Set 2 : Sort declarations #

Total comments: 4

Patch Set 3 : Address code review comments #

Patch Set 4 : Minor clean-ups #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+129 lines, -41 lines) Patch
M pkg/front_end/lib/src/fasta/builder/ast_factory.dart View 1 chunk +2 lines, -1 line 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/body_builder.dart View 1 2 9 chunks +20 lines, -16 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart View 2 chunks +4 lines, -2 lines 3 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart View 3 chunks +15 lines, -8 lines 0 comments Download
M pkg/front_end/lib/src/fasta/source/diet_listener.dart View 2 chunks +5 lines, -1 line 0 comments Download
M pkg/front_end/lib/src/fasta/source/source_loader.dart View 1 2 4 chunks +10 lines, -5 lines 0 comments Download
M pkg/front_end/lib/src/fasta/testing/kernel_chain.dart View 1 chunk +5 lines, -2 lines 0 comments Download
M pkg/front_end/lib/src/fasta/testing/suite.dart View 1 2 1 chunk +8 lines, -5 lines 0 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart View 1 1 chunk +27 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/int_upwards_local.dart View 1 2 3 1 chunk +8 lines, -0 lines 2 comments Download
A pkg/front_end/testcases/inference/int_upwards_local.dart.dartk.expect View 1 chunk +6 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/int_upwards_local.dart.direct.expect View 1 chunk +6 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/int_upwards_local.dart.outline.expect View 1 chunk +5 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/int_upwards_local.dart.strong.expect View 1 chunk +7 lines, -0 lines 2 comments Download
M pkg/kernel/test/closures/suite.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 9 (2 generated)
Paul Berry
3 years, 8 months ago (2017-04-19 14:28:55 UTC) #2
ahe
https://codereview.chromium.org/2828693003/diff/20001/pkg/front_end/lib/src/fasta/target_implementation.dart File pkg/front_end/lib/src/fasta/target_implementation.dart (right): https://codereview.chromium.org/2828693003/diff/20001/pkg/front_end/lib/src/fasta/target_implementation.dart#newcode22 pkg/front_end/lib/src/fasta/target_implementation.dart:22: final bool strongMode; Why is this needed? https://codereview.chromium.org/2828693003/diff/20001/pkg/front_end/testcases/inference/int_upwards_local.dart File ...
3 years, 8 months ago (2017-04-20 08:36:42 UTC) #3
Paul Berry
https://codereview.chromium.org/2828693003/diff/20001/pkg/front_end/lib/src/fasta/target_implementation.dart File pkg/front_end/lib/src/fasta/target_implementation.dart (right): https://codereview.chromium.org/2828693003/diff/20001/pkg/front_end/lib/src/fasta/target_implementation.dart#newcode22 pkg/front_end/lib/src/fasta/target_implementation.dart:22: final bool strongMode; On 2017/04/20 08:36:42, ahe wrote: > ...
3 years, 8 months ago (2017-04-20 08:55:29 UTC) #4
ahe
lgtm https://codereview.chromium.org/2828693003/diff/60001/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart File pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart (right): https://codereview.chromium.org/2828693003/diff/60001/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart#newcode44 pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart:44: int charOffset = TreeNode.noOffset, Perhaps this should be ...
3 years, 8 months ago (2017-04-20 09:45:29 UTC) #5
Paul Berry
https://codereview.chromium.org/2828693003/diff/60001/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart File pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart (right): https://codereview.chromium.org/2828693003/diff/60001/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart#newcode44 pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart:44: int charOffset = TreeNode.noOffset, On 2017/04/20 09:45:29, ahe wrote: ...
3 years, 8 months ago (2017-04-20 09:52:57 UTC) #6
Paul Berry
Committed patchset #4 (id:60001) manually as e8e8359cdf7039b562ea8c4541625f93db763a0e (presubmit successful).
3 years, 8 months ago (2017-04-20 10:36:25 UTC) #8
ahe
3 years, 8 months ago (2017-04-20 11:38:24 UTC) #9
Message was sent while issue was closed.
https://codereview.chromium.org/2828693003/diff/60001/pkg/front_end/lib/src/f...
File pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart (right):

https://codereview.chromium.org/2828693003/diff/60001/pkg/front_end/lib/src/f...
pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart:44: int charOffset =
TreeNode.noOffset,
On 2017/04/20 09:52:57, Paul Berry wrote:
> On 2017/04/20 09:45:29, ahe wrote:
> > Perhaps this should be a required parameter?
> 
> I don't know--does it make sense for a variableDeclaration to always have a
> charOffset?  It seems to me like it does, but there are two callers that don't
> supply one (BodyBuilder.endFunctionName and BodyBuilder.pushNewLocalVariable),
> so I'm not really sure what the story is there.

I think both of those are mistakes that would be caught by making this parameter
required :-)

Powered by Google App Engine
This is Rietveld 408576698