Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append source region for AL algorithms #107

Merged
merged 3 commits into from
Jul 18, 2024
Merged

Append source region for AL algorithms #107

merged 3 commits into from
Jul 18, 2024

Conversation

f52985
Copy link
Collaborator

@f52985 f52985 commented Jul 12, 2024

This PR appends the source region for AL algorithms,

useful for creating better error messages by explicitly denoting which part of the spec files is converted in to the given algorithm.

if List.length args <> List.length params then
raise (Exception.InvalidArg ("Args number mismatch for algorithm " ^ name));
if List.length args <> List.length params then (
raise (Exception.InvalidArg (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but can we report this message using the existing infrastructure in the util/error module, such that the region is shown in the standard manner?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seems that a tailored wrapper function for the error handling used no_region by default, and therefore the region was not printed.

For this specific case, instead of using wrapper, now it's directly printed in the following standard format:

spec/wasm-2.0/8-reduction.watsup:201.1-207.50: interpreter error: Expected 4 arguments for the algorithm `CVTOP` but 3 arguments are given (interpreting (CVTOP I64 I64 (EXTEND S)))

We would need to refactor the error message for other cases as well, but perhaps in a separate commit.

@f52985 f52985 merged commit c66f15e into main Jul 18, 2024
4 of 5 checks passed
@f52985 f52985 deleted the algo-source branch July 18, 2024 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants