lean4-htt/tests/elab/forInColErr.lean
Sebastian Graf 40e8f4c5fb
chore: turn on new do elaborator in Core (#12656)
This PR turns on the new `do` elaborator in Init, Lean, Std, Lake and
the testsuite.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 12:38:33 +00:00

55 lines
1.8 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

set_option backward.do.legacy false
set_option pp.mvars.anonymous false
/--
error: typeclass instance problem is stuck
ForIn Id ?_ ?α
Note: Lean will not try to resolve this typeclass instance problem because the second type argument to `ForIn` is a metavariable. This argument must be fully determined before Lean will try to resolve the typeclass.
Hint: Adding type annotations and supplying implicit arguments to functions can give Lean more information for typeclass resolution. For example, if you have a variable `x` that you intend to be a `Nat`, but Lean reports it as having an unresolved type like `?m`, replacing `x` with `(x : Nat)` can get typeclass resolution un-stuck.
-/
#guard_msgs in
example {c} := Id.run do
for x in c do
pure ()
pure ()
/--
error: don't know how to synthesize implicit argument `α`
@List.nil ?_
context:
⊢ Type _
-/
#guard_msgs in
example : Unit := Id.run do
for x in [] do
pure ()
pure ()
/--
error: typeclass instance problem is stuck
ForIn' Id ?_ ?α ?d
Note: Lean will not try to resolve this typeclass instance problem because the second type argument to `ForIn'` is a metavariable. This argument must be fully determined before Lean will try to resolve the typeclass.
Hint: Adding type annotations and supplying implicit arguments to functions can give Lean more information for typeclass resolution. For example, if you have a variable `x` that you intend to be a `Nat`, but Lean reports it as having an unresolved type like `?m`, replacing `x` with `(x : Nat)` can get typeclass resolution un-stuck.
-/
#guard_msgs in
example {c} := Id.run do
for h : x in c do
pure ()
pure ()
/--
error: don't know how to synthesize implicit argument `α`
@List.nil ?_
context:
⊢ Type _
-/
#guard_msgs in
example : Unit := Id.run do
for h : x in [] do
pure ()
pure ()