Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006236OCamlOCaml generalpublic2013-11-13 14:252014-07-16 18:29
Reportergmelquiond 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version4.00.1 
Target VersionFixed in Version 
Summary0006236: No warning for partly evaluated functions at toplevel
Descriptionlet f ~a b = failwith b
let _ = f "success"

The compiler emits no warning about the last line not being executed completely. The bug looks obvious on this testcase, but it is mind-boggling on a larger piece of code spanning several files. (We had it occur in Why3 recently.)

So it would be great if warning 5 ("this function application is partial, maybe some arguments are missing") was also emitted for anonymous let-statements at top level. (I know that, if "let ()" had been used instead, the compiler would have complained loudly.)
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0010633)
garrigue (manager)
2013-11-13 15:06

Intentionally, let _ = expr does not cause any warning.
Using it is at top-level is bad practice.
You should either write
   let () = ...
or
   let () = ignore (...)
which will both warn you.
(0010634)
frisch (developer)
2013-11-14 10:43

What about a new warning on all "let _ = ..." bindings? In my opinion, even for local bindings, it is bad style.
(0010950)
doligez (administrator)
2014-02-19 16:46

Please let us not multiply coding-style warnings that could easily be implemented by an external tool. In this case, even emacs should be able to warn you.

- Issue History
Date Modified Username Field Change
2013-11-13 14:25 gmelquiond New Issue
2013-11-13 15:06 garrigue Note Added: 0010633
2013-11-14 10:43 frisch Note Added: 0010634
2013-11-30 23:28 doligez Status new => acknowledged
2014-02-19 16:46 doligez Note Added: 0010950
2014-07-16 18:29 doligez Severity minor => feature


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker