You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4659 Reporter: oliver Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:07:27Z) Resolution: fixed Priority: normal Severity: minor Version: 3.10.2 Target version: 4.01.0+dev Category: ~DO NOT USE (was: OCaml general) Related to:#4598#5070 Monitored by: oliver @Chris00
Bug description
I get the following error message:
===============
oliver@siouxsie:/Desktop/Overwrite_file$ ocamlc unix.cma buggy.ml
File "buggy.ml", line 20, characters 4-321:
Warning F: this function application is partial,
maybe some arguments are missing.
oliver@siouxsie:/Desktop/Overwrite_file$
Line 20 has length of 41 bytes!
The bug of my program is located in line 29,
where I used Printf.printf, expecting an arg, but do not provide it.
This means: the partial application is correctly mentioned by the compiler,
but the line and char-in-line is reported wrongly.
The problem occurs with ocamlc, ocamlopt and ocaml.
Additional information
For first overview, I provide the result of "$ nl -ba buggy.ml",
but I will attach the file for your convenience:
1
2 let mb x = x * 1024 * 1024
3
4 open Unix
5
6 let _ =
7 let filename = Sys.argv.(1) in
8 let filesize = (stat filename).st_size in
9 Printf.printf "%d\n" filesize;
10
11 let restbytes = ref filesize in
12
13 let strlen = mb 100 in
14 let string = String.make strlen ' ' in
15 let writesize = ref strlen in
16
17 let fd = openfile filename [O_RDWR] 0o640 in
18 while !restbytes > 0
19 do
20 writesize := (min !restbytes strlen);
21
22 Printf.printf "restbytes: %d, writesize: %d\n" !restbytes !writesize;
23 flush Pervasives.stdout;
24
25 let num = write fd string 0 !writesize in
26 restbytes := max 0 (!restbytes - num );
27
28 Printf.printf "(just written: %d)\n" num;
29 Printf.printf "restbytes: %d\n-----------\n" (* HERE IS THE BUG! *)
30
31 done;
32 close fd
33
34
35
In fact, the reported character range is correct (it goes from the 'w' in line 20 to the last quote in line 29).
What is wrong with this error message is that it reports the whole sequence as the partially-applied function. It should report only its last subexpression (i.e. line 29).
Original bug ID: 4659
Reporter: oliver
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:07:27Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.10.2
Target version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #4598 #5070
Monitored by: oliver @Chris00
Bug description
I get the following error message:
===============
oliver@siouxsie:
/Desktop/Overwrite_file$ ocamlc unix.cma buggy.ml/Desktop/Overwrite_file$File "buggy.ml", line 20, characters 4-321:
Warning F: this function application is partial,
maybe some arguments are missing.
oliver@siouxsie:
Line 20 has length of 41 bytes!
The bug of my program is located in line 29,
where I used Printf.printf, expecting an arg, but do not provide it.
This means: the partial application is correctly mentioned by the compiler,
but the line and char-in-line is reported wrongly.
The problem occurs with ocamlc, ocamlopt and ocaml.
Additional information
For first overview, I provide the result of "$ nl -ba buggy.ml",
but I will attach the file for your convenience:
File attachments
The text was updated successfully, but these errors were encountered: