aboutsummaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorKazuhiko Sakaguchi2019-07-25 20:09:28 +0200
committerKazuhiko Sakaguchi2019-07-31 19:40:52 +0200
commitbb64d76f9fe80ecdef4f09c797914022783ccb80 (patch)
tree968756ad91e0a8b6a69284716709ffa2c04cfbc8 /test-suite
parent4e679df3c15e5e554ff9ef85138f9c55396e9f0b (diff)
Fix #7348: extraction of dependent record projections
- Inline record projections by default (except for Haskell extraction). - Extend `pp_record_proj` for record projections involving `MLmagic`. - Remove special treatments for pretty-printing for record projections other than `pp_record_proj`. - `micromega.ml` had to be changed due to this change of the extraction plugin. Acknowledgement: This work is financially supported by Peano System Inc. on-behalf-of: @peano-system <info@peano-system.jp>
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/output/bug7348.out45
-rw-r--r--test-suite/output/bug7348.v25
2 files changed, 70 insertions, 0 deletions
diff --git a/test-suite/output/bug7348.out b/test-suite/output/bug7348.out
new file mode 100644
index 0000000000..325ee95ae2
--- /dev/null
+++ b/test-suite/output/bug7348.out
@@ -0,0 +1,45 @@
+Extracted code successfully compiled
+
+type __ = Obj.t
+
+type unit0 =
+| Tt
+
+type bool =
+| True
+| False
+
+module Case1 =
+ struct
+ type coq_rec = { f : bool }
+
+ (** val f : bool -> coq_rec -> bool **)
+
+ let f _ r =
+ r.f
+
+ (** val silly : bool -> coq_rec -> __ **)
+
+ let silly x b =
+ match x with
+ | True -> Obj.magic b.f
+ | False -> Obj.magic Tt
+ end
+
+module Case2 =
+ struct
+ type coq_rec = { f : (bool -> bool) }
+
+ (** val f : bool -> coq_rec -> bool -> bool **)
+
+ let f _ r =
+ r.f
+
+ (** val silly : bool -> coq_rec -> __ **)
+
+ let silly x b =
+ match x with
+ | True -> Obj.magic b.f False
+ | False -> Obj.magic Tt
+ end
+
diff --git a/test-suite/output/bug7348.v b/test-suite/output/bug7348.v
new file mode 100644
index 0000000000..782b27ce96
--- /dev/null
+++ b/test-suite/output/bug7348.v
@@ -0,0 +1,25 @@
+Require Extraction.
+
+Extraction Language OCaml.
+Set Extraction KeepSingleton.
+
+Module Case1.
+
+Record rec (x : bool) := { f : bool }.
+
+Definition silly x (b : rec x) :=
+ if x return (if x then bool else unit) then f x b else tt.
+
+End Case1.
+
+Module Case2.
+
+Record rec (x : bool) := { f : bool -> bool }.
+
+Definition silly x (b : rec x) :=
+ if x return (if x then bool else unit) then f x b false else tt.
+
+End Case2.
+
+Extraction TestCompile Case1.silly Case2.silly.
+Recursive Extraction Case1.silly Case2.silly.