Skip to content

Typing error message is worse that before #6173

@vicuna

Description

@vicuna

Original bug ID: 6173
Reporter: @johnwhitington
Assigned to: @garrigue
Status: assigned (set by @johnwhitington on 2015-11-23T21:49:16Z)
Resolution: reopened
Priority: normal
Severity: feature
Version: 4.01.0
Target version: later
Fixed in version: 4.02.0+dev
Category: typing
Has duplicate: #6295
Related to: #5936
Child of: #7338
Monitored by: @gasche @hcarty @dbuenzli

Bug description

OCaml version 4.01.0+rc1
# let f x = x @ [];;
val f : 'a list -> 'a list = <fun>
# f ();;
Error: The variant type list has no constructor ()

Is this related to the new variants work? Is it related to the fact that () is, unusually, a valid constructor (this has been debated before, I know)?

The previous behaviour is much less confusing.

 OCaml version 4.00.1

# let f x = x @ [];;
val f : 'a list -> 'a list = <fun>
# f ();;
Error: This expression has type unit but an expression was expected of type
         'a list

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions