Cast applied to union types do not behave correctly and sometimes pass erroneously Reviewed-by: jlahoda