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: 5347 Reporter: bartjacobs Assigned to:@garrigue Status: closed (set by @garrigue on 2012-06-01T07:10:08Z) Resolution: fixed Priority: normal Severity: feature Version: 3.12.1 Fixed in version: 3.13.0+dev Category: ~DO NOT USE (was: OCaml general) Monitored by: bartjacobs "Pascal Cuoq"
Bug description
Currently, the error message generated by OCaml in case of an ill-typed tuple expression is less specific than the error message generated in case of an analogous ill-typed variant expression. For example:
let x: int * int = 1, "Hello";;
Characters 19-29:
let x: int * int = 1, "Hello";;
^^^^^^^^^^
Error: This expression has type int * string
but an expression was expected of type int * int
type ('a, 'b) pair = Pair of 'a * 'b;;
type ('a, 'b) pair = Pair of 'a * 'b
let x: (int, int) pair = Pair (1, "Hello");;
Characters 34-41:
let x: (int, int) pair = Pair (1, "Hello");;
^^^^^^^
Error: This expression has type string but an expression was expected of type int
Notice that the error message for the tuple does not indicate which element is ill-typed, whereas the error message for the variant does.
Since I use lots of long tuples in my code, it would be very useful if OCaml gave more specific error messages in case of ill-typed tuple expressions.
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion. I guess we could have a special "propagate expected type" mode for tuple expressions, just like we have one for constructors, functions, etc. But I'll let our typechecker experts decide.
Original bug ID: 5347
Reporter: bartjacobs
Assigned to: @garrigue
Status: closed (set by @garrigue on 2012-06-01T07:10:08Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.12.1
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: bartjacobs "Pascal Cuoq"
Bug description
Currently, the error message generated by OCaml in case of an ill-typed tuple expression is less specific than the error message generated in case of an analogous ill-typed variant expression. For example:
let x: int * int = 1, "Hello";;
Characters 19-29:
let x: int * int = 1, "Hello";;
^^^^^^^^^^
Error: This expression has type int * string
but an expression was expected of type int * int
type ('a, 'b) pair = Pair of 'a * 'b;;
type ('a, 'b) pair = Pair of 'a * 'b
let x: (int, int) pair = Pair (1, "Hello");;
Characters 34-41:
let x: (int, int) pair = Pair (1, "Hello");;
^^^^^^^
Error: This expression has type string but an expression was expected of type int
Notice that the error message for the tuple does not indicate which element is ill-typed, whereas the error message for the variant does.
Since I use lots of long tuples in my code, it would be very useful if OCaml gave more specific error messages in case of ill-typed tuple expressions.
The text was updated successfully, but these errors were encountered: