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

Issue 1434983006: tweak FunctionTypeImpl to support generic methods (Closed)

Created:
5 years, 1 month ago by Jennifer Messerly
Modified:
5 years, 1 month ago
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

tweak FunctionTypeImpl to support generic methods The big change here is to ensure FunctionTypeImpl.typeArguments is always initialized to match the parameters. This was previously the case, because we'd explicitly use the class's type parameters. With generic methods, we can no longer rely exclusively on that source of type parameters. We take advantage of enclosingElement to compute typeParameters from all containing scopes that can have them. By tracking all of the typeParameters, this allows substitution to work later. Adds a few very basic tests. Please note that generic methods are not ready to use yet. In particular this doesn't yet do the correct substitutions in StaticTypeAnalyzer. It also doesn't include (mostly done) inference to infer type parameters from the argument types. Further, discovered a missing feature from the previous parser CL. And finally, it doesn't include the kind of ErrorVerifier checks we'll likely need. R=brianwilkerson@google.com, leafp@google.com Committed: https://github.com/dart-lang/sdk/commit/af7359853f8f33b2febdcfa5beeb7a7dce115dce

Patch Set 1 : #

Patch Set 2 : format & sort #

Total comments: 18
Unified diffs Side-by-side diffs Delta from patch set Stats (+156 lines, -165 lines) Patch
M pkg/analyzer/lib/src/generated/element.dart View 16 chunks +66 lines, -55 lines 11 comments Download
M pkg/analyzer/lib/src/generated/resolver.dart View 15 chunks +12 lines, -67 lines 0 comments Download
M pkg/analyzer/lib/src/generated/testing/element_factory.dart View 2 chunks +5 lines, -6 lines 0 comments Download
M pkg/analyzer/lib/src/generated/testing/test_type_provider.dart View 1 1 chunk +4 lines, -6 lines 0 comments Download
M pkg/analyzer/lib/src/task/dart.dart View 3 chunks +3 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/task/strong_mode.dart View 2 chunks +6 lines, -5 lines 7 comments Download
M pkg/analyzer/test/generated/element_test.dart View 6 chunks +7 lines, -13 lines 0 comments Download
M pkg/analyzer/test/generated/resolver_test.dart View 1 5 chunks +53 lines, -13 lines 0 comments Download

Messages

Total messages: 18 (6 generated)
Jennifer Messerly
5 years, 1 month ago (2015-11-13 03:16:14 UTC) #6
Jennifer Messerly
BTW, most of the CL is covered by just not breaking anything that already exists ...
5 years, 1 month ago (2015-11-13 03:19:52 UTC) #7
Brian Wilkerson
LGTM https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/generated/element.dart File pkg/analyzer/lib/src/generated/element.dart (right): https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/generated/element.dart#newcode4853 pkg/analyzer/lib/src/generated/element.dart:4853: List<DartType> _typeArguments = DartType.EMPTY_LIST; Not sure why you ...
5 years, 1 month ago (2015-11-13 18:56:16 UTC) #8
Jennifer Messerly
Thanks so much! A few questions on how to best proceed... https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/generated/element.dart File pkg/analyzer/lib/src/generated/element.dart (right): ...
5 years, 1 month ago (2015-11-13 19:04:47 UTC) #9
Jennifer Messerly
https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/task/strong_mode.dart File pkg/analyzer/lib/src/task/strong_mode.dart (right): https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/task/strong_mode.dart#newcode43 pkg/analyzer/lib/src/task/strong_mode.dart:43: assert(false); On 2015/11/13 19:04:46, John Messerly wrote: > On ...
5 years, 1 month ago (2015-11-13 19:17:22 UTC) #10
Leaf
lgtm
5 years, 1 month ago (2015-11-13 19:28:55 UTC) #11
Brian Wilkerson
LGTM https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/generated/element.dart File pkg/analyzer/lib/src/generated/element.dart (right): https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/generated/element.dart#newcode4853 pkg/analyzer/lib/src/generated/element.dart:4853: List<DartType> _typeArguments = DartType.EMPTY_LIST; > The comment moved ...
5 years, 1 month ago (2015-11-13 20:17:14 UTC) #12
Jennifer Messerly
Committed patchset #2 (id:40001) manually as af7359853f8f33b2febdcfa5beeb7a7dce115dce (presubmit successful).
5 years, 1 month ago (2015-11-13 22:52:47 UTC) #13
Jennifer Messerly
https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/generated/element.dart File pkg/analyzer/lib/src/generated/element.dart (right): https://codereview.chromium.org/1434983006/diff/40001/pkg/analyzer/lib/src/generated/element.dart#newcode4853 pkg/analyzer/lib/src/generated/element.dart:4853: List<DartType> _typeArguments = DartType.EMPTY_LIST; On 2015/11/13 20:17:14, Brian Wilkerson ...
5 years, 1 month ago (2015-11-13 22:53:15 UTC) #14
Paul Berry
It looks like this CL caused a test failure. Repro with: python tools/test.py -aia32 --checked ...
5 years, 1 month ago (2015-11-16 17:13:12 UTC) #16
Jennifer Messerly
On 2015/11/16 17:13:12, Paul Berry wrote: > It looks like this CL caused a test ...
5 years, 1 month ago (2015-11-16 18:54:47 UTC) #17
Jennifer Messerly
5 years, 1 month ago (2015-11-16 19:38:27 UTC) #18
Message was sent while issue was closed.
On 2015/11/16 18:54:47, John Messerly wrote:
> On 2015/11/16 17:13:12, Paul Berry wrote:
> > It looks like this CL caused a test failure.  Repro with: python
tools/test.py
> > -aia32 --checked -mrelease -t60
> pkg/analysis_server/test/analysis/get_hover_test
> > 
> > Here are the failure details:
> > FAIL: AnalysisHoverTest | test_instanceCreation_implicit_withTypeArgument
> >   Expected: 'A() → A<String>'
> >     Actual: 'A() → A<T>'
> >      Which: is different.
> >   Expected: A() → A<String>
> >     Actual: A() → A<T>
> >                     ^
> >    Differ at offset 8
> >   
> >   package:unittest/src/simple_configuration.dart 128:34       
> > SimpleConfiguration.onExpectFailure
> >   package:unittest/src/simple_configuration.dart 24:13        
> > _ExpectFailureHandler.fail
> >   package:unittest/src/matcher/expect.dart 121:5              
> > DefaultFailureHandler.failMatch
> >   package:unittest/src/matcher/expect.dart 95:20               expect
> >   pkg/analysis_server/test/analysis/get_hover_test.dart 312:7 
> > AnalysisHoverTest.test_instanceCreation_implicit_withTypeArgument.<fn>
> >   dart:async/zone.dart 914                                     _rootRunUnary
> >   dart:async/zone.dart 810                                    
> > _CustomZone.runUnary
> >   dart:async/future_impl.dart 502                             
> > _Future._propagateToListeners.handleValueCallback
> >   dart:async/future_impl.dart 585                             
> > _Future._propagateToListeners
> >   dart:async/future_impl.dart 466                             
> > _Future._propagateToListeners
> >   dart:async/future_impl.dart 376                             
> > _Future._completeWithValue
> >   dart:async/future_impl.dart 430                             
> > _Future._asyncComplete.<fn>
> >   dart:async/zone.dart 907                                     _rootRun
> >   dart:async/zone.dart 802                                    
_CustomZone.run
> >   dart:async/zone.dart 708                                    
> > _CustomZone.runGuarded
> >   dart:async/zone.dart 733                                    
> > _CustomZone.bindCallback.<fn>
> >   dart:async/schedule_microtask.dart 43                       
_microtaskLoop
> >   dart:async/schedule_microtask.dart 52                       
> > _microtaskLoopEntry
> >   dart:isolate-patch/timer_impl.dart 394                      
> _Timer._runTimers
> >   dart:isolate-patch/timer_impl.dart 414                      
> > _Timer._handleMessage
> >   dart:isolate-patch/isolate_patch.dart 150                   
> > _RawReceivePortImpl._handleMessage
> 
> Thanks for noticing that! I'll take a look now. I forgot that refactorings
might
> impact analysis_server, especially if it uses *Impl types. DOH.

Fix on the way!

Powered by Google App Engine
This is Rietveld 408576698