feat: use at least default transparency at toCtorWhenK
Improves the effectiveness of `simp` when reducing `match`-expr.
This commit is contained in:
parent
999e80745e
commit
32dd3c6b29
1 changed files with 4 additions and 1 deletions
|
|
@ -99,7 +99,10 @@ private def toCtorWhenK (recVal : RecursorVal) (major : Expr) : MetaM Expr := do
|
|||
else do
|
||||
let (some newCtorApp) ← mkNullaryCtor majorType recVal.numParams | pure major
|
||||
let newType ← inferType newCtorApp
|
||||
if (← isDefEq majorType newType) then
|
||||
/- TODO: check whether changing reducibility to default hurts performance here.
|
||||
We do that to make sure auxiliary `Eq.rec` introduced by the `match`-compiler
|
||||
are reduced even when `TransparencyMode.reducible` (like in `simp`) -/
|
||||
if (← withAtLeastTransparency TransparencyMode.default <| isDefEq majorType newType) then
|
||||
return newCtorApp
|
||||
else
|
||||
return major
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue