On Monday, 24 July 2017 at 17:29:55 UTC, Dgame wrote:
S[] ss = [new S()];
test1(ss); // Fails
Why isn't the compiler able to deduce S[] => I[]? Or is it just
me?
This is exactly because of polymorphism. Consider the following:
```
S[] ss = [new S()];
I[] i = ss; // pass it to the function or whatever for implicit
conversion
class OtherDerived : I {}
i[0] = new OtherDerived(); // looks OK, otherDerived is also
interface I
```
But now, ss[0], the same array as i, no longer points to an S!
You broke the type system.