diff options
| author | Thomas Bauereiss | 2020-03-27 01:19:40 +0000 |
|---|---|---|
| committer | Thomas Bauereiss | 2020-04-10 13:22:11 +0100 |
| commit | 3ec7f6d6373b6b8b5011daecbcf712f5a9d2dc7c (patch) | |
| tree | 33957d9e6a1c32e7a94e30b24bab0129acf8de6a /test/typecheck | |
| parent | 8d28bb30b0ff1812fa0ad58147d42cddde3099da (diff) | |
Be more careful when flow-typing loops
Asserting constraints from the loop condition in the body is fine for
while-loops, but doesn't make sense for until-loops.
Diffstat (limited to 'test/typecheck')
| -rw-r--r-- | test/typecheck/pass/repeat_constraint.sail | 9 | ||||
| -rw-r--r-- | test/typecheck/pass/repeat_constraint/v1.expect | 6 | ||||
| -rw-r--r-- | test/typecheck/pass/repeat_constraint/v1.sail | 9 |
3 files changed, 24 insertions, 0 deletions
diff --git a/test/typecheck/pass/repeat_constraint.sail b/test/typecheck/pass/repeat_constraint.sail new file mode 100644 index 00000000..6d63f2e8 --- /dev/null +++ b/test/typecheck/pass/repeat_constraint.sail @@ -0,0 +1,9 @@ +$include <flow.sail> + +val main : unit -> unit + +function main() = { + repeat { + _not_prove(constraint(false)); + } until (false); +} diff --git a/test/typecheck/pass/repeat_constraint/v1.expect b/test/typecheck/pass/repeat_constraint/v1.expect new file mode 100644 index 00000000..9d561e11 --- /dev/null +++ b/test/typecheck/pass/repeat_constraint/v1.expect @@ -0,0 +1,6 @@ +Type error: +[[96mrepeat_constraint/v1.sail[0m]:7:4-29 +7[96m |[0m _prove(constraint(false)); + [91m |[0m [91m^-----------------------^[0m + [91m |[0m Cannot prove false + [91m |[0m diff --git a/test/typecheck/pass/repeat_constraint/v1.sail b/test/typecheck/pass/repeat_constraint/v1.sail new file mode 100644 index 00000000..5dd2f513 --- /dev/null +++ b/test/typecheck/pass/repeat_constraint/v1.sail @@ -0,0 +1,9 @@ +$include <flow.sail> + +val main : unit -> unit + +function main() = { + repeat { + _prove(constraint(false)); + } until (false); +} |
