fix: do not create coercion placeholder if function is partially applied

This commit is contained in:
Leonardo de Moura 2022-07-06 18:38:11 -07:00
parent 645c3e777d
commit c5e00c2bde

View file

@ -349,11 +349,13 @@ private def finalize : M Expr := do
from test `948.lean`. There are multiple ways to infer `X`, and we don't want to mark it as `syntheticOpaque`.
-/
if let some outParamMVarId := s.resultTypeOutParam? then
if (← isExprMVarAssigned outParamMVarId) then
pure false
else
/- If `eType != mkMVar outParamMVarId`, then the
function is partially applied, and we do not create coercion placeholder. -/
if !(← isExprMVarAssigned outParamMVarId) && eType.isMVar && eType.mvarId! == outParamMVarId then
setMVarKind outParamMVarId .syntheticOpaque
pure true
else
pure false
else
pure false
if shouldCreateCoe then