You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling tmMkDefinition discards the current evar map. Here is the relevant code (in `template-coq/run_template_monad.ml") :
`TmDefininition` case
let name = unquote_ident (reduce_all env evm name) inlet opaque = unquote_bool (reduce_all env evm opaque) inlet evm, typ = (match unquote_option s withSomes ->let red = unquote_reduction_strategy env evm s inPlugin_core.reduce env evm red typ |None -> evm, typ) inlet cinfo =Declare.CInfo.make ~name()~typ:(Some (EConstr.of_constr typ)) inlet info =Declare.Info.make ~poly~kind:(Decls.IsDefinitionDecls.Definition) ()inlet n =Declare.declare_definition ~cinfo~info~opaque~body:(EConstr.of_constr body) evm inlet env =Global.env ()in(* Careful, universes in evm were modified for the declaration of def *)let evm =Evd.from_env env inlet evm, c =Evd.fresh_global (Global.env ()) evm n in
k ~st env evm (EConstr.to_constr evm c)
And here is a MWE to reproduce the bug :
From MetaCoq.Template RequireImportAll.
From MetaCoq.Utils RequireImport monad_utils.
Import MCMonadNotation.
Unset MetaCoq Strict Unquote UniverseMode.
Definition test :=
mlet t1 <- tmUnquoteTyped Type (tSort (sType (Universe.make' fresh_level))) ;;
mlet t2 <- tmUnquoteTyped Type (tSort (sType (Universe.make' fresh_level))) ;;
tmPrint (t1, t2) ;;
tmDefinitionRed "t1"%bs None t1 ;;
tmDefinitionRed "t2"%bs None t2.
Fail MetaCoq Run test.
(* The command has indeed failed with message: Undeclared universe: Bug.174 (maybe a bugged tactic).*)
The test function creates two universes (which you can check from the tmPrint output), and the second call to tmDefinitionRed fails because the universe of t2 is undeclared (indeed we discarded the evar map).
The text was updated successfully, but these errors were encountered:
Calling
tmMkDefinition
discards the current evar map. Here is the relevant code (in `template-coq/run_template_monad.ml") :`TmDefininition` case
And here is a MWE to reproduce the bug :
The
test
function creates two universes (which you can check from thetmPrint
output), and the second call totmDefinitionRed
fails because the universe oft2
is undeclared (indeed we discarded the evar map).The text was updated successfully, but these errors were encountered: