Skip to content

Inlay hints for functions may show hints in the wrong position if the return type is provided but not all parameter types

image

type t = C
type r = { x : int; y : int }

let mk_r x y : r = { x; y }

In the snippet above, the return type for mk_r is provided as r, but not for x and y. Because of this, the inlay hint is shown after mk_r but before x and y, which is invalid.

If the types for x and y are provided, then this is fixed. However, if the type for just x or just y is provided, or for none, then the inlay hint will be at the wrong position.

Removing the return type prevents this bug.

Acceptance criteria

  • Inlay hints are shown correctly for all combinations of parameter type annotations and return type.
  • Tests added.