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

Issue 10417044: Type inference in if, while, for and for-in statements (Closed)

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

Description

Type inference in if, while, for and for-in statements R=messick@google.com,brianwilkerson@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=7914

Patch Set 1 #

Total comments: 18

Patch Set 2 : Changes for review comments #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+375 lines, -423 lines) Patch
M compiler/java/com/google/dart/compiler/resolver/Elements.java View 1 2 chunks +2 lines, -3 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java View 1 8 chunks +114 lines, -12 lines 2 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java View 1 6 chunks +163 lines, -33 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/.options View 1 1 chunk +0 lines, -1 line 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/DartCoreDebug.java View 1 1 chunk +0 lines, -1 line 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/completion/CompletionEngine.java View 5 chunks +1 line, -31 lines 0 comments Download
D editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/completion/TypeRefiner.java View 1 chunk +0 lines, -305 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java View 1 3 chunks +54 lines, -33 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/MockCompletionRequestor.java View 1 chunk +2 lines, -2 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/search/SearchEngineTest.java View 2 chunks +39 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
scheglov
8 years, 7 months ago (2012-05-23 00:54:32 UTC) #1
Brian Wilkerson
LGTM https://chromiumcodereview.appspot.com/10417044/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/10417044/diff/1/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java#newcode525 compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java:525: Elements.setType(element, inferredType); I don't know whether this is ...
8 years, 7 months ago (2012-05-23 14:11:16 UTC) #2
messick
LGTM This is great stuff. I think it will make a lot of people happier ...
8 years, 7 months ago (2012-05-23 15:05:50 UTC) #3
scheglov
https://chromiumcodereview.appspot.com/10417044/diff/1/compiler/java/com/google/dart/compiler/resolver/Elements.java File compiler/java/com/google/dart/compiler/resolver/Elements.java (left): https://chromiumcodereview.appspot.com/10417044/diff/1/compiler/java/com/google/dart/compiler/resolver/Elements.java#oldcode200 compiler/java/com/google/dart/compiler/resolver/Elements.java:200: ((VariableElementImplementation)element).setTypeInferred(true); On 2012/05/23 15:05:50, messick wrote: > Shouldn't "true" ...
8 years, 7 months ago (2012-05-23 16:32:30 UTC) #4
messick
https://chromiumcodereview.appspot.com/10417044/diff/6001/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java File compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (right): https://chromiumcodereview.appspot.com/10417044/diff/6001/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java#newcode545 compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java:545: if (inferredType != null && types.isSubtype(inferredType, currentType)) { I'm ...
8 years, 7 months ago (2012-05-23 16:55:53 UTC) #5
scheglov
https://chromiumcodereview.appspot.com/10417044/diff/6001/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java File compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (right): https://chromiumcodereview.appspot.com/10417044/diff/6001/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java#newcode545 compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java:545: if (inferredType != null && types.isSubtype(inferredType, currentType)) { On ...
8 years, 7 months ago (2012-05-23 22:50:00 UTC) #6
messick
8 years, 7 months ago (2012-05-23 23:11:50 UTC) #7
On 2012/05/23 22:50:00, scheglov wrote:
>
https://chromiumcodereview.appspot.com/10417044/diff/6001/compiler/java/com/g...
> File compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (right):
> 
>
https://chromiumcodereview.appspot.com/10417044/diff/6001/compiler/java/com/g...
> compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java:545: if
> (inferredType != null && types.isSubtype(inferredType, currentType)) {
> On 2012/05/23 16:55:53, messick wrote:
> > I'm not sure you can compute this incrementally, but perhaps I'm mis-reading
> the
> > code. If I try to do code completion on this example (at the !) I should get
> > proposals for Dynamic, not List:
> > 
> > var x;
> > if ((x is List) && (x is String)) {
> >   x.!
> > }
> 
> Actually the best Type would be some artificial Type which is at same time
List
> and String.
> This is possible because List and String are interfaces.
> But implementation of this would be not so easy.

Right; we need a type system based on set theory. You, Brian, and I should talk
about that when you're in town next time. It's easier (for me) with a
whiteboard.

Powered by Google App Engine
This is Rietveld 408576698