Mentions légales du service

Skip to content

More consistent handling of errors in Solver, Infer and FTypeChecker, with source locations

SCHERER Gabriel requested to merge gscherer/inferno:errors-with-ranges into master

This changes moves Infer and Solver to use the FTypeChecker style of a single Error exception that carries an error algebraic datatype listing all potential error cases. This makes it easy/natural to provide source locations for all errors, instead of the hodge-podge support we have currently. After this PR, Infer error messages provide source location information, as expected.

This change mostly affects the client/frontend, with only a superficial change in the solver. My mental model is that @fpottier will not be super interested, and I'm thinking of merging myself after leaving a week or so for comments in case my guess is wrong.

One minor change worth mentioning is a rename of range into loc. Commit message quoted below:

consistently use 'loc' instead of 'range' to describe source locations

The problem with 'range' is that this word has a much more general meaning, it could be an integer range; typically it is also used in comments to describe range of levels or scopes.

In the context of Menhir, which is centered on parsing, 'range' clearly associates with 'source range'. But for more general project this association is lost and 'range' is confusing.

Merge request reports