Index: docs/language/dartLangSpec.tex |
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex |
index 50b6c778793ace5d9af1f1982b6cc1fee30d0437..e6a3b1e9622ae7868d3bb4e02a2f200f41ebcb0a 100644 |
--- a/docs/language/dartLangSpec.tex |
+++ b/docs/language/dartLangSpec.tex |
@@ -29,6 +29,7 @@ |
% - The Null type is now considered a subtype of all types in most cases. |
% - Specify what NEWLINE means in multiline strings. |
% - Specified the FutureOf type. |
+% - Don't allow functions as assert test values. |
% |
% 1.14 |
% - The call "C()" where "C" is a class name, is a now compile-time error. |
@@ -6731,7 +6732,7 @@ It is a compile-time error if a yield-each statement appears in a function that |
Let $T$ be the static type of $e$ and let $f$ be the immediately enclosing function. It is a static type warning if $T$ may not be assigned to the declared return type of $f$. If $f$ is synchronous it is a static type warning if $T$ may not be assigned to \code{Iterable}. If $f$ is asynchronous it is a static type warning if $T$ may not be assigned to \code{Stream}. |
-\subsection{ Assert} |
+\subsection{Assert} |
\LMLabel{assert} |
\LMHash{} |
@@ -6750,24 +6751,26 @@ An assert statement with a trailing comme is equivalent to one with that |
comma removed. |
\LMHash{} |
-An assert statement on the form \code{\ASSERT($e$);)} is equivalent to a statment on the form \code{\ASSERT($e$, null);}. |
+An assert statement on the form \code{\ASSERT($e$);)} is equivalent to |
+a statment on the form \code{\ASSERT($e$, null);}. |
eernst
2017/07/10 10:02:24
Typo: `stat[e]ment`.
About white space: It used t
Lasse Reichstein Nielsen
2017/08/07 11:57:00
I try to split at "meaningful" positions, which ba
|
\LMHash{} |
-The assert statement has no effect in production mode. In checked mode, execution of an assert statement \code{\ASSERT{}($c$, $e$);} proceeds as follows: |
+The assert statement has no effect in production mode. |
+In checked mode, execution of an assert statement \code{\ASSERT{}($c$, $e$);} |
+proceeds as follows: |
\LMHash{} |
-The expression $c$ is evaluated to an object $o$. If the class of $o$ is a subtype of \code{Function} then let $r$ be the result of invoking $o$ with no arguments. Otherwise, let $r$ be $o$. |
-It is a dynamic type error if $o$ is not of type \code{bool} or of type \code{Function}, or if $r$ is not of type \code{bool}. |
-If $r$ is \FALSE{}, we say that the assertion failed. |
-If $r$ is \TRUE{}, we say that the assertion succeeded. |
-If the assertion succeeded, execution of the assert statement completes normally (\ref{completion}). |
-If the assertion failed, $e$ is evaluated to an object $m$. |
+The expression $c$ is evaluated to an object $r$. |
+It is a dynamic type error if $r$ is not of type \code{bool}. |
+If $r$ is \TRUE{} then execution if the \ASSERT{} statement |
eernst
2017/07/10 10:02:25
Typo: 'execution [o]f'
Lasse Reichstein Nielsen
2017/08/07 11:57:00
Done.
|
+completes normally (\ref{completion}). |
+Otherwise $e$ is evaluated to an object $m$. |
Then the execution of the assert statement throws (\ref{completion}) an \code{AssertionError} containing $m$ and with a stack trace corresponding to the current execution state at the \ASSERT{} statement. |
\LMHash{} |
-It is a static type warning if the type of $e$ may not be assigned to either \code{bool} or $() \rightarrow$ \code{bool}. |
+It is a static type warning if the type of $e$ may not be assigned to \code{bool}. |
-\rationale{Why is this a statement, not a built in function call? Because it is handled magically so it has no effect and no overhead in production mode. Also, in the absence of final methods. one could not prevent it being overridden (though there is no real harm in that). It cannot be viewed as a function call that is being optimized away because the argument might have side effects. |
+\rationale{Why is this a statement, not a built in function call? Because it is handled magically so it has no effect and no overhead in production mode. Also, in the absence of final methods. one could not prevent it being overridden (though there is no real harm in that). It cannot be viewed as a function call that is being optimized away because the argument might have side effects. |
eernst
2017/07/10 10:02:25
Typo: `methods[,] one`.
Might as well add a newlin
Bob Nystrom
2017/07/10 14:42:26
"argument" -> "arguments" now that we have message
Lasse Reichstein Nielsen
2017/08/07 11:57:00
Done.
|
} |
%If a lexically visible declaration named \code{assert} is in scope, an assert statement |