Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rectypes: compiler with implicts hangs but normal one gives an error (as expected). #50

Open
Kakadu opened this issue Apr 19, 2016 · 0 comments

Comments

@Kakadu
Copy link

Kakadu commented Apr 19, 2016

I'm kind of confused. I hope I will wake up in the morning and it will stop hanging
Happens both in default opam version (see log below) and mine 4.02.3+implicits. When I write ~init:start it seems not to hang.

➜  /tmp evalopam 
4.02.1+dev0-2014-08-29
/home/kakadu/.opam/4.02.0+modular-implicits/lib/ocaml
➜  /tmp cat a.ml 
open Printf
open Asttypes
open Parsetree
open Longident
open StdLabels


let is_fresh e =
  match e.pexp_desc with
  | Pexp_ident i when i.txt = Longident.Lident "fresh" -> true
  | _ -> false



let list_fold ~f xs =
  match xs with
  | [] -> failwith "bad argument"
  | start::xs -> List.fold_left ~init:(f start) ~f xs

let rec pamk_e mapper e : expression =
  match e.pexp_desc with
  | Pexp_apply (e1, (_,args) :: body) when is_fresh e1 -> begin
      let new_body : expression =
        match body with
        | [(_,body)] -> pamk_e mapper body
        | ____ ->
           list_fold (List.rev body)
                     ~f:(fun acc (_,x) -> [%expr [%e (pamk_e mapper x)] &&& [%e acc]])

      in
      {e with pexp_desc=Pexp_apply (e1,[Papp_simple,new_body]) }
    end
  | _ -> e
➜  /tmp ocamlfind ocamlc -c -g -package compiler-libs.common -rectypes a.ml
findlib: [WARNING] Interface topdirs.cmi occurs in several directories: /home/kakadu/.opam/4.02.0+modular-implicits/lib/ocaml, /home/kakadu/.opam/4.02.0+modular-implicits/lib/ocaml/compiler-libs
ocamlc.opt got signal and exited

P.S. rectypes switch causes the hanging!

@Kakadu Kakadu changed the title Compiler hangs?! Or does it happen only on my machine? Compiler hangs with implict compiler but gives an error with normal one. Apr 20, 2016
@Kakadu Kakadu changed the title Compiler hangs with implict compiler but gives an error with normal one. Rectypes: compiler with implicts hangs but normal one gives an error (as expected). Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant