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

Assert expression specification needs to be updated #3983

Open
dlangBugzillaToGithub opened this issue Apr 29, 2020 · 1 comment
Open

Assert expression specification needs to be updated #3983

dlangBugzillaToGithub opened this issue Apr 29, 2020 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

Andrej Mitrovic (@AndrejMitrovic) reported this on 2020-04-29T01:46:28Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=20784

CC List

Description

https://dlang.org/spec/expression.html#assert_expressions

> The first AssignExpression must evaluate to true. If it does not, an Assert Failure has occurred and the program enters an Invalid State.
> Undefined Behavior: Once in an Invalid State the behavior of the continuing execution of the program is undefined.

This in theory is true. And https://github.com/dlang/dmd/pull/6896, if merged, would actually make it really true. (It would be great if we got some progress on that PR). However see my next comment:

> Do not attempt to resume normal execution after an Assert Failure.

But then what is the point of `Runtime.extendedModuleUnitTester`? If an application enters an Invalid state then after the very first assertion failure it wouldn't make sense to continue running tests in other modules. But Druntime explicitly supports this feature..

> AssertExpression has different semantics if it is in a unittest or in contract.

The documentation doesn't actually list what the differences are. But maybe it should just link to the contracts page?
@dlangBugzillaToGithub
Copy link
Author

nick (@ntrel) commented on 2023-03-31T12:20:10Z

> maybe it should just link to the contracts page?

Added link to precondition spec (among other tweaks):
https://github.com/dlang/dlang.org/pull/3572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant