You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would think that this is how you'd use a contractual iterator:
import
std / [sequtils],
contracts
iteratormyIter(x: openArray[int]): int {.contractual.} =
require:
x.len ==11
ensure:
true
body:
for i in x:
yield i
for i in (0..10).toSeq.myIter:
echo i
But the ast produced is illformed:
/path/to/test.nim(5, 43) template/generic instantiation of `contractual` from here
/path/to/.nimble/pkgs2/contracts-0.2.2-511e9dbea3f5cab286a34f1bbe760bdf96c7b250/contracts/contexts/handlers/conIter.nim(51, 10) Warning: Loop contracts are known to be buggy as for now, use with caution. [User]
/path/to/test.nim(5, 43) template/generic instantiation of `contractual` from here
/path/to/test.nim(10, 3) Error: illformed AST: block key_impl:
for i in x:
yielded = i
yield i
If my current pr is responded to I'll dive in and try to fix this, then the documentation bug.
The text was updated successfully, but these errors were encountered:
I would think that this is how you'd use a contractual iterator:
But the ast produced is illformed:
If my current pr is responded to I'll dive in and try to fix this, then the documentation bug.
The text was updated successfully, but these errors were encountered: