haxe
haxe copied to clipboard
Potential bug in type_eq
We have
| EqDoNotFollowNull (* like EqStrict, but does not follow Null<T> *)
But there's this check in the TAnon,TAnon case:
if f1.cf_kind <> f2.cf_kind && (param = EqStrict || param = EqCoreType || not (unify_kind f1.cf_kind f2.cf_kind)) then error [invalid_kind n f1.cf_kind f2.cf_kind];
This means that with EqDoNotFollowNull we allow field kind variance, which we probably shouldn't.
I would like to find a reproducible case instead of just blind-fixing this. There's on place in the inliner which uses EqDoNotFollowNull:
type_eq (if ctx.com.config.pf_static then EqDoNotFollowNull else EqStrict) etype tret;
This is to check if a TCast has to be inserted for the return value, so maybe it's possible to break this on HL which cares about TCast a lot.