D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20784 - Assert expression specification needs to be updated
Summary: Assert expression specification needs to be updated
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P3 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-29 01:46 UTC by Andrej Mitrovic
Modified: 2024-12-15 15:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2020-04-29 01:46:28 UTC
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?
Comment 1 Nick Treleaven 2023-03-31 12:20:10 UTC
> 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
Comment 2 dlangBugzillaToGithub 2024-12-15 15:25:56 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dlang.org/issues/3983

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB