test suite: examples for error paths in typecore.ml#1882
Merged
gasche merged 2 commits intoocaml:trunkfrom Jul 4, 2018
Merged
Conversation
16f724e to
e6d1566
Compare
gasche
approved these changes
Jul 4, 2018
Member
gasche
left a comment
There was a problem hiding this comment.
Very nice work! Feel free to merge after possibly considering my minor comment on the non-character interval pattern.
| let x = function 'a'..10 -> () | ||
| [%%expect {| | ||
| Line _, characters 17-24: | ||
| let x = function 'a'..10 -> () |
Member
There was a problem hiding this comment.
I would prefer the use of a type-correct integer pattern, eg 1 .. 10, instead of a weird char-int pattern, so that the test would remain robust to a hypothetical reordering of type inference and type-of-intervals checking.
Member
Author
There was a problem hiding this comment.
Good point, fixed with a float range pattern.
| Line _, characters 6-13: | ||
| let f (A x|C) = 0 | ||
| ^^^^^^^ | ||
| Error: Variable x must occur on both sides of this | pattern |
Member
There was a problem hiding this comment.
Not your fault but the error message is weird, I would expect or-pattern instead of using a symbol in the middle of a sentence.
EmileTrotignon
pushed a commit
to EmileTrotignon/ocaml
that referenced
this pull request
Jan 12, 2024
…1882) * add a section on how to generate odoc documentation pages with dune * minor formatting fixes --------- Co-authored-by: Christine Rose <christinerose@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is the negative counterpart to #1868, #1872 and #1881: it adds a small example for every error path of the form
raise(Error(…))intypecore.mlthat was not covered anywhere else in the test suite.Most of the examples tested in this PR are trivial, but they helped me to identify the issues raised in the above PRs.
There is one small exception, due to an error that is only reachable with a ppx that would create an empty polymorphic variant type abbreviation:
I am currently planning to add support for ppx in ocamltest to also cover this error.