I was reading the Roslyn source code when I noticed this strange section:
// Implicit casts are not emitted. As a result verifier may operate on a different
// types from the types of operands when performing stack merges in coalesce/ternary.
// Such differences are in general irrelevant since merging rules work the same way
// for base and derived types.
//
// Situation becomes more complicated with delegates, arrays and interfaces since they
// allow implicit casts from types that do not derive from them. In such cases
// we may need to introduce static casts in the code to prod the verifier to the
// right direction
I'm curious of what would be needed for this to happen. I care in particular about when does an interface allow for an implicit cast from a non-derived type. However, an explanation for arrays/delegates would be interesting as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With