You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Speed up record inclusion check.
Speed up record inclusion check.
Fixes#6284
Record inclusion check (between implementation and interface) is quadratic.
Example:
```res
module M : {
type t<'a, 'b, 'c> = {x:list<('a, 'b)>, y:int, z:int}
} = {
type t<'a, 'b, 'c> = {x:list<('a, 'c)>, y:int, z:int}
}
```
The algorithm tries to instantiate type parameters. It only reports an error if there is an inconsistency. This requires solving type equations involving many types at once.
To improve error message, the first problematic field is reported. So the type equations are checked again and again with size 1, 2, ...n where n is the number of fields. (Plus the type parameters).
This is quadratic and is problematic for types of ~1K elements.
This PR provides a fast path which just checks if there is an error, without blaming a specific field.
The fast path is linear.
Only if an error is detected, the quadratic path is take to blame precisely which field is involved.
* Add text for record inclusion.
So that there's some minimal sanity check that record type inclusion works as expected on a nontrivial case.
* Update CHANGELOG.md
* Refactor into a single function.
0 commit comments