Description
From @jmesserly on April 28, 2016 20:26
The initial implementation will not validate type bounds.
We actually have the same issue with generic classes. But there, it can only be triggered via JavaScript interop, because C<InvalidType>
would be rejected at compile time. Generic methods must handle this at run time for dynamic calls.
Since we represent these types as a function like (T, S) => dart.functionType(...)
, once option is to generate an assertion in the body. Same trick would work for generic classes, although we might not want it there, because it would be triggered (once) for every class, whereas if we look up a runtime type signature of a generic method, we're already in the dynamic dispatch code path.
Copied from original issue: dart-archive/dev_compiler#532