Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reportAny on partial Anys #82

Closed
DetachHead opened this issue Feb 12, 2024 · 1 comment · Fixed by #83
Closed

reportAny on partial Anys #82

DetachHead opened this issue Feb 12, 2024 · 1 comment · Fixed by #83
Labels
type checking / linting issues relating to existing diagnostic rules or proposals for new diagnostic rules

Comments

@DetachHead
Copy link
Owner

foo: list[Any] # should be an error

however there's tons of functions that take Any in the stdlib, eg.

def cast(typ: type[_T], val: Any) -> _T: ...

these should not report an error. possible solutions:

  • don't report Any errors on function calls where the argument takes Any, since there'll either be an error on the function definition anyway, or the function is third party/stdlib and therefore not within the user's control (and it usually means object in these cases anyway)
  • remove all Anys from typeshed
  • special-casing (horrible idea)
@DetachHead DetachHead added the type checking / linting issues relating to existing diagnostic rules or proposals for new diagnostic rules label Mar 24, 2024
@DetachHead
Copy link
Owner Author

i think just reporting all explicit usages of Any will cover this case, and will match mypy's behavior.

reporting partial Any in the same way as partial unknown doesn't seem feasible because there's just way too much Any in the stdlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type checking / linting issues relating to existing diagnostic rules or proposals for new diagnostic rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant