fix: avoid "unknown constant" error message for auxiliary declarations

This commit is contained in:
Leonardo de Moura 2022-09-18 15:39:58 -07:00
parent 5fbe63cca4
commit 70f615d074
2 changed files with 2 additions and 2 deletions

View file

@ -855,7 +855,7 @@ simplification opportunities by eta-expanding them.
def etaPolyApp? (letDecl : LetDecl) : OptionT SimpM FunDecl := do
guard <| (← read).config.etaPoly
let .const declName _ := letDecl.value.getAppFn | failure
let info ← getConstInfo declName
let some info := (← getEnv).find? declName | failure
guard <| hasLocalInst info.type
guard <| !(← Meta.isInstance declName)
let some decl ← getStage1Decl? declName | failure

View file

@ -37,7 +37,7 @@ def getStage1Decl? (declName : Name) : CoreM (Option Decl) := do
match stage1Ext.getState (← getEnv) |>.decls.find? declName with
| some decl => return decl
| none =>
let info ← getConstInfo declName
let some info := (← getEnv).find? declName | return none
if info.hasValue then
let decls ← compileStage1 info.all.toArray
return decls.find? fun decl => declName == decl.name