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: 5571 Reporter: jfc Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:20:54Z) Resolution: fixed Priority: low Severity: trivial Version: 3.12.1 Target version: 4.01.0+dev Fixed in version: 4.01.0+dev Category: ~DO NOT USE (was: OCaml general)
Bug description
ocamlc forms some ordinal numbers incorrectly in error messages.
The attached program causes an error message:
Their 21th fields have different names, X and C.
"21th" should be "21st".
This replacement nth seems to do the right thing.
let nth n =
if n = 1 then "first" else
let n_100 = n mod 100 and n_10 = n mod 10 in
if n_10 = 1 && n_100 <> 11 then (string_of_int n) ^ "st" else
if n_10 = 2 && n_100 <> 12 then (string_of_int n) ^ "nd" else
if n_10 = 3 && n_100 <> 13 then (string_of_int n) ^ "rd" else
string_of_int n ^ "th"
Original bug ID: 5571
Reporter: jfc
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:20:54Z)
Resolution: fixed
Priority: low
Severity: trivial
Version: 3.12.1
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Bug description
ocamlc forms some ordinal numbers incorrectly in error messages.
The attached program causes an error message:
"21th" should be "21st".
This replacement nth seems to do the right thing.
let nth n =
if n = 1 then "first" else
let n_100 = n mod 100 and n_10 = n mod 10 in
if n_10 = 1 && n_100 <> 11 then (string_of_int n) ^ "st" else
if n_10 = 2 && n_100 <> 12 then (string_of_int n) ^ "nd" else
if n_10 = 3 && n_100 <> 13 then (string_of_int n) ^ "rd" else
string_of_int n ^ "th"
File attachments
The text was updated successfully, but these errors were encountered: