From 95b4a54ec6a9aacffe8c11df1b443d36b9f6dda7 Mon Sep 17 00:00:00 2001 From: Pierre Letouzey Date: Tue, 12 May 2015 16:48:01 +0200 Subject: Extraction: fix the detection of the "polyprop" situation The ~polyprop argument wasn't propagated properly anymore, leading the extraction to try to operate on situations it cannot handle (yet). Cf Table.error_singleton_become_prop for more details. Regression test added. --- kernel/inductive.ml | 2 +- test-suite/success/extraction_polyprop.v | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test-suite/success/extraction_polyprop.v diff --git a/kernel/inductive.ml b/kernel/inductive.ml index ca814f497c..088b99b9e0 100644 --- a/kernel/inductive.ml +++ b/kernel/inductive.ml @@ -214,7 +214,7 @@ let constrained_type_of_inductive_knowing_parameters env ((mib,mip),u as pind) a (ty, cst) let type_of_inductive_knowing_parameters env ?(polyprop=false) mip args = - type_of_inductive_gen env mip args + type_of_inductive_gen ~polyprop env mip args (* The max of an array of universes *) diff --git a/test-suite/success/extraction_polyprop.v b/test-suite/success/extraction_polyprop.v new file mode 100644 index 0000000000..7215bd9905 --- /dev/null +++ b/test-suite/success/extraction_polyprop.v @@ -0,0 +1,11 @@ +(* The current extraction cannot handle this situation, + and shouldn't try, otherwise it might produce some Ocaml + code that segfaults. See Table.error_singleton_become_prop + or S. Glondu's thesis for more details. *) + +Definition f {X} (p : (nat -> X) * True) : X * nat := + (fst p 0, 0). + +Definition f_prop := f ((fun _ => I),I). + +Fail Extraction f_prop. -- cgit v1.2.3