feat: make sure #check produces some result even when there are pending TC problems

Lean 3 uses the same approach.

closes #714
This commit is contained in:
Leonardo de Moura 2021-10-06 13:30:27 -07:00
parent 8ec9fda6c4
commit 1f2e92ea04
4 changed files with 7 additions and 3 deletions

View file

@ -212,7 +212,7 @@ open Meta
@[builtinCommandElab Lean.Parser.Command.check] def elabCheck : CommandElab
| `(#check%$tk $term) => withoutModifyingEnv $ runTermElabM (some `_check) fun _ => do
let e ← Term.elabTerm term none
Term.synthesizeSyntheticMVarsNoPostponing
Term.synthesizeSyntheticMVarsNoPostponing (ignoreStuckTC := true)
let (e, _) ← Term.levelMVarToParam (← instantiateMVars e)
let type ← inferType e
unless e.isSyntheticSorry do

View file

@ -296,8 +296,8 @@ mutual
loop ()
end
def synthesizeSyntheticMVarsNoPostponing : TermElabM Unit :=
synthesizeSyntheticMVars (mayPostpone := false)
def synthesizeSyntheticMVarsNoPostponing (ignoreStuckTC := false) : TermElabM Unit :=
synthesizeSyntheticMVars (mayPostpone := false) (ignoreStuckTC := ignoreStuckTC)
/- Keep invoking `synthesizeUsingDefault` until it returns false. -/
private partial def synthesizeUsingDefaultLoop : TermElabM Unit := do

3
tests/lean/714.lean Normal file
View file

@ -0,0 +1,3 @@
def test {α : Type} [LT α] := List α
#check test

View file

@ -0,0 +1 @@
test : Type