-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-messagesPoor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.Poor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.
Description
(Split out from #61145)
Given the following code:
void main() {}
abstract class A {}
abstract class B {}
mixin C {}
abstract class D {
F get foo;
}
abstract class F {}
abstract class G implements D {}
abstract class H implements F {}
abstract class I implements D, A {
@override
J get foo;
}
abstract class J implements F, A {}
abstract class K<E extends F> {
E get foo;
}
abstract class L implements G, A {}
abstract class M implements H, A {}
mixin N<E extends H> implements K<E> {}
abstract class O implements I {
@override
P get foo;
}
abstract class P implements J {}
abstract class Q extends G implements I {}
mixin R on H {}
abstract class S implements O {
@override
T get foo;
}
abstract class T implements P {}
mixin U<E extends H> implements N<E> {}
mixin V<E extends H> implements N<E> {}
abstract class W extends Q implements O {}
abstract class X extends H with R {}
abstract class Y implements S {
@override
Z get foo;
}
abstract class Z implements T {}
mixin AA implements S {}
mixin BB on H implements X, M, J {}
abstract class CC extends W with AA, C implements L {
@override
DD get foo;
}
abstract class DD extends X with C, BB implements T {}
mixin EE on AA implements Y {}
class FF extends DD implements Z {}
mixin GG<E extends DD> implements N<E> {}
class HH extends CC with EE, GG<FF>, V<FF>, U<FF>, N<FF> implements B {
@override
final FF foo = throw '';
}The CFE produces the error message:
pkg/analyzer/lib/repro.dart:86:7: Error: Class 'CC with EE' inherits multiple members named 'CC.foo%D.foo%I.foo%D.foo%O.foo%I.foo%D.foo%S.foo%O.foo%I.foo%D.foo%D.foo' with incompatible signatures.
Try adding a declaration of 'CC.foo%D.foo%I.foo%D.foo%O.foo%I.foo%D.foo%S.foo%O.foo%I.foo%D.foo%D.foo' to 'CC with EE'.
class HH extends CC with EE, GG<FF>, V<FF>, U<FF>, N<FF> implements B {
^
pkg/analyzer/lib/repro.dart:75:10: Context: This is one of the overridden members.
DD get foo;
^^^
pkg/analyzer/lib/repro.dart:49:9: Context: This is one of the overridden members.
T get foo;
^^^
But the suggestion "Try adding a declaration of 'CC.foo%D.foo%I.foo%D.foo%O.foo%I.foo%D.foo%S.foo%O.foo%I.foo%D.foo%D.foo' to 'CC with EE'." is impossible because:
CC with EEis not explicitly declared anywhere in the code. It's an unnamed mixin application that the CFE creates as part of desugaring the declaration of the classHH.- Even if
CC with EEwere changed to a named mixin application (by manually desugaring the declaration ofHHso that the mixin applications were explicit), it would still be impossible, because declarations cannot be added to mixin applications.
Since the suggestion "Try adding a declaration..." is impossible, it should not be emitted.
Metadata
Metadata
Assignees
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-messagesPoor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.Poor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.