Skip to content

Commit 64ebaad

Browse files
authored
Merge pull request #2490 from FeepingCreature/fix/contracts-dstyle
adjust contracts documentation examples to match dstyle merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
2 parents 4517252 + f49610e commit 64ebaad

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

spec/contracts.dd

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ $(H2 $(LNAME2 pre_post_contracts, Pre and Post Contracts))
7272

7373
$(P The expression form is:)
7474
------
75-
in(expression)
76-
in(expression, "failure string")
77-
out(identifier; expression)
78-
out(identifier; expression, "failure string")
79-
out(; expression)
80-
out(; expression, "failure string")
75+
in (expression)
76+
in (expression, "failure string")
77+
out (identifier; expression)
78+
out (identifier; expression, "failure string")
79+
out (; expression)
80+
out (; expression, "failure string")
8181
{
8282
...function body...
8383
}
@@ -131,10 +131,10 @@ do
131131

132132
------
133133
int fun(ref int a, int b)
134-
in(a > 0)
135-
in(b >= 0, "b cannot be negative!")
136-
out(r; r > 0, "return must be positive")
137-
out(; a != 0)
134+
in (a > 0)
135+
in (b >= 0, "b cannot be negative!")
136+
out (r; r > 0, "return must be positive")
137+
out (; a != 0)
138138
{
139139
// function body
140140
}
@@ -145,7 +145,7 @@ in
145145
assert(a > 0);
146146
assert(b >= 0, "b cannot be negative!");
147147
}
148-
out(r)
148+
out (r)
149149
{
150150
assert(r > 0, "return must be positive");
151151
assert(a != 0);
@@ -219,8 +219,8 @@ class Date
219219
)
220220

221221
------
222-
invariant(1 <= day && day <= 31);
223-
invariant(0 <= hour && hour < 24, "hour out of bounds");
222+
invariant (1 <= day && day <= 31);
223+
invariant (0 <= hour && hour < 24, "hour out of bounds");
224224
------
225225

226226
$(P The invariant is a contract saying that the `assert`s must hold true.

0 commit comments

Comments
 (0)