You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7722 Reporter: smuenzel-js Status: acknowledged (set by @xavierleroy on 2018-02-17T17:07:09Z) Resolution: open Priority: normal Severity: minor Version: 4.06.0 Category: back end (clambda to assembly) Monitored by:@hhugo@gasche
Bug description
When mutating a member of a record with an existential type, a caml_modify is generated even though it is know that the member can only hold immediate values.
moduleKind=structtype_ t =
| Int : inttendmoduleR=structtypet =
| T :
{ kind : 'aKind.t;mutable m : 'a
} -> tendletmutater (v: int) =letopenRinletT ({ kind =Kind.Int; _} as r) = r in(* caml_modify is used here, even though r.m can only contain ints *)
r.m <- v
The text was updated successfully, but these errors were encountered:
The compiler errs on the side of caution: it generates a caml_modify operation unless it can positively prove that it's not needed. With GADTs such proofs are delicate and very error prone. So, maybe it's for the best that we're not trying to optimize this example.
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
Original bug ID: 7722
Reporter: smuenzel-js
Status: acknowledged (set by @xavierleroy on 2018-02-17T17:07:09Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.06.0
Category: back end (clambda to assembly)
Monitored by: @hhugo @gasche
Bug description
When mutating a member of a record with an existential type, a caml_modify is generated even though it is know that the member can only hold immediate values.
The text was updated successfully, but these errors were encountered: