fix: bug at trivialStructToMono

This commit is contained in:
Leonardo de Moura 2022-10-06 06:10:17 -07:00
parent 08bfb7060d
commit d409ad75b5

View file

@ -102,11 +102,11 @@ partial def trivialStructToMono (info : TrivialStructureInfo) (c : Cases) : Comp
assert! ctorName == info.ctorName
assert! info.fieldIdx < ps.size
let p := ps[info.fieldIdx]!
let k ← k.toMono
eraseParams ps
/- We reuse `p`s `fvarId` to avoid substitution -/
let decl := { fvarId := p.fvarId, binderName := p.binderName, type := (← p.type.toMono), value := .fvar c.discr }
let decl := { fvarId := p.fvarId, binderName := p.binderName, type := (← toMonoType p.type), value := .fvar c.discr }
modifyLCtx fun lctx => lctx.addLetDecl decl
let k ← k.toMono
return .let decl k
partial def Code.toMono (code : Code) : CompilerM Code := do