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

record expression deleted when all fields specified #7696

Closed
vicuna opened this issue Dec 22, 2017 · 2 comments · Fixed by #9432
Closed

record expression deleted when all fields specified #7696

vicuna opened this issue Dec 22, 2017 · 2 comments · Fixed by #9432
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 22, 2017

Original bug ID: 7696
Reporter: @yallop
Status: new
Resolution: open
Priority: normal
Severity: minor
Category: typing
Related to: #6608
Monitored by: @nojb @gasche

Bug description

In 4.03.0 the record expression in an field update was always evaluated:

{ (assert false) with contents = 1 } ;;

Characters 0-36:
{ (assert false) with contents = 1 } ;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 23: all the fields are explicitly listed in this record:
the 'with' clause is useless.
Exception: Assert_failure ("//toplevel//", 1, 2).

In more recent versions (4.04.2, 4.05.0, 4.06.0) the record expression is removed if all the fields are specified:

{ (assert false) with contents = 1 } ;;

Characters 0-36:
{ (assert false) with contents = 1 } ;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 23: all the fields are explicitly listed in this record:
the 'with' clause is useless.

  • : int ref = {contents = 1}

There's previous discussion on Mantis and GitHub:

#6608#c16416
#901 (comment)

@xavierleroy
Copy link
Contributor

This was planned to be fixed by reverting c545e04. @garrigue can you please have a look?

@garrigue
Copy link
Contributor

garrigue commented Apr 8, 2020

It was a bad ordering of commits.

xavierleroy pushed a commit that referenced this issue Apr 8, 2020
…edefined (#9432)

This commit reverts c1a7ace (originally c545e04), which was a
temporary fix that is no longer needed because it was superseded by
#6608.

The temporary fix caused `{expr with lbl1 = e1; ... }` to not evaluate
`expr` if all labels of its type are overriden.  As reported in #7696
this is not desirable.  Reverting the temporary fix causes `expr` to
be evaluated always.

As a consequence, a corner case of value "let rec" is no longer accepted.
The corresponding test was updated.

Closes: #7696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants