doc: coeAtOutParam todo's

This commit is contained in:
Leonardo de Moura 2022-07-06 18:58:40 -07:00
parent f8c7bd71aa
commit 01d0ca8cfe
2 changed files with 6 additions and 0 deletions

View file

@ -172,6 +172,9 @@ where
let (mvars, bis, _) ← forallMetaTelescopeReducing (← inferType candidate)
let candidate := mkAppN candidate mvars
trace[Elab.defaultInstance] "{toString (mkMVar mvarId)}, {mkMVar mvarId} : {← inferType (mkMVar mvarId)} =?= {candidate} : {← inferType candidate}"
/- The `coeAtOutParam` feature may mark output parameters of local instances as `syntheticOpaque`.
This kind of parameter is not assignable by default. We use `withAssignableSyntheticOpaque` to workaround this behavior
when processing default instances. TODO: try to avoid `withAssignableSyntheticOpaque`. -/
if (← withAssignableSyntheticOpaque <| isDefEqGuarded (mkMVar mvarId) candidate) then
-- Succeeded. Collect new TC problems
trace[Elab.defaultInstance] "isDefEq worked {mkMVar mvarId} : {← inferType (mkMVar mvarId)} =?= {candidate} : {← inferType candidate}"

View file

@ -690,6 +690,9 @@ def synthInstance? (type : Expr) (maxResultSize? : Option Nat := none) : MetaM (
let (_, _, result) ← openAbstractMVarsResult result
trace[Meta.synthInstance] "result {result}"
let resultType ← inferType result
/- Output parameters of local instances may be marked as `syntheticOpaque` by the application-elaborator.
We use `withAssignableSyntheticOpaque` to make sure this kind of parameter can be assigned by the following `isDefEq`.
TODO: rewrite this check to avoid `withAssignableSyntheticOpaque`. -/
if (← withDefault <| withAssignableSyntheticOpaque <| isDefEq type resultType) then
let result ← instantiateMVars result
/- We use `check` to propogate universe constraints implied by the `result`.