-
Notifications
You must be signed in to change notification settings - Fork 379
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
[ fix #3437 ] Add a check for multiple totality modifiers #3441
Conversation
Would be nice if the message could explain why that's a problem and how to fix it. something like "Multiple incompatible totality modifier were given for this function." And give multiple ways to solve it. Either by relying on the default totality or by overriding the default. |
I think any use of multiple totality modifiers (including identical ones) on a single declaration should be an error. The default totality no matter. |
This is incorrect. %default total
covering
main : IO ()
main = … is a common pattern. In the case of multiple definitions, like |
I mean, the presence of |
Alright I'll do it myself |
Regardless of the goals of this PR, I’d add that in my opinion it’s ok to have e.g. a That is, in my opinion the only thing that should be an error is if there are multiple totalities defined explicitly on the function. |
Let's get this in and someone else will implement #3442 |
Okay, I understand the errors you suggest. I'll add them |
I have tried to make correct error messages that take into account the presence of all totality modifiers. This commit does not affect the ability to override totality in Data |
I'm sorry if my messages might have come across as rude. I don't always know the best way to express my thoughts in English |
I think your messages are coming across just fine (no rude tone detected by me, at least). |
I think we can go ahead and merge this. I'm less than 100% sure on the question of where the check should be run in the compiler pipeline but the net impact of this PR is quite positive. |
Description
processFnOpt
.elabImplementation
does not add a totality modifier from the interface if it is overridden in the implementation. This is to prevent multiple modifiers from appearing after desugaring.Checking when desugaring is enough for Idris, but I left the changes to
processFnOpt
as they also check TTImp.Should this change go in the CHANGELOG?
implementation, I have updated
CHANGELOG_NEXT.md
(and potentially alsoCONTRIBUTORS.md
).