Skip to content

Commit

Permalink
Fix ocaml#10763 (miscompilation of method delegation)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alain Frisch committed Nov 10, 2021
1 parent 17561dc commit d0c2c38
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lambda/translclass.ml
Original file line number Diff line number Diff line change
Expand Up @@ -529,20 +529,13 @@ let transl_class_rebind ~scopes cl vf =

(* Rewrite a closure using builtins. Improves native code size. *)

let rec module_path = function
Lvar id ->
let s = Ident.name id in s <> "" && s.[0] >= 'A' && s.[0] <= 'Z'
| Lprim(Pfield _, [p], _) -> module_path p
| Lprim(Pgetglobal _, [], _) -> true
| _ -> false

let const_path local = function
Lvar id -> not (List.mem id local)
| Lconst _ -> true
| Lfunction {kind = Curried; body} ->
let fv = free_variables body in
List.for_all (fun x -> not (Ident.Set.mem x fv)) local
| p -> module_path p
| _ -> false

let rec builtin_meths self env env2 body =
let const_path = const_path (env::self) in
Expand Down

0 comments on commit d0c2c38

Please sign in to comment.