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

Issue 1686893002: Consolidate the code that replaces a TypeParameter with its bound. (Closed)

Created:
4 years, 10 months ago by Bob Nystrom
Modified:
4 years, 10 months ago
CC:
reviews_dartlang.org
Base URL:
https://github.com/dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Consolidate the code that replaces a TypeParameter with its bound. In the process, I fixed a bug where one version of this same lump of code wasn't correct anymore now that you can have arbitrarily long chains of type parameters. DartType isn't maybe the ideal place for resolveToBound(). I wanted it somewhere that: 1. Would be obvious enough that someone coming along later would discover it instead of reinventing it again. 2. Had access to the various data it needs. 3. Wouldn't need a "is TypeParameterType" guard at every callsite before it could be used. I could put it on TypeProvider instead, since it needs access to Object, but that felt arbitrary. It could be a top level function, but then I don't think it would be very discoverable. R=brianwilkerson@google.com, jmesserly@google.com Committed: https://github.com/dart-lang/sdk/commit/e19c6dd79d3edb0cf805c62d18cdb5e4ed3e4950

Patch Set 1 #

Total comments: 9

Patch Set 2 : Revise. #

Patch Set 3 : Add unit tests. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -38 lines) Patch
M pkg/analyzer/lib/dart/element/type.dart View 1 1 chunk +9 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/dart/element/type.dart View 1 2 chunks +12 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/generated/element_resolver.dart View 1 2 1 chunk +3 lines, -14 lines 0 comments Download
M pkg/analyzer/lib/src/generated/static_type_analyzer.dart View 1 chunk +3 lines, -6 lines 0 comments Download
M pkg/analyzer/lib/src/generated/type_system.dart View 1 chunk +4 lines, -18 lines 0 comments Download
M pkg/analyzer/test/generated/resolver_test.dart View 1 chunk +12 lines, -0 lines 0 comments Download
M pkg/analyzer/test/src/dart/element/element_test.dart View 1 2 4 chunks +51 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (2 generated)
Bob Nystrom
4 years, 10 months ago (2016-02-10 01:09:41 UTC) #2
Brian Wilkerson
LGTM https://codereview.chromium.org/1686893002/diff/1/pkg/analyzer/lib/src/dart/element/type.dart File pkg/analyzer/lib/src/dart/element/type.dart (right): https://codereview.chromium.org/1686893002/diff/1/pkg/analyzer/lib/src/dart/element/type.dart#newcode2175 pkg/analyzer/lib/src/dart/element/type.dart:2175: * If this type is a [TypeParameterType], returns ...
4 years, 10 months ago (2016-02-10 01:54:13 UTC) #3
Jennifer Messerly
lgtm
4 years, 10 months ago (2016-02-10 16:52:12 UTC) #4
Bob Nystrom
Thanks for the feedback! I have one question about tests before I land this. https://codereview.chromium.org/1686893002/diff/1/pkg/analyzer/lib/src/dart/element/type.dart ...
4 years, 10 months ago (2016-02-10 21:05:41 UTC) #5
Brian Wilkerson
LGTM https://codereview.chromium.org/1686893002/diff/1/pkg/analyzer/lib/src/dart/element/type.dart File pkg/analyzer/lib/src/dart/element/type.dart (right): https://codereview.chromium.org/1686893002/diff/1/pkg/analyzer/lib/src/dart/element/type.dart#newcode2181 pkg/analyzer/lib/src/dart/element/type.dart:2181: DartType resolveToBound(DartType objectType) { > Do you know ...
4 years, 10 months ago (2016-02-11 15:45:40 UTC) #6
Bob Nystrom
Committed patchset #3 (id:40001) manually as e19c6dd79d3edb0cf805c62d18cdb5e4ed3e4950 (presubmit successful).
4 years, 10 months ago (2016-02-11 19:27:05 UTC) #8
Bob Nystrom
4 years, 10 months ago (2016-02-11 19:27:25 UTC) #9
Message was sent while issue was closed.
https://codereview.chromium.org/1686893002/diff/1/pkg/analyzer/lib/src/dart/e...
File pkg/analyzer/lib/src/dart/element/type.dart (right):

https://codereview.chromium.org/1686893002/diff/1/pkg/analyzer/lib/src/dart/e...
pkg/analyzer/lib/src/dart/element/type.dart:2181: DartType
resolveToBound(DartType objectType) {
On 2016/02/11 15:45:40, Brian Wilkerson wrote:
> > Do you know where I should put them?
> 
> The rest of the tests for classes in this file are in
> .../analyzer/test/src/dart/element/element_test.dart.

Done.

Powered by Google App Engine
This is Rietveld 408576698