A name a body form defines is bound where it is written

A def, a pattern def and a defun in a body made their names visible to the
forms after them only, so at the name itself nothing bound it: no inlay
hint, and no local hover. A position on such a name is now that name's
binding.

🤖 Generated with [ECA](https://eca.dev)

Co-Authored-By: eca-agent <git@eca.dev>
This commit is contained in:
Linus Björnstam 2026-10-22 14:03:56 +02:00
parent 471b49d9e4
commit bcfcc5500b
3 changed files with 18 additions and 6 deletions

View file

@ -519,7 +519,8 @@ INFERRED = """(import (std prelude))
(: annotated (-> int int))
(defun (annotated k)
(def (: m int) (+ k 1))
m)
(def bumped (+ m 1))
bumped)
"""
# One declaration that does not check, and one that does.
@ -582,6 +583,11 @@ def inferred(server, tmp):
and labels.get("s") == ": string",
found,
)
expect(
"inlay hints: a def and a defun in a body, at their names",
labels.get("bumped") == ": int" and labels.get("twice") == ": (-?-> string int)",
found,
)
expect(
"inlay hints: none for a top-level function's parameters",
"xs" not in labels and "names" not in labels and "k" not in labels,