fix: erase code of an erased type in LCNF simp (#8712)

This PR optimizes let decls of an erased type to an erased value.
Specialization can create local functions that produce a Prop, and
there's no point in keeping them around.
This commit is contained in:
Cameron Zwarich 2025-06-10 17:58:55 -07:00 committed by GitHub
parent c53ab2835c
commit 0b2884bfa3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -224,6 +224,9 @@ partial def simp (code : Code) : SimpM Code := withIncRecDepth do
let mut decl ← normLetDecl baseDecl
if baseDecl != decl then
markSimplified
if decl.type.isErased && decl.value != .erased then
markSimplified
decl ← decl.updateValue .erased
if let some value ← simpValue? decl.value then
markSimplified
decl ← decl.updateValue value