must use set_state rather than backtrack in Typecore.type_cases#10006
must use set_state rather than backtrack in Typecore.type_cases#10006gasche merged 1 commit intoocaml:trunkfrom
Conversation
Octachron
left a comment
There was a problem hiding this comment.
The change looks good to me, since the strict branch can fail at an unknown level, thus level needs to be restored before retyping in the relaxed mode.
(The dummy rev env feels a bit unfortunate, but replacing it with ref Env.empty does not seems really better.)
As a fix to a new 4.12 feature, the PR should be cherry-picked to 4.12 .
|
Ah, I forgot to comment on this PR. I agree it fixes the bug. I'm not fond of the |
|
Note that the bug this PR fixes also affects Using the Using the |
|
Let's merge, then! |
must use set_state rather than backtrack in Typecore.type_cases (cherry picked from commit d42e466)
|
Cherry-picked in 4.12 as fead9e4. |
#9811 wrongly used only Btype.backtrack after failure in a strict setting.
This could result in keeping wrong levels when retyping, and led to a failure in parsexp:
janestreet/parsexp#5
This PR fixes this by using
save_state/set_stateinstead (with a dummyref env).