Repository navigation
write in-scope type parameters by their bare name in hover and inlay hints - #218
Merged
Merged
Conversation
…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
…limits under them
Contributor
ecosystem checkLinter (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. |
Contributor
by ecosystem round-tripbase: regressions: 0, changed: 18, improvements: 0, error changes: 0 (across 29687 files in 149 projects) ℹ️ changed round-trip outputpytest-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)
⏭️ skipped
|
`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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
inside
def f[T](t: T), hoveringa = tnow showsTinstead ofT@f, and the variable hint readsa[: T] = tand can be accepted asa: T = t. the inferred return hint and the add-return-annotation refactor do the samea 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_scopeandtype_params_in_signature. one hidden by a nearer type parameter or binding of the same name keeps its@scopesuffix. legacyTypeVars andParamSpeccomponents (P.args,**P) follow the same rulethe checker's evaluation of implicit place-load sources (module globals, builtins, class-body implicits) moves to
ImplicitPlaceLoad::placeso the query and inference share it