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

Issue 2849293002: Infer types of bool/null/string literals. (Closed)

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

Description

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+192 lines, -10 lines) Patch
M pkg/front_end/lib/src/fasta/builder/ast_factory.dart View 2 chunks +10 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/body_builder.dart View 4 chunks +10 lines, -10 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart View 2 chunks +17 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart View 2 chunks +34 lines, -0 lines 2 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart View 2 chunks +16 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_bool.dart View 1 chunk +12 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_bool.dart.direct.expect View 1 chunk +7 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_bool.dart.outline.expect View 1 chunk +6 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_bool.dart.strong.expect View 1 chunk +8 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_null.dart View 1 chunk +12 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_null.dart.direct.expect View 1 chunk +7 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_null.dart.outline.expect View 1 chunk +6 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_null.dart.strong.expect View 1 chunk +7 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_string.dart View 1 chunk +14 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_string.dart.direct.expect View 1 chunk +9 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_string.dart.outline.expect View 1 chunk +7 lines, -0 lines 0 comments Download
A pkg/front_end/testcases/inference/simple_literal_string.dart.strong.expect View 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
scheglov
3 years, 7 months ago (2017-05-01 21:54:50 UTC) #1
Paul Berry
lgtm https://codereview.chromium.org/2849293002/diff/1/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart File pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart (right): https://codereview.chromium.org/2849293002/diff/1/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart#newcode247 pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart:247: return inferrer.inferStringLiteral(typeContext, typeNeeded); This works for now, but ...
3 years, 7 months ago (2017-05-01 22:03:44 UTC) #2
scheglov
Committed patchset #1 (id:1) manually as 6885aea0dbd9d856da4f697ca69fd62a2b26b74e (presubmit successful).
3 years, 7 months ago (2017-05-02 02:33:39 UTC) #4
scheglov
3 years, 7 months ago (2017-05-02 02:35:21 UTC) #5
Message was sent while issue was closed.
https://codereview.chromium.org/2849293002/diff/1/pkg/front_end/lib/src/fasta...
File pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart (right):

https://codereview.chromium.org/2849293002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart:247: return
inferrer.inferStringLiteral(typeContext, typeNeeded);
On 2017/05/01 22:03:44, Paul Berry wrote:
> This works for now, but in the long run it will need to recurse into the
> subexpressions in order to handle stuff like:
> 
> f(x) {
>   if (x is int) {
>     return "$x"; // (1)
>   }
> }
> 
> (the kernel object for the reference to `x` at (1) needs to have its
> promotedType field set to `int`, and that will only happen if we recurse into
> the subexpression).
> 
> Would you mind adding a TODO comment?

Done.
I ended up removing testing for StringConcatenation at all, because with
analyzer we do report the promoted type, but not in front_end yet.

Powered by Google App Engine
This is Rietveld 408576698