refactor: use coercion meta API

This commit is contained in:
Gabriel Ebner 2022-12-21 11:50:04 -08:00
parent 05401776f2
commit 8a48a8f119

View file

@ -197,11 +197,9 @@ where
-- Auxiliary function used at `analyze`
private def hasCoe (fromType toType : Expr) : TermElabM Bool := do
if (← getEnv).contains ``CoeHTCT then
let u ← getLevel fromType
let v ← getLevel toType
let coeInstType := mkAppN (Lean.mkConst ``CoeHTCT [u, v]) #[fromType, toType]
match ← trySynthInstance coeInstType (some (maxCoeSize.get (← getOptions))) with
if (← getEnv).contains ``CoeT then
withLocalDeclD `x fromType fun x => do
match ← coerceSimple? x toType with
| .some _ => return true
| .none => return false
| .undef => return false -- TODO: should we do something smarter here?