diff options
| author | Guillaume Melquiond | 2021-03-23 10:20:10 +0100 |
|---|---|---|
| committer | Guillaume Melquiond | 2021-03-23 10:26:34 +0100 |
| commit | 01b061f0082a70f66016e78075a5952af8ed5431 (patch) | |
| tree | 553a92be14949cf81f5520c177781c09a96997af /plugins | |
| parent | 1f7875b9c457aad27cd5ee8bfe2dd12898926cb2 (diff) | |
Do not match on record types with mutable fields in function arguments.
This tends to confuse the OCaml compiler, for good reasons. Indeed, if
there are mutable fields, the generated code cannot wait for the function
to be fully applied. It needs to recover the value of the mutable fields
as early as possible, and thus to create a closure.
Example:
let foo {bar} x = ...
is compiled as
let foo y = match y with {bar} -> fun x -> ...
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/extraction/mlutil.ml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/extraction/mlutil.ml b/plugins/extraction/mlutil.ml index da4a50b674..cfdaac710b 100644 --- a/plugins/extraction/mlutil.ml +++ b/plugins/extraction/mlutil.ml @@ -217,13 +217,13 @@ module Mlenv = struct (* Adding a type with no [Tvar], hence no generalization needed. *) - let push_type {env=e;free=f} t = - { env = (0,t) :: e; free = find_free f t} + let push_type mle t = + { env = (0,t) :: mle.env; free = find_free mle.free t} (* Adding a type with no [Tvar] nor [Tmeta]. *) - let push_std_type {env=e;free=f} t = - { env = (0,t) :: e; free = f} + let push_std_type mle t = + { env = (0,t) :: mle.env; free = mle.free} end |
