The code compiles and runs fine, but throws an exception.
Is that how it should be?
void main() {
final c = LC<String>('foo');
// CP want c<List<int>?, T> but c is C<List<int>, T>
final cp = CP<List<int>?, String>(c);
cp.p(null);
}
abstract class C<I, O> {
O c(I v);
}
class CP<I, T> {
final C<I, T> c;
CP(this.c);
T p(I v) => c.c(v);
}
class LC<T> implements C<List<int>, T> {
final T v;
LC(this.v);
@override
// Unhandled exception:
// type 'Null' is not a subtype of type 'List<int>' of 'v'
T c(List<int> v) => this.v;
}