|
| 1 | +From MetaCoq.Template Require Import All. |
| 2 | + |
| 3 | +Import MCMonadNotation. |
| 4 | +Import bytestring. |
| 5 | +Open Scope bs. |
| 6 | +Open Scope list_scope. |
| 7 | + |
| 8 | +Universes u0 u1. |
| 9 | +Constraint u0 < u1. |
| 10 | +MetaCoq Run (u <- tmQuote Type@{u0};; |
| 11 | + v <- tmTry (tmUnquoteTyped Type@{u0} u);; |
| 12 | + match v with |
| 13 | + | my_Value v => tmPrint (v -> True);; tmFail "first should not succeed" |
| 14 | + | my_Error _ => v' <- tmUnquoteTyped Type@{u1} u;; |
| 15 | + ret (v' -> False) |
| 16 | + end >>= tmPrint). |
| 17 | + |
| 18 | +(*MetaCoq Run (tmDefinition "a" I;; tmTry (tmDefinition "a" I) >>= tmPrint).*) |
| 19 | +(*a is defined |
| 20 | +
|
| 21 | +Error: Anomaly "in Univ.repr: Universe MetaCoq.TestSuite.tmTry.101 undefined." Please report at http://coq.inria.fr/bugs/.*) |
| 22 | +(*MetaCoq Run (tmTry (tmDefinition "b" I);; mp <- tmCurrentModPath tt;; tmUnquote (tConst (mp, "b") []) >>= tmPrint).*) |
| 23 | +(*Error: Anomaly "Constant MetaCoq.TestSuite.tmTry.b does not appear in the environment." |
| 24 | +Please report at http://coq.inria.fr/bugs/.*) |
| 25 | +(*MetaCoq Run (tmDefinition "c" I;; mp <- tmCurrentModPath tt;; |
| 26 | + v <- tmTry (tmUnquoteTyped False (tConst (mp, "c") []));; |
| 27 | + match v with |
| 28 | + | my_Value v => ret (inl v) |
| 29 | + | my_Error _ => v' <- tmUnquoteTyped True (tConst (mp, "c") []);; |
| 30 | + ret (inr v') |
| 31 | + end >>= tmPrint).*) |
| 32 | +(*Error: Anomaly "in Univ.repr: Universe MetaCoq.TestSuite.tmTry.172 undefined." Please report at http://coq.inria.fr/bugs/.*) |
| 33 | +MetaCoq Run (tmAxiom "a'" True;; tmTry (tmAxiom "a'" True) >>= tmPrint). |
| 34 | +(*MetaCoq Run (tmTry (tmAxiom "b'" True);; mp <- tmCurrentModPath tt;; tmUnquote (tConst (mp, "b'") []) >>= tmPrint).*) |
| 35 | +(*Error: Anomaly "Constant MetaCoq.TestSuite.tmTry.b' does not appear in the environment." |
| 36 | +Please report at http://coq.inria.fr/bugs/.*) |
| 37 | +MetaCoq Run (tmAxiom "c'" True;; mp <- tmCurrentModPath tt;; |
| 38 | + v <- tmTry (tmUnquoteTyped False (tConst (mp, "c'") []));; |
| 39 | + match v with |
| 40 | + | my_Value v => tmPrint v;; tmFail "too early" |
| 41 | + | my_Error _ => v' <- tmUnquoteTyped True (tConst (mp, "c'") []);; |
| 42 | + ret v' |
| 43 | + end >>= tmPrint). |
0 commit comments