Closed
Description
The following code should be strong-mode compliant:
class X {}
UnmodifiableListView<X> a = new UnmodifiableListView<X>([]);
Iterable<X> b = null;
Iterable<X> c = (b ??= a);
but the analyzer actually produces the error:
#Unsound implicit cast from Object to Iterable<X> [STRONG_MODE_DOWN_CAST_COMPOSITE]
Note that this very similar (and functionally equivalent) code works fine:
class X {}
List<X> a = new UnmodifiableListView<X>([]);
Iterable<X> b = null;
Iterable<X> c = (b ??= a);
so it seems it's specifically having trouble working out the common subtype of Iterable and UnmodifiableListView. Maybe mix-in related?