fix: fixes #1576
This commit is contained in:
parent
16534bacc9
commit
7c3826d3e9
4 changed files with 9 additions and 1 deletions
|
|
@ -19,13 +19,15 @@ macro (name := configElab) doc?:(docComment)? "declare_config_elab" elabName:ide
|
|||
if optConfig.isNone then
|
||||
return { : $type }
|
||||
else
|
||||
let c ← withoutModifyingState <| withLCtx {} {} <| withSaveInfoContext <| Term.withSynthesize do
|
||||
let c ← withoutModifyingStateWithInfoAndMessages <| withLCtx {} {} <| withSaveInfoContext <| Term.withSynthesize do
|
||||
let c ← Term.elabTermEnsuringType optConfig[0][3] (Lean.mkConst ``$type)
|
||||
Term.synthesizeSyntheticMVarsNoPostponing
|
||||
instantiateMVars c
|
||||
eval c
|
||||
)
|
||||
|
||||
#check @evalExpr'
|
||||
|
||||
open Linter.MissingDocs in
|
||||
@[builtinMissingDocsHandler Elab.Tactic.configElab]
|
||||
def checkConfigElab : SimpleHandler := mkSimpleHandler "config elab"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ namespace Lean.Meta
|
|||
unsafe def evalExprCore (α) (value : Expr) (checkType : Expr → MetaM Unit) (safety := DefinitionSafety.safe) : MetaM α :=
|
||||
withoutModifyingEnv do
|
||||
let name ← mkFreshUserName `_tmp
|
||||
let value ← instantiateMVars value
|
||||
if value.hasMVar then
|
||||
throwError "failed to evaluate expression, it contains metavariables{indentExpr value}"
|
||||
let type ← inferType value
|
||||
checkType type
|
||||
let decl := Declaration.defnDecl {
|
||||
|
|
|
|||
1
tests/lean/1576.lean
Normal file
1
tests/lean/1576.lean
Normal file
|
|
@ -0,0 +1 @@
|
|||
example : True := by rw (config := non / sense) []
|
||||
2
tests/lean/1576.lean.expected.out
Normal file
2
tests/lean/1576.lean.expected.out
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
1576.lean:1:35-1:38: error: unknown identifier 'non'
|
||||
1576.lean:1:41-1:46: error: unknown identifier 'sense'
|
||||
Loading…
Add table
Reference in a new issue