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

Issue 2778083002: Fix #29003 (Closed)

Created:
3 years, 8 months ago by vsm
Modified:
3 years, 8 months ago
Reviewers:
Jennifer Messerly
CC:
dev-compiler+reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix #29003 Expand out nested mixins to apply them separately.

Patch Set 1 #

Patch Set 2 : Update status #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -6 lines) Patch
M pkg/dev_compiler/lib/src/compiler/code_generator.dart View 1 3 chunks +27 lines, -2 lines 1 comment Download
M pkg/dev_compiler/test/browser/language_tests.js View 1 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 6 (2 generated)
vsm
3 years, 8 months ago (2017-03-27 21:47:11 UTC) #3
Jennifer Messerly
Let me know if I can clarify comments ... or if I should take it, ...
3 years, 8 months ago (2017-03-27 22:15:15 UTC) #4
vsm
On 2017/03/27 22:15:15, Jennifer Messerly wrote: > Let me know if I can clarify comments ...
3 years, 8 months ago (2017-03-27 22:22:24 UTC) #5
vsm
3 years, 8 months ago (2017-03-27 22:47:51 UTC) #6
On 2017/03/27 22:22:24, vsm wrote:
> On 2017/03/27 22:15:15, Jennifer Messerly wrote:
> > Let me know if I can clarify comments ... or if I should take it, happy to
do
> > so, I think it's a very quick fix to visitClassTypeAlias
> > 
> >
>
https://codereview.chromium.org/2778083002/diff/10001/pkg/dev_compiler/lib/sr...
> > File pkg/dev_compiler/lib/src/compiler/code_generator.dart (right):
> > 
> >
>
https://codereview.chromium.org/2778083002/diff/10001/pkg/dev_compiler/lib/sr...
> > pkg/dev_compiler/lib/src/compiler/code_generator.dart:1286:
> List<InterfaceType>
> > _flattenMixins(List<InterfaceType> mixins) {
> > I don't think this is correct in general?
> > 
> > it will expand out mixins arbitrarily, yes it happens to work with "class M2
=
> > Object with M1;" but it won't work with:
> > 
> >     class M2 extends Object with M1 { foo() => 123 }
> > 
> > ... the method "foo" above would just get discarded?
> > 
> > For the moment, that may be disallowed by another check, but in general
> > flattening out seems really bad. For example:
> > 
> > library 1:
> >     // Private!
> >     class _M1 { int foo() => 42; }
> >     class M2 = Object with _M1;
> > 
> > library 2:
> > 
> >     class M3 extends M2 {} // does this expand to _M1 ??
> 
> Ahh, good example!
> 
> > 
> > 
> > ... with this fix, wouldn't we try to generate a private reference to M1
from
> > library2  ... that might happen to work but it's very unsafe.
> > 
> > Finally ... this would support invalid things like:
> >     class M1 { int foo() => 42; }
> >     class M2 { int foo() => 42; }
> >     class M3 = Object with M1, M2;
> >     class M4 extends Object with M3 {} // not actually valid??
> > 
> > I described this in more detail here:
> > https://github.com/dart-lang/sdk/issues/29003#issuecomment-285471442
> > 
> > ... what's going on here is that "class M2 = Object with M1;" is like a
> special
> > form of typedef.
> > 
> > I think the way to support this is handling the special case "type A =
Object
> > with B" in visitClassTypeAlias. That has a lot less risk of accidentally
> causing
> > other breakage.
> 
> Yeah, I'd been relying on other static checks to prevent the "bad" cases of
> flatten.  But, funny enough, I started with the special case approach.   Let
me
> go back to that one.

closing this CL in favor of https://codereview.chromium.org/2783443002/

Powered by Google App Engine
This is Rietveld 408576698