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

Issue 26745004: Implement type variable 'more specific than' and 'subtype'. (Closed)

Created:
7 years, 2 months ago by scheglov
Modified:
7 years, 2 months ago
Reviewers:
jwren, Brian Wilkerson
CC:
reviews_dartlang.org, lukeechurch_gmail.com
Visibility:
Public.

Description

Implement type variable 'more specific than' and 'subtype'. R=brianwilkerson@google.com, jwren@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=28457

Patch Set 1 #

Total comments: 7

Messages

Total messages: 5 (0 generated)
scheglov
7 years, 2 months ago (2013-10-10 00:08:38 UTC) #1
Brian Wilkerson
LGTM https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java File editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java (right): https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java#newcode105 editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java:105: if (s == DynamicTypeImpl.getInstance()) { Can we use ...
7 years, 2 months ago (2013-10-10 13:31:35 UTC) #2
scheglov
Committed patchset #1 manually as r28457 (presubmit successful).
7 years, 2 months ago (2013-10-10 15:19:36 UTC) #3
jwren
A few comments. Also, we should make sure that any warning generated on dart2js/sdk aren't ...
7 years, 2 months ago (2013-10-10 17:34:57 UTC) #4
scheglov
7 years, 2 months ago (2013-10-10 22:24:23 UTC) #5
Message was sent while issue was closed.
https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.goog...
File
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticTypeWarningCode.java
(right):

https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.goog...
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticTypeWarningCode.java:183:
TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND("'%s' cannot be a supertype of its upper
bound"),
On 2013/10/10 17:34:57, jwren wrote:
> This code and part of the spec are already covered by
> STWC.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS.  If the goal was to split this case
off
> of the other code, then the logic which generates it should also be converted
to
> use the new code. Also, if you do keep this one, do reference the other in the
> javadoc to make navigating the error codes easier.
> 

I've added @see references.
However "is a supertype of its upper bound" never reported before, so I'm not
sure what to convert.

https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.goog...
File
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java
(right):

https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.goog...
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java:193:
return upperBound.isMoreSpecificThan(s);
On 2013/10/10 17:34:57, jwren wrote:
> Shouldn't it be s.isMoreSpecificThan(upperBound)?

Hm... No.

<T extends B>, so T << B.
So, if B << S then also T << S.

But S << B  =>  T << S does not looks true for me.

For example B = num, T = int, S = double, but int << double is not correct.

https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.goog...
File
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
(right):

https://codereview.chromium.org/26745004/diff/1/editor/tools/plugins/com.goog...
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java:927:
checkForTypeArgumentNotMatchingBounds(node);
On 2013/10/10 17:34:57, jwren wrote:
> Can this call be unified with the new method
> checkForTypeParameterSupertypeOfItsBound() ?

Hm...
I remember I've tried to unify it with something, but it did not look good.
I think problem is that here we check usage of generic type, and
checkForTypeParameterSupertypeOfItsBound() checks its declaration.

Powered by Google App Engine
This is Rietveld 408576698