Skip to content

Commit 94b433f

Browse files
committed
fix more outputs
1 parent d909811 commit 94b433f

5 files changed

Lines changed: 26 additions & 20 deletions

File tree

Manual/BasicTypes/Range.lean

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ Ranges can't be iterated over:
332332
IO.println s!"It's {repr d}"
333333
```
334334
```leanOutput noIter
335-
failed to synthesize instance for 'for_in%' notation
336-
ForIn (EIO IO.Error) (Std.Rcc Day) ?m.11
335+
failed to synthesize instance of type class
336+
ForIn IO (Std.Rcc Day) ?α
337+
338+
Hint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.
337339
```
338340
Nor can they be enumerated, even though the type is finite:
339341
```lean +error (name := noEnum)
@@ -508,8 +510,10 @@ It's also possible to create an iterator that can be enumerated, but it can't ye
508510
IO.println s!"It's {repr d}."
509511
```
510512
```leanOutput iterForNo
511-
failed to synthesize instance for 'for_in%' notation
512-
ForIn (EIO IO.Error) (Std.Iter Day) ?m.12
513+
failed to synthesize instance of type class
514+
ForIn IO (Std.Iter Day) ?α
515+
516+
Hint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.
513517
```
514518

515519
:::

Manual/Iterators.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,10 @@ Because there are infinitely many {name}`Nat`s, using {name}`Iter.ensureTerminat
401401
IO.println s!"{x}"
402402
```
403403
```leanOutput natterm
404-
failed to synthesize instance for 'for_in%' notation
405-
ForIn (EIO IO.Error) (Iter.Total Nat) ?m.12
404+
failed to synthesize instance of type class
405+
ForIn IO (Iter.Total Nat) ?α
406+
407+
Hint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.
406408
```
407409
:::
408410
::::

Manual/Monads/Syntax.lean

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,7 @@ inst✝ : DecidablePred p
607607
xs : Array α
608608
out✝ : Array Nat := #[]
609609
i : Nat
610-
r✝ : Array Nat
611-
out : Array Nat := r✝
610+
out : Array Nat := __s✝
612611
⊢ i < xs.size
613612
-/
614613
#check_msgs in
@@ -822,7 +821,11 @@ The rules are as follows:
822821
set 6
823822
return
824823

825-
/-- error: must be last element in a `do` sequence -/
824+
/--
825+
warning: This `do` element and its control-flow region are dead code. Consider removing it.
826+
---
827+
info: ((), 6)
828+
-/
826829
#check_msgs in
827830
#eval (·.run 0) <| show StateM Nat Unit from do
828831
set 5
@@ -875,7 +878,7 @@ end
875878
set_option pp.all true
876879

877880
/--
878-
info: @Bind.bind.{0, 0} m (@Monad.toBind.{0, 0} m inst✝) Unit α e1 fun (x : PUnit.{1}) => es : m α
881+
info: @Bind.bind.{0, 0} m (@Monad.toBind.{0, 0} m inst✝) PUnit.{1} α e1 fun (__r : PUnit.{1}) => es : m α
879882
-/
880883
#check_msgs in
881884
#check do e1; es
@@ -899,7 +902,8 @@ variable {e1 : m β} {e2 : m γ} {f : β → γ → m Unit} {g : γ → α} {h :
899902
/--
900903
info: @Bind.bind.{0, 0} m (@Monad.toBind.{0, 0} m inst✝) β α e1 fun (__do_lift : β) =>
901904
@Bind.bind.{0, 0} m (@Monad.toBind.{0, 0} m inst✝) γ α e2 fun (__do_lift_1 : γ) =>
902-
@Bind.bind.{0, 0} m (@Monad.toBind.{0, 0} m inst✝) Unit α (f __do_lift __do_lift_1) fun (x : PUnit.{1}) => es : m α
905+
@Bind.bind.{0, 0} m (@Monad.toBind.{0, 0} m inst✝) PUnit.{1} α (f __do_lift __do_lift_1) fun (__r : PUnit.{1}) =>
906+
es : m α
903907
-/
904908
#check_msgs in
905909
#check do f (← e1) (← e2); es

Manual/NotationsMacros/DoElab.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ This means that mutable variables in the surrounding block cannot be modified:
208208
return y
209209
```
210210
```leanOutput noMutFreeze
211-
`y` cannot be mutated, only variables declared using `let mut` can be mutated. If you did not intend to mutate but define `y`, consider using `let y` instead
211+
Variable `y` cannot be mutated. Only variables declared using `let mut` can be mutated.
212+
If you did not intend to mutate but define `y`, consider using `let y` instead
212213
```
213214
Additionally, an early {keywordOf Lean.Parser.Term.doReturn}`return` exits the inner {keywordOf Lean.Parser.Term.do}`do`, rather than the surrounding one, as indicated by the fact that it is expected to return a {lean}`Unit` (in this case, the universe-polymorphic {name}`PUnit`):
214215
```lean +error (name := noInnerReturn)
@@ -221,14 +222,12 @@ Additionally, an early {keywordOf Lean.Parser.Term.doReturn}`return` exits the i
221222
return y
222223
```
223224
```leanOutput noInnerReturn
224-
Application type mismatch: The argument
225+
Type mismatch
225226
x
226227
has type
227228
Nat
228229
but is expected to have type
229230
PUnit
230-
in the application
231-
pure x
232231
```
233232
::::
234233

Manual/VCGen.lean

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,8 @@ xs x : List α✝
500500
h : (rev xs).run = x
501501
out✝ : List α✝ := []
502502
⊢ (wp⟦do
503-
let r ←
504-
forIn xs out✝ fun x r => do
505-
pure PUnit.unit
506-
pure (ForInStep.yield (x :: r))
507-
pure r⟧
503+
let __s ← forIn xs out✝ fun x __s => pure (ForInStep.yield (x :: __s))
504+
pure __s⟧
508505
(PostCond.noThrow fun a => { down := a = xs.reverse })).down
509506
```
510507
When the verification condition is just the original problem, without even any simplification of {name}`bind`, the problem is usually a missing {name}`WPMonad` instance.

0 commit comments

Comments
 (0)