HaxeFoundation / HaxeFoundation/haxe
Potential bug in type_eq
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
We have
```ocaml
| EqDoNotFollowNull (* like EqStrict, but does not follow Null *)
```
But there's this check in the `TAnon,TAnon` case:
```ocaml
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`:
```ocaml
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.
Contributor guide
Assessment
This issue has not been assessed yet.