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

Some unused variables go undetected #5791

Closed
vicuna opened this issue Oct 15, 2012 · 3 comments
Closed

Some unused variables go undetected #5791

vicuna opened this issue Oct 15, 2012 · 3 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Oct 15, 2012

Original bug ID: 5791
Reporter: kosik
Assigned to: @alainfrisch
Status: closed (set by @alainfrisch on 2012-10-16T13:25:13Z)
Resolution: not a bug
Priority: normal
Severity: feature
Version: 4.00.1
Category: tools (ocaml{lex,yacc,dep,debug,...})

Bug description

Ocaml detects and reports unused variables.
This feature is useful.
However, when I bind variables by pattern-matching a record-value, Ocaml compiler does not report bound but otherwise unused variables which is probably not an expected behavior, I guess.

Steps to reproduce

When I try to compile the following program:

type foo = {bar:int; baz:string}

;;

match {bar=5; baz="five"} with
| {bar; baz} -> ();

either as:

ocamlfind c -g main.ml -o main

or as:

ocamlfind opt -g main.ml -o main

I do not get the usual warnings about unused variables (in this case "bar" and "baz").

@vicuna
Copy link
Author

vicuna commented Oct 15, 2012

Comment author: @alainfrisch

Are you sure warning 27, and not only 26, is enabled?

@vicuna
Copy link
Author

vicuna commented Oct 15, 2012

Comment author: kosik

Yes. Sorry. When I enabled that option, I've got the warning.

@vicuna
Copy link
Author

vicuna commented Oct 15, 2012

Comment author: kosik

So I think I raised a false alarm, actually.

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

No branches or pull requests

2 participants