Skip to content

Commit f2cd4eb

Browse files
committed
try fix
1 parent e9df183 commit f2cd4eb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Lean/Elab/Extra.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private def throwForInFailure (forInInstance : Expr) : TermElabM Expr :=
5555
match stx with
5656
| `(for_in'% $col $init $body) =>
5757
tryPostponeIfNoneOrMVar expectedType?
58-
let colE ← elabTerm col none
58+
let colE ← withSynthesizeLight (elabTerm col none)
5959
let m ← getMonadForIn expectedType?
6060
let colType ← inferType colE
6161
let elemType ← mkFreshExprMVar (mkSort (mkLevelSucc (← mkFreshLevelMVar)))
@@ -65,6 +65,7 @@ private def throwForInFailure (forInInstance : Expr) : TermElabM Expr :=
6565
mkAppM ``ForIn' #[m, colType, elemType, memType]
6666
catch _ =>
6767
tryPostpone; throwError "failed to construct `ForIn'` instance for collection{indentExpr colType}\nand monad{indentExpr m}"
68+
synthesizeSyntheticMVarsUsingDefault
6869
match (← trySynthInstance forInInstance) with
6970
| .some inst =>
7071
let forInFn ← mkConst ``forIn'

tests/lean/run/rangePolymorphic.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ def h (n : Nat) : IO Unit := do
5757
for i in *...n, j in 2...* do
5858
IO.println s!"i={i}, j={j}"
5959

60+
example : Unit := Id.run do
61+
for _h : _i in 4...<12 do
62+
pure .unit
63+
6064
/--
6165
info: i=0, j=2
6266
i=1, j=3

0 commit comments

Comments
 (0)