Skip to content

Conversation

Gankra
Copy link
Contributor

@Gankra Gankra commented Aug 13, 2025

This also reintroduces the ResolvedDefinition::Module variant because reverse-engineering it in several places is a bit confusing. In an ideal world we wouldn't have ResolvedDefinition::FileWithRange as it kinda kills the ability to do richer analysis, so I want to chip away at its scope wherever I can (currently it's used to point at asname parts of import statements when doing ImportAliasResolution::PreserveAliases, and also keyword arguments).

This also makes a kind of odd change to allow a hover to only produce a docstring. This works around an oddity where hovering over a module name in an import fails to resolve to a ty even though hovering over uses of that imported name does.

The two fixed tests reflect the two interesting cases here.

@Gankra Gankra added server Related to the LSP server ty Multi-file analysis & type inference labels Aug 13, 2025
@Gankra
Copy link
Contributor Author

Gankra commented Aug 13, 2025

Screenshot 2025-08-13 at 12 01 04 PM Screenshot 2025-08-13 at 12 01 14 PM Screenshot 2025-08-13 at 12 01 25 PM

Copy link
Contributor

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-08-13 16:02:21.506598690 +0000
+++ new-output.txt	2025-08-13 16:02:21.573598867 +0000
@@ -1,5 +1,5 @@
 WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
-fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/918d35d/src/function/execute.rs:215:25 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(70bc)): execute: too many cycle iterations`
+fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/918d35d/src/function/execute.rs:215:25 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(1b8bf)): execute: too many cycle iterations`
 _directives_deprecated_library.py:15:31: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `int`
 _directives_deprecated_library.py:30:26: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `str`
 _directives_deprecated_library.py:36:41: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `Self@__add__`

Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

@Gankra Gankra merged commit f0b03c3 into main Aug 13, 2025
40 checks passed
@Gankra Gankra deleted the gankra/moduledoc branch August 13, 2025 16:24
dcreager added a commit that referenced this pull request Aug 14, 2025
* main:
  Feature/build riscv64 bin (#19819)
  [ty] Add caching to `CodeGeneratorKind::matches()` (#19912)
  [ty] Rename `functionArgumentNames` to `callArgumentNames` inlay hint setting (#19911)
  [ty] Default `ty.inlayHints.*` server settings to true (#19910)
  [ty] Remove py-fuzzer skips for seeds that are no longer slow (#19906)
  [ty] fix deferred name loading in PEP695 generic classes/functions (#19888)
  [ty] Add some additional type safety to `CycleDetector` (#19903)
  [`flake8-blind-except`] Fix `BLE001` false-positive on `raise ... from None` (#19755)
  [ty] resolve docstrings for modules (#19898)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Related to the LSP server ty Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants