fix: restrict lifting outside of cases expressions on Decidable (#8009)

This PR restricts lifting outside of cases expressions on values of a
Decidable type, since we can't correctly represent the dependency on the
erased proposition in the later stages of the compiler.
This commit is contained in:
Cameron Zwarich 2025-04-17 16:01:56 -07:00 committed by GitHub
parent f0033cd15e
commit 7b292090ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,9 +69,14 @@ mutual
partial def pullDecls (code : Code) : PullM Code := do
match code with
| .cases c =>
withCheckpoint do
let alts ← c.alts.mapMonoM pullAlt
return code.updateAlts! alts
-- At the present time, we can't correctly enforce the dependencies required for lifting
-- out of a cases expression on Decidable, so we disable this optimization.
if c.typeName == ``Decidable then
return code
else
withCheckpoint do
let alts ← c.alts.mapMonoM pullAlt
return code.updateAlts! alts
| .let decl k =>
if (← shouldPull decl) then
pullDecls k