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

Issue 11271041: Issue 6399. Don't fall back to 'dynamic' when variable has explicit type. (Closed)

Created:
8 years, 1 month ago by scheglov
Modified:
8 years, 1 month ago
Reviewers:
Brian Wilkerson
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Issue 6399. Don't fall back to 'dynamic' when variable has explicit type. http://code.google.com/p/dart/issues/detail?id=6399 R=brianwilkerson@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=14306

Patch Set 1 #

Total comments: 3

Patch Set 2 : Use union of types #

Unified diffs Side-by-side diffs Delta from patch set Stats (+60 lines, -16 lines) Patch
M compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java View 1 2 chunks +18 lines, -12 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/Types.java View 1 1 chunk +8 lines, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java View 1 3 chunks +34 lines, -3 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
scheglov
8 years, 1 month ago (2012-10-30 18:40:06 UTC) #1
Brian Wilkerson
https://codereview.chromium.org/11271041/diff/1/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java File compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java (right): https://codereview.chromium.org/11271041/diff/1/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java#newcode2798 compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java:2798: assertInferredElementTypeString(testUnit, "v1", "B"); This looks wrong. I think v1 ...
8 years, 1 month ago (2012-10-30 18:46:41 UTC) #2
scheglov
https://codereview.chromium.org/11271041/diff/1/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java File compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java (right): https://codereview.chromium.org/11271041/diff/1/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java#newcode2798 compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java:2798: assertInferredElementTypeString(testUnit, "v1", "B"); On 2012/10/30 18:46:41, Brian Wilkerson wrote: ...
8 years, 1 month ago (2012-10-30 19:47:57 UTC) #3
Brian Wilkerson
8 years, 1 month ago (2012-10-30 20:05:55 UTC) #4
LGTM

https://codereview.chromium.org/11271041/diff/1/compiler/javatests/com/google...
File
compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
(right):

https://codereview.chromium.org/11271041/diff/1/compiler/javatests/com/google...
compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java:2798:
assertInferredElementTypeString(testUnit, "v1", "B");
> 1. There are no reason to replace in v1 case more specific type B with less
> specific A.

I see. I missed the subtype relationship. You're right.

> 2. If we will set type of v4 to String, then we generate warnings for
accessing
> members of B. We need actually union of these types.

Agreed, but in the absence of support for union types I still think String would
be the better type to infer because we know that the run-time type of v4 must be
String. Nevertheless, you can leave it if you want.

Powered by Google App Engine
This is Rietveld 408576698