Skip to content

Conversation

@InSyncWithFoo
Copy link
Contributor

Summary

Resolves #17289.

After this change, Red Knot will no longer show types on hover for None, ..., True, False, numbers, strings (but not f-strings), and bytes literals.

Test Plan

Unit tests.

@InSyncWithFoo
Copy link
Contributor Author

(Props to @MichaReiser for the ergonomic test framework.)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2025

mypy_primer results

No ecosystem changes detected ✅

@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2025

ruff-ecosystem results

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.

@MichaReiser
Copy link
Member

MichaReiser commented Apr 8, 2025

Thanks for the kind words. I'm still not fully convinced we want to hide the types for all literals. I do agree that we should hide them for docstrings. Interested to hear some more opinions.

@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label Apr 8, 2025
@MichaReiser
Copy link
Member

I put this back in draft so that we can have the discussion in one place

@MichaReiser MichaReiser marked this pull request as draft April 8, 2025 06:25
@MichaReiser MichaReiser marked this pull request as ready for review April 8, 2025 07:05
@MichaReiser MichaReiser merged commit 34e06f2 into astral-sh:main Apr 8, 2025
23 checks passed
@InSyncWithFoo InSyncWithFoo deleted the rk-hover branch April 8, 2025 10:21
dcreager added a commit that referenced this pull request Apr 9, 2025
* origin/main:
  [red-knot] Default `python-platform` to current platform (#17183)
  [red-knot] Add new 'unreachable code' test case (#17306)
  [red-knot] mypy_primer: Run on `async-utils` (#17303)
  [red-knot] Add custom `__setattr__` support (#16748)
  [red-knot] Add `__init__` arguments check when doing `try_call` on a class literal (#16512)
  [`flake8-pie`] Avoid false positive for multiple assignment with `auto()` (`PIE796`) (#17274)
  [syntax-errors] Async comprehension in sync comprehension (#17177)
  [`airflow`] Expand module path check to individual symbols (`AIR302`) (#17278)
  [syntax-errors] Check annotations in annotated assignments (#17283)
  [syntax-errors] Extend annotation checks to `await` (#17282)
  [red-knot] Add support for `assert_never` (#17287)
  [`flake8-pytest-style`] Avoid false positive for legacy form of `pytest.raises` (`PT011`) (#17231)
  [red-knot] Do not show types for literal expressions on hover (#17290)
  [red-knot] Fix dead-code clippy warning (#17291)
  [red-knot] Reachability analysis (#17199)
  [red-knot] Don't use latency-sensitive for handlers (#17227)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Red Knot shows types for literal expressions on hover

2 participants