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
When composing lazy contracts, the reported error position is typically the innermost error: { a = "hi" } | { a | String } will blame just the a and not the whole record. This is usually the correct behavior, I think.
When building up an eager contract by recursively calling std.contract.check on other eager contracts, a contract failure will blame the outermost contract. This is inherent to the signature of std.contract.check, as the inner calls to std.contract.check can only return error messages; the location tracking is only performed at the call to %contract/apply%.
Maybe error case std.contract.check could be modified to return { message, notes, location | optional | Dyn } (i.e. with the new location parameter), where location is an opaque value representing the error location. Then the location could be threaded through recursive calls to std.contract.check, allowing the contract author to decide on the best error location. Maybe location should be locations, an array of locations and error message, to reflect that there can be multiple diagnostic locations tagged with different messages.
Related to #1432, in that they could use the same mechanism for tracking locations.
The text was updated successfully, but these errors were encountered:
When composing lazy contracts, the reported error position is typically the innermost error:
{ a = "hi" } | { a | String }
will blame just thea
and not the whole record. This is usually the correct behavior, I think.When building up an eager contract by recursively calling
std.contract.check
on other eager contracts, a contract failure will blame the outermost contract. This is inherent to the signature ofstd.contract.check
, as the inner calls tostd.contract.check
can only return error messages; the location tracking is only performed at the call to%contract/apply%
.Maybe error case
std.contract.check
could be modified to return{ message, notes, location | optional | Dyn }
(i.e. with the newlocation
parameter), wherelocation
is an opaque value representing the error location. Then thelocation
could be threaded through recursive calls tostd.contract.check
, allowing the contract author to decide on the best error location. Maybelocation
should belocations
, an array of locations and error message, to reflect that there can be multiple diagnostic locations tagged with different messages.Related to #1432, in that they could use the same mechanism for tracking locations.
The text was updated successfully, but these errors were encountered: