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

ast-based camlp4 preprocessing fails reporting useless match #8027

Closed
vicuna opened this issue Feb 23, 2003 · 2 comments
Closed

ast-based camlp4 preprocessing fails reporting useless match #8027

vicuna opened this issue Feb 23, 2003 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 23, 2003

Original bug ID: 1555
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Hugo Herbelin
Version: 3.06
OS: linux
Submission from: herbelin.net1.nerim.net (62.212.105.93)

Bonjour,

I fell on a funny behaviour of ast-based preprocessing wrt to useless pattern
detection.

When preprocessed with camlp4o the following program reports an incorrect
useless pattern.

% cat foo.ml
let f = function
| 'b' -> 1
| 'a'..'c' -> 2
| _ -> 3
% ocamlc -pp 'camlp4o' -c -impl ~/foo.ml
File "/home/herbelin/toto.ml", line 3, characters 4-12:
Warning: this pattern is unused.

When communicating via ocaml parser, it is correct though (no warning).

% ocamlc -pp 'camlp4o pr_o.cmo' -c -impl ~/foo.ml

In both cases, the .cmo is the same, so it really just seems to be that the
useless pattern detection is not happy with the abstract syntax tree returned by
camlp4 (perhaps is 'a'..'c' then expanded) ?

Thanks for all.

Hugo

@vicuna
Copy link
Author

vicuna commented Feb 24, 2003

Comment author: administrator

Full_Name: Hugo Herbelin
Version: 3.06
OS: linux
Submission from: herbelin.net1.nerim.net (62.212.105.93)

Bonjour,

I fell on a funny behaviour of ast-based preprocessing wrt to useless pattern
detection.

When preprocessed with camlp4o the following program reports an incorrect
useless pattern.

% cat foo.ml
let f = function
| 'b' -> 1
| 'a'..'c' -> 2
| _ -> 3
% ocamlc -pp 'camlp4o' -c -impl ~/foo.ml
File "/home/herbelin/toto.ml", line 3, characters 4-12:
Warning: this pattern is unused.

When communicating via ocaml parser, it is correct though (no warning).

% ocamlc -pp 'camlp4o pr_o.cmo' -c -impl ~/foo.ml

In both cases, the .cmo is the same, so it really just seems to be that the
useless pattern detection is not happy with the abstract syntax tree returned by
camlp4 (perhaps is 'a'..'c' then expanded) ?

Thanks for all.

Hugo

Hi, I think you are right, at least the observed behavior can be
explained as you do : 'a'..'c' is expanded by camlp4.
However some << ghost location >> mecanism shoud prevent the warning.
I probably missed something here.

--Luc

@vicuna
Copy link
Author

vicuna commented Feb 24, 2003

Comment author: administrator

Fixed on 02.24/2003 --Luc

@vicuna vicuna closed this as completed Feb 24, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant