typst: Make error more descriptive when non-sink argument is used instead of expected sink argument

The issue #2101 was created due to the next error message:

error: unexpected argument
   ┌─ /file.typ:42:21
   │
42 │   heading(numbering: it => it, name, ..args)
   │                      ^^

It shows that the argument is unexpected, but in reality it is of course expected, and instead of a normal argument, it should be a sink argument:

42 │   heading(numbering: (..it) => it, name, ..args)

The error did throw me off, but after an answer and some “digging” through the documentation, the error was resolved. In any case, the error message should be more descriptive and user-friendly.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (12 by maintainers)

Most upvoted comments

Ah, the check is performed at the call-site of the anonymous function passed as numbering, but the span points to argument it of said anonymous function, is that it?