Skip to content

Improve Ast_pattern error reporting. #391

Open
@panglesd

Description

@panglesd

The error reported by Ast_pattern are not very informative, especially for the user of the PPX, who might not know anything about the AST.

Here is an example of an error generated by an unmatched AST pattern:

Error: PStr expected

Possible improvements:

  • Make a more complete sentence, with more information: Error: a "structure" node was expected, instead of a "..."
  • Allow for custom error message (or custom additional information) in the API. It is especially interesting for the alt function, which only expects from one branch. Example of a custom error message (see Implement new module type syntax ppx_import#87):
Error: [%%import] Type pattern (PTyp) is not supported, only type and module
         type declarations are allowed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions