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

Typing error locations of sugared record fields are strangely reported (in OCaml 4.00.0 beta) #5657

vicuna opened this issue Jun 19, 2012 · 3 comments


Copy link

@vicuna vicuna commented Jun 19, 2012

Original bug ID: 5657
Reporter: furuse
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:07:03Z)
Resolution: fixed
Priority: normal
Severity: minor
Category: typing

Bug description

The typing error of the following code is reported with a strange location:

type t = { a : int; b : int }

let a = 1
let b = "hello"

let _ = { a; b; }

File "", line 6, characters 10-14:
Error: This expression has type string but an expression was expected of type

10-14 contains "a; b;", not "b"...


By the way, it would be nice if I could choose a Product Version OCaml 4.00.0 beta to report beta bugs. Is it not available for mere reporters?

Copy link

@vicuna vicuna commented Jun 20, 2012

Comment author: @garrigue

It is different from #5073, which is already fixed.
I cannot seem to find the cause: apparently this is a bug in the parser,
since this is where punning is handled, but everything seems correct...

Copy link

@vicuna vicuna commented Jun 21, 2012

Comment author: @alainfrisch

The lbl_expr_list is wrong: exp_of_label calls symbol_rloc (through mkexp), which returns the location of the whole left-hand side of the current action. Since lbl_expr_list matches the sequence of fields since the beginning, the rloc starts at the beginning of the sequence.

Copy link

@vicuna vicuna commented Jun 21, 2012

Comment author: @alainfrisch

Fixed in trunk (12636 for expressions, 12637 for patterns) and 4.00 (12638).

@vicuna vicuna closed this Dec 11, 2015
@vicuna vicuna added the typing label Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
dra27 pushed a commit to dra27/ocaml that referenced this issue Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants