Skip to content

Conversation

@abhijeetbodas2001
Copy link
Contributor

Summary

Part of astral-sh/ty#111

Using dataclass as a function, instead of as a decorator did not work as expected prior to this.
Fix that by modifying the dataclass overload's return type.

Test Plan

New mdtests, fixing the existing TODO.

@ntBre ntBre added the ty Multi-file analysis & type inference label Jun 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2025

mypy_primer results

No ecosystem changes detected ✅

@AlexWaygood AlexWaygood removed their request for review June 3, 2025 16:35
@MichaReiser MichaReiser changed the title dataclasses: Allow using dataclasses.dataclass as a function. [ty] dataclasses: Allow using dataclasses.dataclass as a function. Jun 3, 2025
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

Nice, thank you!

@carljm carljm merged commit 71d8a5d into astral-sh:main Jun 3, 2025
35 checks passed
@abhijeetbodas2001 abhijeetbodas2001 deleted the dataclass branch June 3, 2025 18:37
carljm added a commit to mtshiba/ruff that referenced this pull request Jun 4, 2025
* main:
  [ty] Add tests for empty list/tuple unpacking (astral-sh#18451)
  [ty] Argument type expansion for overload call evaluation (astral-sh#18382)
  [ty] Minor cleanup for `site-packages` discovery logic (astral-sh#18446)
  [ty] Add generic inference for dataclasses (astral-sh#18443)
  [ty] dataclasses: Allow using dataclasses.dataclass as a function. (astral-sh#18440)
  [ty] Create separate `FunctionLiteral` and `FunctionType` types (astral-sh#18360)
  [ty] Infer `list[T]` when unpacking non-tuple type (astral-sh#18438)
  [ty] Meta-type of type variables should be type[..] (astral-sh#18439)
  [`pyupgrade`] Make fix unsafe if it deletes comments (`UP050`) (astral-sh#18390)
  [`pyupgrade`] Make fix unsafe if it deletes comments (`UP004`) (astral-sh#18393)
  [ty] Support using legacy typing aliases for generic classes in type annotations (astral-sh#18404)
  Use ty's completions in playground (astral-sh#18425)
  Update editor setup docs about Neovim and Vim (astral-sh#18324)
  Update NPM Development dependencies (astral-sh#18423)
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.

3 participants