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

Issue 2115743002: simplify inference of generic function types (Closed)

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

Description

simplify inference of generic function types removes the support for finding a partial solution

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -28 lines) Patch
M pkg/analyzer/lib/src/generated/static_type_analyzer.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/analyzer/lib/src/generated/type_system.dart View 4 chunks +5 lines, -21 lines 0 comments Download
M pkg/analyzer/test/generated/type_system_test.dart View 4 chunks +4 lines, -6 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
Jennifer Messerly
4 years, 5 months ago (2016-07-01 01:06:46 UTC) #2
Jennifer Messerly
Hi Leaf, I may merge this into an upwards inference CL I'm working on, so ...
4 years, 5 months ago (2016-07-01 21:56:15 UTC) #3
Leaf
On 2016/07/01 21:56:15, John Messerly wrote: > Hi Leaf, > > I may merge this ...
4 years, 5 months ago (2016-07-12 20:10:57 UTC) #4
Jennifer Messerly
4 years, 5 months ago (2016-07-12 20:29:46 UTC) #5
On 2016/07/12 20:10:57, Leaf wrote:
> On 2016/07/01 21:56:15, John Messerly wrote:
> > Hi Leaf,
> > 
> > I may merge this into an upwards inference CL I'm working on, so curious
about
> > your thoughts. :)
> > 
> > Here's an example of a case that was (arguably) made worse by the partial
> > inference code path, and is what motivated me to send this CL:
> > 
> >     class A<S, T> { A(S s, T t); }
> >     A<int, String> a = new A('hi', 42);
> > 
> > What we used to do is push down `<int, String>`, and issue an error for each
> > parameter to the constructor. But once I integrated upwards inference, it
> would
> > hit the "partial solution" code and conclude `A<dynamic, dynamic>`,
resulting
> in
> > a DownCastComposite warning about assigning `A<dynamic, dynamic>` to `A<int,
> > String>`. It's a shame because we know the code is incorrect during
inference,
> > but we're losing that info and sort of trying to muddle through using
> `dynamic`.
> > 
> > Thinking on this more, an alternate idea: if we encounter an error, we could
> use
> > only the return type context information. That would sort of get us the best
> of
> > both worlds. (We already special case the return type -- the position that
the
> > type variable T occurs in the return type is part of the heuristic of
whether
> to
> > prefer the lower or upper bound for T.)
> 
> This got moved into the other CL, right?  Or is this still live?

Yup, merged! closing this one.

Powered by Google App Engine
This is Rietveld 408576698