#1390 js: List of numbers sorting differs

ilya Mon 17 Jan 2011

Fantom code:

echo((0..<20).toList.sort)

or more sharp example

list := Int[,]
20.times { list.add(it) }
echo(list.sort)

jvm output:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

js output:

[0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 3, 4, 5, 6, 7, 8, 9]

andy Mon 17 Jan 2011

Promoted to ticket #1390 and assigned to andy

andy Mon 18 Apr 2011

Ticket resolved in 1.0.59

Yep, List was not delegating to Obj.compare for default sorts (not sure how that hasn't come up before). But pushed a fix for both sort and sortr.

Login or Signup to reply.