Skip to content

Add some tests for typechecking error messages#8874

Merged
gasche merged 5 commits intoocaml:trunkfrom
Lereena:typing-misc-add
Aug 16, 2019
Merged

Add some tests for typechecking error messages#8874
gasche merged 5 commits intoocaml:trunkfrom
Lereena:typing-misc-add

Conversation

@Lereena
Copy link
Contributor

@Lereena Lereena commented Aug 14, 2019

In the process of creating a tests coverage report for the compiler code using bisect_ppx, I generated a report specifically for the typechecking subsystem (you can see it here). Using this coverage report I found some gaps that could be easily fixed with few tests, so I added a small one for invalid type variable names and, more importantly, I added various tests covering all error messages related to inclusion checks for the class language.
Several unpaired opens of pretty-printing boxes in the error messages have also been removed to prevent printing errors.

I also used those tests to check that the coverage report works fine: after adding tests, the expected parts of the code were highlighted (before, after).

The bisect_ppx integration work is done under the guidance of @Octachron and @shindere.

@trefis
Copy link
Contributor

trefis commented Aug 14, 2019

I'm not going to comment on the formatting changes, but I will say that getting coverage reports is very cool!

Do you plan to publish the tool somewhere?

PS: I find it funny that your new tests mostly don't intersect with the ones added by #8516 :)

Copy link
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

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

This looks very nice, thanks! See a minor comment inline.

Could you add a Changes entry for the PR?

fprintf ppf "The public method %s cannot become private" lab
| CM_Virtual_method lab ->
fprintf ppf "@[The virtual method %s cannot become concrete" lab
fprintf ppf "The virtual method %s cannot become concrete" lab
Copy link
Member

Choose a reason for hiding this comment

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

This is clearly a good fix, but I think that it would be even better to pack every of those messages (those that are just fprintf ppf ..., not the other ones) in a box (@[...@]), rather than removing the box completely. The balancing bug appears to have been introduced in b96208b, and it seems that the previous code did have boxes on all messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, now I see that initially there were boxes here, so probably, the better solution would be to return them back.

@Lereena
Copy link
Contributor Author

Lereena commented Aug 14, 2019

Do you plan to publish the tool somewhere?

@trefis About the tool, I modified bisect_ppx to instrument the compiler, but now a build process is not very smooth and there are doubts about maintainability of this solution. So it will take some more time to put everything in order and then present to the public a complete way of generating reports for the compiler.

Copy link
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

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

This is good to go if/when the CI agrees. (I may not be around for merging, so anyone please feel free.)

@aantron
Copy link
Contributor

aantron commented Aug 15, 2019

@Lereena If changes are needed to Bisect_ppx, we'd be happy to merge them to make using it on the compiler easier.

@gasche gasche merged commit a72855e into ocaml:trunk Aug 16, 2019
@Octachron
Copy link
Member

@aantron , quite a few of the changes were about removing bell and whistles from the ppx source code to make it easier to build with the in-tree compiler and do not really make sense outside of this specific context; but we may try to upstream some of the less invasive patchsets.

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.

5 participants