Skip to content

Conversation

@github-actions
Copy link
Contributor

Close and reopen this PR to trigger CI

@github-actions github-actions bot added the ty Multi-file analysis & type inference label Oct 15, 2025
@github-actions github-actions bot added the ty Multi-file analysis & type inference label Oct 15, 2025
@sharkdp sharkdp closed this Oct 15, 2025
@sharkdp sharkdp reopened this Oct 15, 2025
@github-actions
Copy link
Contributor Author

github-actions bot commented Oct 15, 2025

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-10-15 08:46:46.391831607 +0000
+++ new-output.txt	2025-10-15 08:46:49.708854720 +0000
@@ -1,5 +1,5 @@
 fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/29ab321/src/function/execute.rs:217:25 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_type_statement.py`: `PEP695TypeAliasType < 'db >::value_type_(Id(d017)): execute: too many cycle iterations`
-fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/29ab321/src/function/execute.rs:217:25 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(1643f)): execute: too many cycle iterations`
+fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/29ab321/src/function/execute.rs:217:25 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(16443)): 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__`

@github-actions
Copy link
Contributor Author

github-actions bot commented Oct 15, 2025

mypy_primer results

Changes were detected when running on open source projects
setuptools (https://github.com/pypa/setuptools)
+ setuptools/_vendor/inflect/__init__.py:2279:49: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ setuptools/_vendor/inflect/__init__.py:2283:54: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 799 diagnostics
+ Found 801 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- scripts/contrib-patch-tests.py:34:69: error[unresolved-attribute] Type `expr` has no attribute `id`
- Found 7578 diagnostics
+ Found 7577 diagnostics
No memory usage changes detected ✅

@github-actions
Copy link
Contributor Author

github-actions bot commented Oct 15, 2025

ecosystem-analyzer results

Lint rule Added Removed Changed
unused-ignore-comment 2 0 0
unresolved-attribute 0 1 0
Total 2 1 0

Full report with detailed diff (timing results)


def f(y: X):
reveal_type(y) # revealed: @Todo(Support for `types.UnionType` instances in type expressions)
reveal_type(y) # revealed: @Todo(Support for `types.UnionType` instances in type expressions) | int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to python/typeshed#14813. It's not technically incorrect, but breaks in cases that previously relied on the @Todo type to shadow false positives. We may need to special-case type.__or__'s return type (for now)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to special-case type.__or__'s return type (for now)?

That sounds reasonable. Sorry I didn't give any warning that this was coming — completely forgot about all the special casing we have for PEP-604 unions and type aliases when I merged that typeshed PR :-(

It might be easiest to work in the special case at a higher level, in inference of | operations in infer/builder.rs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't give any warning that this was coming — completely forgot about all the special casing we have for PEP-604 unions and type aliases when I merged that typeshed PR :-(

We certainly didn't expect you to. This also looks innocent enough 😃

Comment on lines 976 to 977
// TODO: This should be excluded
// test.assert_completions_do_not_include("_private_implicit_union_alias");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also "breaks" because we previously inferred a @Todo type, and @Todo types are generally hidden ... (why?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only specifically TypeAlias-related TODOs are suppressed from autocompletions:

Type::Dynamic(DynamicType::TodoTypeAlias) => continue,

We never want private type aliases appearing in autocompletions. The special Todo variant was the best way I could think of doing this without PEP-613 support

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instances of UnionType are also suppressed, because they're almost certainly implicit type aliases, and we don't support them yet either, but we never want private type aliases from stubs appearing in autocompletions because they don't exist at runtime:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instances of UnionType are also suppressed

This is why it breaks, because now it's UnionType | <class 'int'>.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sharkdp sharkdp merged commit cafb96a into main Oct 15, 2025
42 checks passed
@sharkdp sharkdp deleted the typeshedbot/sync-typeshed branch October 15, 2025 09:13
dcreager added a commit that referenced this pull request Oct 15, 2025
…rable

* origin/main:
  [ty] Add (unused) `inferable` parameter to type property methods (#20865)
  Run macos tests on macos (#20889)
  Remove `release` CI job (#20887)
  [ty] CI: Faster ecosystem analysis (#20886)
  Remove `strip` from release profile (#20885)
  [ty] Sync vendored typeshed stubs (#20876)
  [ty] Add some completion ranking improvements (#20807)
  Improved error recovery for unclosed strings (including f- and t-strings) (#20848)
  Enable lto=fat (#20863)
  [`pyupgrade`] Extend `UP019` to detect `typing_extensions.Text` (`UP019`) (#20825)
  [`flake8-bugbear`] Omit annotation in preview fix for `B006` (#20877)
  fix(docs): Fix typo in `RUF015` description (#20873)
  [ty] Improve and extend tests for instance attributes redeclared in subclasses (#20866)
  [ty] Ignore slow seeds as a temporary measure (#20870)
  Remove parentheses around multiple exception types on Python 3.14+ (#20768)
  Update Black tests (#20794)
dcreager added a commit that referenced this pull request Oct 15, 2025
…nt-sets

* dcreager/non-non-inferable: (174 commits)
  [ty] Add (unused) `inferable` parameter to type property methods (#20865)
  Run macos tests on macos (#20889)
  Remove `release` CI job (#20887)
  [ty] CI: Faster ecosystem analysis (#20886)
  Remove `strip` from release profile (#20885)
  [ty] Sync vendored typeshed stubs (#20876)
  [ty] Add some completion ranking improvements (#20807)
  Improved error recovery for unclosed strings (including f- and t-strings) (#20848)
  Enable lto=fat (#20863)
  [`pyupgrade`] Extend `UP019` to detect `typing_extensions.Text` (`UP019`) (#20825)
  [`flake8-bugbear`] Omit annotation in preview fix for `B006` (#20877)
  fix(docs): Fix typo in `RUF015` description (#20873)
  [ty] Improve and extend tests for instance attributes redeclared in subclasses (#20866)
  [ty] Ignore slow seeds as a temporary measure (#20870)
  use existing method
  Remove parentheses around multiple exception types on Python 3.14+ (#20768)
  Update Black tests (#20794)
  just the api parts
  [ty] Fix further issues in `super()` inference logic (#20843)
  [ty] Document when a rule was added (#20859)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants