File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -460,7 +460,10 @@ other input.
460
460
safely continue even if the assumption is violated. In debug builds it
461
461
behaves like ` Assert ` /` assert ` to notify developers and testers about
462
462
nonfatal errors. In production it doesn't warn or log anything, though the
463
- expression is always evaluated.
463
+ expression is always evaluated. However, if the compiler can prove that
464
+ an expression inside ` Assume ` is side-effect-free, it may optimize the call away,
465
+ skipping its evaluation in production. This enables a lower-cost way of
466
+ making explicit statements about the code, aiding review.
464
467
- For example it can be assumed that a variable is only initialized once,
465
468
but a failed assumption does not result in a fatal bug. A failed
466
469
assumption may or may not result in a slightly degraded user experience,
You can’t perform that action at this time.
0 commit comments