Skip to content

Conversation

@AlexWaygood
Copy link
Member

Summary

This PR fixes an oversight from #17597. On main, we currently emit a diagnostic for MyNonGenericProtocol() but not for MyGenericProtocol[int](). (One is a Type::ClassLiteral in our model, the other is a Type::GenericAlias.)

Test Plan

new mdtests added that fail on main.

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Apr 30, 2025
@carljm carljm mentioned this pull request Apr 30, 2025
5 tasks
@AlexWaygood AlexWaygood force-pushed the alex/generic-protocol-instantiation branch from cae8a52 to e09ea4d Compare April 30, 2025 15:57
@AlexWaygood AlexWaygood enabled auto-merge (squash) April 30, 2025 15:58
@github-actions
Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅

@AlexWaygood AlexWaygood merged commit b6de01b into main Apr 30, 2025
31 checks passed
@AlexWaygood AlexWaygood deleted the alex/generic-protocol-instantiation branch April 30, 2025 16:01
dcreager added a commit that referenced this pull request May 1, 2025
* main:
  [red-knot] Preliminary `NamedTuple` support (#17738)
  [red-knot] Add tests for classes that have incompatible `__new__` and `__init__` methods (#17747)
  Update dependency vite to v6.2.7 (#17746)
  [red-knot] Update call binding to return all matching overloads (#17618)
  [`airflow`] apply Replacement::AutoImport to `AIR312` (#17570)
  [`ruff`] Add fix safety section (`RUF028`) (#17722)
  [syntax-errors] Detect single starred expression assignment `x = *y` (#17624)
  py-fuzzer: fix minimization logic when `--only-new-bugs` is passed (#17739)
  Fix example syntax for pydocstyle ignore_var_parameters option (#17740)
  [red-knot] Update salsa to prevent panic in custom panic-handler (#17742)
  [red-knot] Ban direct instantiation of generic protocols as well as non-generic ones (#17741)
  [red-knot] Lookup of `__new__` (#17733)
  [red-knot] Check decorator consistency on overloads (#17684)
  [`flake8-use-pathlib`] Avoid suggesting `Path.iterdir()` for `os.listdir` with file descriptor (`PTH208`) (#17715)
  [red-knot] Check overloads without an implementation (#17681)
  Expand Semantic Syntax Coverage (#17725)
  [red-knot] Check for invalid overload usages (#17609)
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.

1 participant