summaryrefslogtreecommitdiff
path: root/test/Moretest
diff options
context:
space:
mode:
authorLuc Maranget <luc.maranget@inria.fr>2002-10-01 12:49:53 +0000
committerLuc Maranget <luc.maranget@inria.fr>2002-10-01 12:49:53 +0000
commitaea14e3bb46893ecd51c8bc4466fabb6c007fb81 (patch)
tree76eea585d805ccc21f82f0fc0a070662bc0e1bc7 /test/Moretest
parent25e2363a720f03e3d70b132183f70e56d0a0cc3a (diff)
downloadocaml-aea14e3bb46893ecd51c8bc4466fabb6c007fb81.tar.gz
Petite discussion avec Jacques.
1 Pb typage variants, en attente, exemple dans test/Moretest/morematch.ml 2 Meilleure compilation des switch de variants -> bytecomp/switch.ml a Vider la table t en cas de changement de ok_inter b Traiter les intervalles de taille 1 meme si !ok_inter = false git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5153 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'test/Moretest')
-rw-r--r--test/Moretest/morematch.ml28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Moretest/morematch.ml b/test/Moretest/morematch.ml
index b708e4bb36..f9b92a5ba3 100644
--- a/test/Moretest/morematch.ml
+++ b/test/Moretest/morematch.ml
@@ -1043,3 +1043,31 @@ test "seb" seb ((0,Uout),Uin) 2 ;
()
;;
+(* Talk with Jacques
+ - type 'b is still open ??
+ - better case generation, accept intervals of size 1 when ok_inter is
+ false (in Switch)
+*)
+
+(*
+File "morematch.ml", line 1060, characters 8-65:
+Warning: this pattern-matching is not exhaustive.
+Here is an example of a value that is not matched:
+A `D
+*)
+type ('a, 'b) t_j = A of 'a | B of 'b * 'a | C
+
+let f = function
+ | A (`A|`C) -> 0
+ | B (`B,`D) -> 1
+ | C -> 2
+
+let g x = try f x with Match_failure _ -> 3
+
+let _ =
+ test "jacques" g (A `A) 0 ;
+ test "jacques" g (A `C) 0 ;
+ test "jacques" g (B (`B,`D)) 1 ;
+ test "jacaues" g C 2 ;
+ test "jacques" g (B (`A,`D)) 3 ;
+ ()