Skip to content
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

Better error reporting for expressions before decreases #1417

Open
andreagilot-da opened this issue May 17, 2023 · 0 comments
Open

Better error reporting for expressions before decreases #1417

andreagilot-da opened this issue May 17, 2023 · 0 comments

Comments

@andreagilot-da
Copy link

When inserting an expression before a decreases such as:

def foo(l: List[BigInt]): Unit = {
  unfold(l)
  decreases(l)
  ()
}

the console outputs :

[ Error  ] Test.scala:8:5: Unexpected `decreases` (This error message might occur when a function has return type Unit while its body has another type).
               decreases(l)
               ^^^^^^^^^^^^
[ Fatal  ] Well-formedness check failed after extraction

This is not clear that the error comes from the fact that there was an expression other than a require before the decreases and in more involved cases the user tends to look at the return type of the body which is often what is not right when this specific error is returned.

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

No branches or pull requests

1 participant