-
Notifications
You must be signed in to change notification settings - Fork 26
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
Getting rid of warnings in PrettyPrinter.hs
#189
Conversation
On the master branch, I don't get any warning for clean build. |
Here is what I get from a clean build on master
|
This is so odd. BTW, the branching you are working on, https://github.com/EliasC/encore/tree/fix/ppWarnings, is 6 commits behind encore/master. |
Thanks! I had forgotten to update my own master branch! In this branch I don't see the warnings either, which is actually weird. For example there should be a warning for the following function:
Do you know if one of the latest commits disables any warnings? Still, I think the refactoring in this PR makes sense. Let me know if you would like me to reword it. |
The |
I added the warning there so that you could get a warning at compile time instead of at runtime! The idea was that if you add something to the AST you should get warnings that help you find all the places you need to update. By disabling it we require that all programmers know how the whole compiler works. I would like to re-add the warning (and for future warnings to not be disabled unless there is a clear commit message highlighting and motivating why that warning should be disabled). |
That's a fair argument. I failed to anticipate the evolving of the AST. Thanks. |
@albertnetymk I added the warning after the fifth person came to me asking why their new addition to the AST didn't work properly :) |
What?! I thought there are totally four (if I count myself) persons working on this. Besides, the runtime error should have occurred, shouldn't it? |
(You, me, Kiko, Stephan, Tobias, Dave, plus a bunch of students) Not literally the "fifth" person. I should have said "there were reoccurring errors stemming from people (including myself) forgetting to extend |
@@ -222,3 +230,4 @@ ppBinop Identifiers.MINUS = text "-" | |||
ppBinop Identifiers.TIMES = text "*" | |||
ppBinop Identifiers.DIV = text "/" | |||
ppBinop Identifiers.MOD = text "%" | |||
ppBinop op = error $ "Cannot pretty-print binary expression '" ++ show op ++ "'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would surpass any compiling warning, even if a new node is added, right?
That's a fair point. Fixed in the latest commit. |
The intention of this PR is possibly changed, so you may want to rebase. There's support for git for trailing spaces, here. These are minor things; if you don't plan to do any future update, I think it's ready to be merged. |
Pushed a last minor layout fix. I'm done with this PR now. |
Do you think if it's good to do a rebase to squeeze/rename some of commits before merging? |
Just realized I based the squash on an unmerged PR... Hold on... |
This commit re-adds the warnings for missing cases in the pretty-printer (and gets rid of some of the warnings that found its way in while it was gone). The reason for this is to alert anyone adding new AST nodes that the pretty-printer must also be updated.
There! Squashed, reworded and ready for merge. |
Getting rid of warnings in `PrettyPrinter.hs`
This commit gets rid of the warnings given by missing cases in the
pretty-printer. It had just been bugging me for ages.