| 1 |
(** Bug 4720 : extraction and "with" in module type *) |
| 2 |
|
| 3 |
Module Type A. |
| 4 |
Parameter t : Set. |
| 5 |
End A. |
| 6 |
|
| 7 |
Module A_instance <: A. |
| 8 |
Definition t := nat. |
| 9 |
End A_instance. |
| 10 |
|
| 11 |
Module A_private : A. |
| 12 |
Definition t := nat. |
| 13 |
End A_private. |
| 14 |
|
| 15 |
Module Type B. |
| 16 |
End B. |
| 17 |
|
| 18 |
Module Type C (b : B). |
| 19 |
Declare Module a : A. |
| 20 |
End C. |
| 21 |
|
| 22 |
Module WithMod (a' : A) (b' : B) (c' : C b' with Module a := A_instance). |
| 23 |
End WithMod. |
| 24 |
|
| 25 |
Module WithDef (a' : A) (b' : B) (c' : C b' with Definition a.t := nat). |
| 26 |
End WithDef. |
| 27 |
|
| 28 |
Module WithModPriv (a' : A) (b' : B) (c' : C b' with Module a := A_private). |
| 29 |
End WithModPriv. |
| 30 |
|
| 31 |
(* The initial bug report was concerning the extraction of WithModPriv |
| 32 |
in Coq 8.4, which was suboptimal: it was compiling, but could have been |
| 33 |
turned into some faulty code since A_private and c'.a were not seen as |
| 34 |
identical by the extraction. |
| 35 |
|
| 36 |
In Coq 8.5 and 8.6, the extractions of WithMod, WithDef, WithModPriv |
| 37 |
were all causing Anomaly or Assert Failure. This should be fixed now. |
| 38 |
*) |
| 39 |
|
| 40 |
Require Extraction. |
| 41 |
|
| 42 |
Recursive Extraction WithMod. |
| 43 |
|
| 44 |
Recursive Extraction WithDef. |
| 45 |
|
| 46 |
Recursive Extraction WithModPriv. |
| 47 |
|
| 48 |
(* Let's even check that all this extracted code is actually compilable: *) |
| 49 |
|
| 50 |
Extraction TestCompile WithMod WithDef WithModPriv. |