Skip to content

Unused value warning on a recursive value that is used #7429

@vicuna

Description

@vicuna

Original bug ID: 7429
Reporter: @lpw25
Assigned to: @lpw25
Status: resolved (set by @lpw25 on 2016-12-07T16:12:59Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 4.04.0
Category: typing
Related to: #6738
Monitored by: @gasche

Bug description

The following code:

let rec x = lazy (subscribe (fun _ -> (Lazy.force x)));;

produces an unused value warning for x if it is not used in the rest of the program. However, the binding to x is required in this case.

Obviously, the warning is trying to make sure that things like recursive function definitions do not get automatically marked as used just because they are recursive, but it seems that the issue is subtler than how the current check works.

This code is pretty unusual, and the work-around is easy (simply rename x to _x) so it may not be worth fixing if the criteria is too complicated.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions