refactor: split noncomputable error into its own helper (#9314)
This commit is contained in:
parent
d4e11f754a
commit
e2e36087e1
1 changed files with 4 additions and 1 deletions
|
|
@ -23,9 +23,12 @@ def Param.toMono (param : Param) : ToMonoM Param := do
|
|||
modify fun s => { s with typeParams := s.typeParams.insert param.fvarId }
|
||||
param.update (← toMonoType param.type)
|
||||
|
||||
def throwNoncomputableError {α : Type} (declName : Name) : ToMonoM α :=
|
||||
throwNamedError lean.dependsOnNoncomputable m!"failed to compile definition, consider marking it as 'noncomputable' because it depends on '{.ofConstName declName}', which is 'noncomputable'"
|
||||
|
||||
def checkFVarUse (fvarId : FVarId) : ToMonoM Unit := do
|
||||
if let some declName := (← get).noncomputableVars.get? fvarId then
|
||||
throwNamedError lean.dependsOnNoncomputable m!"failed to compile definition, consider marking it as 'noncomputable' because it depends on '{.ofConstName declName}', which is 'noncomputable'"
|
||||
throwNoncomputableError declName
|
||||
|
||||
def checkFVarUseDeferred (resultFVar fvarId : FVarId) : ToMonoM Unit := do
|
||||
if let some declName := (← get).noncomputableVars.get? fvarId then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue