Skip to content

write in-scope type parameters by their bare name in hover and inlay hints - #218

Merged
KotlinIsland merged 5 commits into
mainfrom
scopes
Oct 27, 2026
Merged

KotlinIsland merged 5 commits into
mainfrom
scopes

Conversation

@KotlinIsland

Copy link
Copy Markdown
Owner

inside def f[T](t: T), hovering a = t now shows T instead of T@f, and the variable hint reads a[: T] = t and can be accepted as a: T = t. the inferred return hint and the add-return-annotation refactor do the same

a type parameter is written bare only where a bare name written there would resolve to it, read the way an annotation reads it: SemanticModel::type_params_in_scope and type_params_in_signature. one hidden by a nearer type parameter or binding of the same name keeps its @scope suffix. legacy TypeVars and ParamSpec components (P.args, **P) follow the same rule

the checker's evaluation of implicit place-load sources (module globals, builtins, class-body implicits) moves to ImplicitPlaceLoad::place so the query and inference share it

…hints

inside `def f[T](t: T)`, hovering `a = t` now shows `T` instead of `T@f`,
and the variable hint reads `a[: T] = t` and can be accepted as `a: T = t`.
the inferred return hint and the add-return-annotation refactor do the same

a type parameter is written bare only where a bare name written there would
resolve to it, read the way an annotation reads it: `SemanticModel::type_params_in_scope`
and `type_params_in_signature`. one hidden by a nearer type parameter or
binding of the same name keeps its `@scope` suffix. legacy `TypeVar`s and
`ParamSpec` components (`P.args`, `**P`) follow the same rule

the checker's evaluation of implicit place-load sources (module globals,
builtins, class-body implicits) moves to `ImplicitPlaceLoad::place` so the
query and inference share it
a specialized function is compared as the plain callable it becomes, so a
function's type parameter has no variance that affects assignability. a class
or type alias parameter still shows its variance, including inside a method
…under them

the linux `cargo test` job timed out on `generics/pep695/paramspec.md`,
`a_type_expression_a_pass_moves_is_written_lowered` and
`clean_mdtest_blocks_run` since the upstream merge

the merge gave `undefined-reveal` a fix that imports `reveal_type`. the
mdtest harness applies every fix and checks the test again, so every test
calling `reveal_type` bare, nearly all of them, was checked twice. the
harness now leaves that fix out of its fix pass, as it already leaves the
diagnostic out of snapshots: mdtest time drops by a fifth and `paramspec.md`
back to what it took before the merge

the subsumed-lowering type expression cases run as one test per pass,
with a test that every pass with cases has one

the divergence harness is spread over eight tests by a hash of each mdtest's
path, so nextest's limit holds a shard rather than the whole corpus. a
block's cost is the transpile and the check building a database each, not
starting `by`, so the note in `nextest.toml` that pointed at an in-process
transpiler is replaced
@github-actions

Copy link
Copy Markdown
Contributor

ecosystem check

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

by ecosystem round-trip

base: 57db3e43afc90ce1329b5c568326f38a895edf02 (merge base) → head: 218/merge

regressions: 0, changed: 18, improvements: 0, error changes: 0 (across 29687 files in 149 projects)

⚠️ 8 project(s) fail to round-trip on both base and head, so this check says nothing about them.

ℹ️ changed round-trip output

pytest-autoprofile — lib/pytest_autoprofile/__init__.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_doctest.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_json.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_multiprocessing.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_patches.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_test_util_capture_warnings.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_test_utils.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_typing.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_warnings.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/_xdoctest.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/importers.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/option_hooks.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/plugin.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/profiler.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/rewriting.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/setup.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/startup_hook.py
(only produced on base)
pytest-autoprofile — lib/pytest_autoprofile/utils.py
(only produced on base)

💥 fails to round-trip (unchanged from base)

  • jax: build: killed: timed out after 900s
  • kopf: reverse: thread '' (4942) has overflowed its stack
  • manticore: reverse: killed: exceeded 11.7358GB memory budget
  • openlibrary: reverse: killed: timed out after 900s
  • pandas: build: killed: timed out after 900s
  • pandas-stubs: build: killed: timed out after 900s
  • scipy: reverse: killed: exceeded 11.7365GB memory budget
  • sympy: reverse: thread '' (5311) has overflowed its stack

⏭️ skipped

  • CPython (Argument Clinic): skipped: 2360 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory
  • CPython (cases_generator): skipped: 2360 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory
  • CPython (peg_generator): skipped: 2360 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory
  • core: skipped: 20002 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory
  • dd-trace-py: skipped: 3111 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory
  • ecosystem-analyzer: setup failed: setup_primer_project.py failed for 'ecosystem-analyzer': Cloning into '/tmp/tmpgcgzpji9/ecosystem-analyzer'... Using CPython 3.12.3 interpreter at: /home/runner/work/_temp/setup-uv-cach…
  • mongo-python-driver: setup failed: setup_primer_project.py failed for 'mongo-python-driver': Cloning into '/tmp/tmpfzygp_lu/mongo-python-driver'... Submodule 'drivers-evergreen-tools' (https://github.com/mongodb-labs/dri…
  • pylint: skipped: 2521 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory
  • rotki: skipped: 2683 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory
  • spack: skipped: known to spike past the runner's memory during by build (faster than the watchdog can react)
  • zulip: skipped: 2042 .py files exceeds --max-project-py-files (2000); by build would not fit in the runner's memory

`cargo test (windows-latest, python 3.14)` has failed before running a test
on every branch since the cache entry `main` saved on oct 25: `uv python
install` could not replace the 3.14 minor version link it restored (`failed
to remove directory ...cpython-3.14-windows-x86_64-none`, os error 267). the
link is a junction, which the cache does not restore as one. macos keeps its
cache
@KotlinIsland
KotlinIsland merged commit 3e1d642 into main Oct 27, 2026
77 of 79 checks passed
@KotlinIsland
KotlinIsland deleted the scopes branch October 27, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant