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

Issue 10459070: Infer also field types in classes and top-level (Closed)

Created:
8 years, 6 months ago by scheglov
Modified:
8 years, 6 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Infer also field types in classes and top-level R=brianwilkerson@google.com,pquitslund@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=8206

Patch Set 1 #

Total comments: 7

Patch Set 2 : Use Type.isInferred() #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+200 lines, -159 lines) Patch
M compiler/java/com/google/dart/compiler/LibraryDepsVisitor.java View 6 chunks +23 lines, -5 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/DynamicElementImplementation.java View 1 chunk +0 lines, -5 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Elements.java View 1 chunk +0 lines, -3 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Resolver.java View 1 3 chunks +9 lines, -3 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/VariableElement.java View 2 chunks +0 lines, -7 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java View 1 3 chunks +1 line, -11 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/AbstractType.java View 1 1 chunk +4 lines, -0 lines 1 comment Download
M compiler/java/com/google/dart/compiler/type/InferredType.java View 1 1 chunk +0 lines, -34 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/Type.java View 1 1 chunk +6 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java View 1 10 chunks +32 lines, -33 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/Types.java View 1 4 chunks +37 lines, -0 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java View 1 17 chunks +88 lines, -58 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
scheglov
8 years, 6 months ago (2012-06-01 04:08:10 UTC) #1
Brian Wilkerson
https://chromiumcodereview.appspot.com/10459070/diff/1/compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java File compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java (right): https://chromiumcodereview.appspot.com/10459070/diff/1/compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java#newcode1 compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java:1: // Copyright (c) 2011, the Dart project authors. Please ...
8 years, 6 months ago (2012-06-01 14:20:25 UTC) #2
scheglov
https://chromiumcodereview.appspot.com/10459070/diff/1/compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java File compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java (right): https://chromiumcodereview.appspot.com/10459070/diff/1/compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java#newcode1 compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java:1: // Copyright (c) 2011, the Dart project authors. Please ...
8 years, 6 months ago (2012-06-01 15:11:34 UTC) #3
Brian Wilkerson
LGTM https://chromiumcodereview.appspot.com/10459070/diff/1/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java File compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (right): https://chromiumcodereview.appspot.com/10459070/diff/1/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java#newcode479 compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java:479: if (isInferredType(variableType) && !types.isAssignable(variableType, rhs)) { > For ...
8 years, 6 months ago (2012-06-01 16:15:36 UTC) #4
pquitslund
LGTM. Thanks for pushing on this. It will make our semantic highlighting of refinable types ...
8 years, 6 months ago (2012-06-01 17:31:38 UTC) #5
scheglov
> Agreed. But for error checking we need to use the declared types. And as ...
8 years, 6 months ago (2012-06-01 18:26:33 UTC) #6
Brian Wilkerson
8 years, 6 months ago (2012-06-01 18:43:49 UTC) #7
>   So, "var" and "Dynamic" are the same.

Yes, they are semantically the same. Yes, dartc has one representation that it
uses in both cases.

But I wonder whether they are the same in the mind of our users. Personally I
think it might not be. I can easily imagine using "var" when I want to (or am
willing to) get inferred type suggestions and using "Dynamic" when I don't. I
don't know how our users feel about this though.

>   Well, we always can have back reference on "declaration" type.
>   Just have not just isInferred() but also getDeclarationType() in Type.

Interesting suggestion. I think I like it, but would like to think through the
implications a bit.

Powered by Google App Engine
This is Rietveld 408576698