fix Conformance: Missing type alias validation #2451#3174
fix Conformance: Missing type alias validation #2451#3174asukaminato0721 wants to merge 8 commits intofacebook:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes missing validation for “implicit type aliases” whose RHS is not a valid annotation/type-expression syntax, ensuring these now error at the annotation use site (conformance #2451). The PR also refactors annotation-syntax validation into a reusable helper and updates conformance baselines.
Changes:
- Refactor annotation syntax validation into
annotation_syntax_problemand reuse it for diagnostics. - Detect invalid implicit type-alias bindings (via
NameAssign) and surfaceInvalidAnnotationat the annotation usage site. - Update tests and third-party conformance expectation/result artifacts to reflect the new diagnostics.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pyrefly/lib/alt/solve.rs |
Adds reusable annotation-syntax helper and new implicit type-alias syntax validation that reports invalid-annotation at use sites. |
pyrefly/lib/test/type_alias.rs |
Updates the conformance test case to expect the new, more specific annotation-syntax errors. |
conformance/third_party/results.json |
Updates aggregated third-party conformance pass/fail counts. |
conformance/third_party/conformance.result |
Updates per-test expectation summary to reflect aliases_implicit.py now passing. |
conformance/third_party/conformance.exp |
Updates expected diagnostic outputs (messages/kinds) for the affected conformance cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@migeed-z has imported this pull request. If you are a Meta employee, you can view this in D101670073. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Hmmm. I am not sure this approach is the right one. The reason is that something like this: will fail and introduce false positives. The reason is that we are interpreting type(..) as a function call and rejecting it, but we should interpret the type of the value instead. So I think the approach needs to be modified to do that instead. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d36f325 to
58df9a1
Compare
|
Diff from mypy_primer, showing the effect of this PR on open source code: pytest-autoprofile (https://gitlab.com/TTsangSC/pytest-autoprofile)
- ERROR src/pytest_autoprofile/_typing.py:81:10-14: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR src/pytest_autoprofile/_typing.py:81:10-14: Function call cannot be used in annotations [invalid-annotation]
mypy (https://github.com/python/mypy)
- ERROR mypy/typeshed/stdlib/typing.pyi:410:20-22: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:410:27-29: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:411:24-26: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:411:31-33: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:410:20-22: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:410:27-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:411:24-26: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:411:31-33: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:421:34-37: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:421:42-45: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:421:34-37: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:421:42-45: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:466:28-31: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:466:36-39: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:466:28-31: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:466:36-39: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:501:26-31: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:501:26-31: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:511:45-50: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:511:45-50: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:534:27-32: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:534:27-32: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:548:27-37: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:550:27-40: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:550:48-58: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:555:10-20: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:558:98-108: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:548:27-37: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:550:27-40: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:550:48-58: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:555:10-20: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:558:98-108: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:592:27-43: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:592:51-61: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:597:10-20: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:600:98-108: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:592:27-43: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:592:51-61: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:597:10-20: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:600:98-108: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:630:28-41: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:630:28-41: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:658:45-50: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:658:45-50: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:671:41-43: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:674:45-47: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:671:41-43: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:674:45-47: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:680:46-48: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:680:46-48: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:691:29-31: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:691:29-31: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:695:42-44: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:696:29-31: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:695:42-44: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:696:29-31: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:719:26-28: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:721:30-32: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:724:22-24: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:725:29-31: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:719:26-28: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:721:30-32: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:724:22-24: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:725:29-31: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:780:32-35: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:780:43-49: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:783:24-27: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:780:32-35: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:780:43-49: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:783:24-27: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:787:24-27: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:787:38-40: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:787:24-27: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:787:38-40: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:796:32-35: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:796:44-47: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:798:32-35: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:801:24-27: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:801:35-38: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:803:24-27: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:803:38-41: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:803:49-52: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:805:24-27: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:805:38-40: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:796:32-35: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:796:44-47: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:798:32-35: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:801:24-27: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:801:35-38: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:803:24-27: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:803:38-41: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:803:49-52: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:805:24-27: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:805:38-40: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:814:63-66: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:814:63-66: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:816:31-34: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:816:45-48: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:816:56-59: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:816:31-34: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:816:45-48: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:816:56-59: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:840:99-102: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:840:99-102: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:844:92-95: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:844:92-95: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:846:62-65: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:846:62-65: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:877:39-45: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:881:47-53: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:877:39-45: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:881:47-53: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:899:24-30: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:899:24-30: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:907:27-33: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:907:27-33: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypy/typeshed/stdlib/typing.pyi:985:38-40: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:992:26-28: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:992:36-38: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:994:26-28: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:994:46-48: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:1051:39-41: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:1157:26-28: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypy/typeshed/stdlib/typing.pyi:1157:36-38: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypy/typeshed/stdlib/typing.pyi:985:38-40: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:992:26-28: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:992:36-38: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:994:26-28: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:994:46-48: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:1051:39-41: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:1157:26-28: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypy/typeshed/stdlib/typing.pyi:1157:36-38: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:69:27-31: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:69:27-31: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:73:27-28: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:73:33-34: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:76:26-29: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:76:36-39: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:76:50-53: Expected a type form, got instance of `object` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:73:27-28: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:73:33-34: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:76:26-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:76:36-39: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:76:50-53: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:89:28-29: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:89:28-29: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:92:27-30: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:92:37-40: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:92:51-54: Expected a type form, got instance of `object` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:92:27-30: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:92:37-40: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:92:51-54: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:110:27-28: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:110:33-34: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:113:26-29: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:113:36-39: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:113:50-53: Expected a type form, got instance of `object` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:110:27-28: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:110:33-34: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:113:26-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:113:36-39: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:113:50-53: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:131:30-33: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:131:38-42: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:131:30-33: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:131:38-42: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:135:32-33: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:135:38-42: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:135:32-33: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:135:38-42: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:137:22-23: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:137:22-23: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:139:22-23: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:139:22-23: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:146:30-31: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:146:36-37: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:146:30-31: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:146:36-37: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:154:28-29: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:154:34-35: Expected a type form, got instance of `TypeVar` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:154:28-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:154:34-35: Function call cannot be used in annotations [invalid-annotation]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:158:28-29: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:160:34-37: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:160:50-53: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:160:66-69: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:160:74-77: Expected a type form, got instance of `object` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:169:20-21: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:169:26-27: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:171:29-37: Expected a type form, got instance of `Literal[0]` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:173:22-30: Expected a type form, got instance of `Literal[0]` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:173:41-42: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:174:22-23: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:174:30-31: Expected a type form, got instance of `TypeVar` [not-a-type]
- ERROR mypyc/test-data/fixtures/typing-full.pyi:175:30-38: Expected a type form, got instance of `Literal[0]` [not-a-type]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:158:28-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:160:34-37: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:160:50-53: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:160:66-69: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:160:74-77: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:169:20-21: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:169:26-27: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:171:29-37: Number literal cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:173:22-30: Number literal cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:173:41-42: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:174:22-23: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:174:30-31: Function call cannot be used in annotations [invalid-annotation]
+ ERROR mypyc/test-data/fixtures/typing-full.pyi:175:30-38: Number literal cannot be used in annotations [invalid-annotation]
paasta (https://github.com/yelp/paasta)
+ ERROR paasta_tools/bounce_lib.py:81:17-39: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:86:6-24: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:110:17-39: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:115:6-24: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:128:17-39: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:133:6-24: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:155:17-39: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:160:6-24: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:173:17-39: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/bounce_lib.py:178:6-24: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/drain_lib.py:263:16-23: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/drain_lib.py:264:24-31: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/drain_lib.py:265:22-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/drain_lib.py:266:26-33: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/drain_lib.py:304:45-52: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/frameworks/native_service_config.py:96:14-20: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/frameworks/native_service_config.py:97:15-22: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/frameworks/native_service_config.py:102:16-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/frameworks/native_service_config.py:103:14-25: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/generate_deployments_for_service.py:132:18-29: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/generate_deployments_for_service.py:227:77-88: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/generate_deployments_for_service.py:228:6-21: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/hacheck.py:39:40-49: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/hacheck.py:67:19-28: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/kubernetes_tools.py:2346:22-40: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/kubernetes_tools.py:2454:17-30: Function call cannot be used in annotations [invalid-annotation]
+ ERROR paasta_tools/mesos/master.py:301:41-53: Function call cannot be used in annotations [invalid-annotation]
|
Primer Diff Classification❌ 2 regression(s) | ➖ 1 neutral | 3 project(s) total | +132, -105 errors 2 regression(s) across mypy, paasta. error kinds:
Detailed analysis❌ Regression (2)mypy (+104, -104)
paasta (+27)
However, the cross-check shows 27/27 errors also appear in pyright, which complicates the analysis. This suggests the issue may not be a simple pyrefly-specific allowlist omission but rather a broader tooling limitation with Nevertheless, the code is semantically correct —
➖ Neutral (1)pytest-autoprofile (+1, -1)
Suggested fixesSummary: The new implicit_type_alias_syntax_problem() check fails to recognize TypeVar/ParamSpec/TypeVarTuple when defined as local classes (e.g., in typing.pyi) rather than imported, causing 66+ pyrefly-only false positive invalid-annotation errors. 1. In
2. In
Was this helpful? React with 👍 or 👎 Classification by primer-classifier (3 LLM) |
Summary
Fixes #2451
factored the syntax check into a reusable helper.
detect NameAssign bindings that were never real implicit aliases and surface the syntax error at the annotation use site.
preserves normal runtime-value typing while fixing the implicit-alias false negatives.
Test Plan
update test