File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,47 +18,6 @@ open MeasureTheory ProbabilityTheory
1818
1919namespace Test.Gaps
2020
21- /-! ## `for` over several collections
22-
23- TODO: the expander at `RandomDo/Monad/Notation.lean:141` wraps the loop body in a fresh term-level
24- `rdo` block, which severs it from the block around it. Emitting `do $body` instead — a nested
25- `doElem`, which is what core's otherwise identical expander does — fixes all three tests below.
26- -/
27-
28- /--
29- error: Variable `s` cannot be mutated. Only variables declared using `let mut` can be mutated.
30- If you did not intend to mutate but define `s`, consider using `let s` instead
31- -/
32- #guard_msgs in
33- def zipMut (xs ys : List ℕ) : IdM ℕ := rdo
34- let mut s := 0
35- for x in xs, y in ys rdo
36- s := s + x * y
37- return s
38-
39- /--
40- error: Type mismatch
41- some x
42- has type
43- Option ℕ
44- but is expected to have type
45- Unit
46- -/
47- #guard_msgs in
48- def zipReturn (xs ys : List ℕ) : IdM (Option ℕ) := rdo
49- for x in xs, y in ys rdo
50- if x = y then
51- return some x
52- return none
53-
54- /-- error: `break` must be nested inside a loop -/
55- #guard_msgs in
56- def zipThree (xs ys zs : List ℕ) : IdM Bool := rdo
57- for x in xs, y in ys, z in zs rdo
58- if x + y = z then
59- return true
60- return false
61-
6221/-! ## Nested loops
6322
6423TODO: register a `ControlInfo` inference handler for `RDo.rdoFor`, mirroring the rule core states
You can’t perform that action at this time.
0 commit comments