Skip to content

Comments

Allow custom error message for assertion failures via @msg annotation#815

Open
marcoeilers wants to merge 7 commits intomasterfrom
meilers_custom_assert_error_msg
Open

Allow custom error message for assertion failures via @msg annotation#815
marcoeilers wants to merge 7 commits intomasterfrom
meilers_custom_assert_error_msg

Conversation

@marcoeilers
Copy link
Contributor

For example,

method test0(x: Ref)
{
   @msg("Custom error message") assert x != null
}

leads to Silicon output

Silicon found 1 error in 2.83s:
  [0] Custom error message

Requested by @tdardinier.

@jcp19
Copy link
Contributor

jcp19 commented Aug 16, 2025

can this annotation be used in function preconditions too to override the error message if the precondition does not hold?

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.

2 participants