-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Default messages in assertion macros #12019
Conversation
Looks like MSVC does not like variadic macros very much... |
/// Assertion that throws an exception containing the given description if it is not met. | ||
/// Use it as assertThrow(1 == 1, ExceptionType, "Mathematics is wrong."); | ||
/// The second parameter must be an exception class (rather than an instance). | ||
#define assertThrow(_condition, _exceptionType, _description) \ | ||
assertThrowWithDefaultDescription(_condition, _exceptionType, _description, "Assertion failed") |
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.
Is assertThrow()
really an assertion? In most cases I've seen it's just used as a convenience helper to throw a boost exception.
ee2ae56
to
07d53b5
Compare
Looks like it requires extra |
07d53b5
to
87a2245
Compare
By the way, is this something that should have a changelog entry? This might affect tools that try to detect some specific ICEs in the output and do some workarounds. We might want to at least inform them even if we do not guarantee any backwards-compatibility for these messages. |
87a2245
to
83ba149
Compare
I don't think we should guarantee backwards compatibility in ICEs |
@@ -1217,7 +1217,7 @@ string YulUtilFunctions::extractByteArrayLengthFunction() | |||
std::string YulUtilFunctions::resizeArrayFunction(ArrayType const& _type) | |||
{ | |||
solAssert(_type.location() == DataLocation::Storage, ""); | |||
solUnimplementedAssert(_type.baseType()->storageBytes() <= 32, "..."); |
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.
lol
83ba149
to
514b9a0
Compare
Needs rebase |
514b9a0
to
7f71074
Compare
This is an attempt to improve the situation in #12017 a little. It should also be an improvement for external tools because for these our ICEs are often puzzling when they have no message at all (see e.g. trufflesuite/truffle#2849).
""
in an assertion, it gets replaced with a generic message, like"Solidity assertion failed"
or"Unimplemented feature"
, depending on the assertion type.solAssert()
and other assertions, making them more convenient.