overture icon indicating copy to clipboard operation
overture copied to clipboard

Variable hiding can suppress unused warnings

Open nickbattle opened this issue 11 years ago • 0 comments

If a local definition creates a name which hides another definition, and that other definition is not used, the unused warning for the hidden variable is suppressed. For example:

    op: () ==> nat
    op() ==
    (
        dcl var:nat := 0;
        let var:nat = 1 in return var
    );

This creates a warning on the "let" line saying that the var definition hides the earlier definition. But there ought also to be an unused warning on the first definition. If you change the name of the let definition to something else, the unused warning will appear and the hiding warning will disappear.

This is low priority!

(This occurs because the search for the name in order to determine the hiding also marks the outer definition it finds as used).

nickbattle avatar Apr 03 '14 15:04 nickbattle