unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.64k stars 267 forks source link

Error message displays "11st" instead of "11th" #5134

Closed ceedubs closed 2 days ago

ceedubs commented 2 days ago

Describe and demonstrate the bug

This is minor, but error messages display 11st instead of 11th for ordinal argument references.

Input:

```ucm
.> project.create-empty proj
proj/main> builtins.mergeio
foo : Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Boolean
foo = todo "not important"

> foo 3 3 3 3 3 3 3 3 3 3 "3"

Output:
.> project.create-empty proj

  🎉 I've created the project proj.

  🎨 Type `ui` to explore this project's code in your browser.
  🔭 Discover libraries at https://share.unison-lang.org
  📖 Use `help-topic projects` to learn more about projects.

  Write your first Unison code with UCM:

    1. Open scratch.u.
    2. Write some Unison code and save the file.
    3. In UCM, type `add` to save it to your new project.

  🎉 🥳 Happy coding!

proj/main> builtins.mergeio

  Done.
foo : Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Boolean
foo = todo "not important"

> foo 3 3 3 3 3 3 3 3 3 3 "3"

  Loading changes detected in scratch.u.

  The 11st argument to `foo`

            has type:  Text
      but I expected:  Nat

      1 | foo : Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Boolean
      2 | foo = todo "not important"
      3 | 
      4 | > foo 3 3 3 3 3 3 3 3 3 3 "3"


Note: this example uses a function, but this also happens for constructor arguments. And I suspect that there are other numbers (especially in the 11 - 20 range) where this also goes wrong.

**Environment (please complete the following information):**
 - `ucm --version` 1e72750bb
ceedubs commented 2 days ago

This looks like the relevant code if anyone wants to take a go!