Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005571OCamlOCaml generalpublic2012-04-02 23:392013-07-09 13:19
Reporterjfc 
Assigned Tofrisch 
PrioritylowSeveritytrivialReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.12.1 
Target Version4.01.0+devFixed in Version4.01.0+dev 
Summary0005571: Incorrect ordinal number in error message
Descriptionocamlc 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"
TagsNo tags attached.
Attached Files? file icon test.ml [^] (290 bytes) 2012-04-02 23:39 [Show Content]

- Relationships

-  Notes
(0007265)
gasche (developer)
2012-04-03 08:23

Just reading the PR title, I first thought it was an April joke, and
found it funny. "?^? not printed correctly".
(0007266)
xleroy (administrator)
2012-04-03 10:33

I'd suggest avoiding adding code for this issue and change the message instead. "Fields number 21 have..."
(0008026)
doligez (administrator)
2012-09-06 16:47

For the record, I am very much in favor of Xavier's solution. Our core business is not natural language processing.
(0009728)
frisch (developer)
2013-07-09 13:19

Implemented Xavier's suggestion (13877 on trunk, 13878 on 4.01).

- Issue History
Date Modified Username Field Change
2012-04-02 23:39 jfc New Issue
2012-04-02 23:39 jfc File Added: test.ml
2012-04-03 08:23 gasche Note Added: 0007265
2012-04-03 08:23 gasche Status new => acknowledged
2012-04-03 10:33 xleroy Note Added: 0007266
2012-09-06 16:47 doligez Note Added: 0008026
2012-09-06 16:47 doligez Target Version => 4.00.1+dev
2012-09-21 14:11 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-07-09 13:19 frisch Note Added: 0009728
2013-07-09 13:19 frisch Status acknowledged => resolved
2013-07-09 13:19 frisch Fixed in Version => 4.01.0+dev
2013-07-09 13:19 frisch Resolution open => fixed
2013-07-09 13:19 frisch Assigned To => frisch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker