Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information