Missing dynamic checks in DDC with call
method allows heap unsoundness
#29915
Labels
call
method allows heap unsoundness
#29915
As a variant of the example shown in #29913, the following example illustrates that DDC does not generate all the needed checks in order to ensure heap soundness when we mix covariance (with a generic class) and contravariance (with a function type), using a
call
method. The program is accepted bydartanalyzer --strong n018.dart
with no issues.When compiling and executing the program using dartdevc.dart from 5982ace, 2017-06-15 14:18:09, ddc n018.dart, the resulting output is as follows:
This differs from the situation in #29913 in that we do get the dynamic argument type check at the invocation of the
call
method (presumably because that's a normal class-covariance check), but we still have an unsound heap for a while, becausef
inmain
refers to an instance ofClassF<C>
, and such an object cannot be considered to have typeF<A>
as declared.The text was updated successfully, but these errors were encountered: