Skip to content

Commit

Permalink
Add a test illustrating wrong untyping
Browse files Browse the repository at this point in the history
Patterns without named existentials are not correctly constructed. Issue introduced in ocaml#9584
  • Loading branch information
voodoos committed Aug 31, 2021
1 parent b4a6d23 commit 452a9e1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions testsuite/tests/compiler-libs/test_untypeast.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(* TEST
flags = "-I ${ocamlsrcdir}/typing \
-I ${ocamlsrcdir}/parsing"
include ocamlcommon
* expect
*)

let res =
let s = {| match None with Some (Some _) -> () | _ -> () |} in
let pe = Parse.expression (Lexing.from_string s) in
let te = Typecore.type_expression (Env.initial_safe_string) pe in
let ute = Untypeast.untype_expression te in
Format.asprintf "%a" Pprintast.expression ute

[%%expect{|
val res : string = "match None with | Some (Some _) -> () | _ -> ()"
|}]

0 comments on commit 452a9e1

Please sign in to comment.