What's a best practice to catch REPL errors when developing tests to related compiler plugins? #20229
Replies: 1 comment
-
This became a duplicate as a related issue was also moved to discussions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Assumptions
Just so you know, I use a compiler plugin in the below examples related to REPL development.
This video https://www.youtube.com/watch?v=UpsRLbEHmik suggests that (see 15:00) a
Compiler
class is needed to test compiler plugins. I assume this class covers the whole process. Hence, there is no place to use other classes (e.g., PluginPhase) for this purpose. This class lets me hook an extra phase into the phases listing to make assertions on the current state of the tree under transformation, though it's not completely clear how this works. It's unclear how I should decide at which point I should insert the assertion.I assume in case of an error, it's an anti-pattern to transform a tree; the preferable is reporting an error and returning the tree unchanged:
Questions
As far as I understand, the above-mentioned video suggests assertions on the tree, but in case of an error report, the tree would be unchanged. How can I catch an error reporting, and where should I insert a handler for that (e.g., after which phase; is the
Compiler
class appropriate for that)?Beta Was this translation helpful? Give feedback.
All reactions