Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e59c310
[PEP 747] Recognize TypeForm[T] type and values (#9773)
davidfstr Sep 29, 2024
9a1992a
Fix multiple issues broken by upstream
davidfstr Jul 24, 2025
06fc9e4
Apply feedback: Change MAYBE_UNRECOGNIZED_STR_TYPEFORM from unaccompa…
davidfstr Jul 27, 2025
c7a5e1f
Apply feedback: Refactor extract save/restore of SemanticAnalyzer sta…
davidfstr Jul 27, 2025
20df001
Apply feedback: Suppress SyntaxWarnings when parsing strings as types
davidfstr Jul 28, 2025
07009a9
Apply feedback: Add TypeForm profiling counters to SemanticAnalyzer a…
davidfstr Jul 28, 2025
0104ce5
Increase efficiency of quick rejection heuristic from 85.8% -> 99.6%
davidfstr Jul 29, 2025
a958b45
Apply feedback: Recognize assignment to union of TypeForm with non-Ty…
davidfstr Jul 30, 2025
e4e5530
Add comment explaining safety of empty tvar scope in TypeAnalyser use…
davidfstr Jul 30, 2025
8e130ba
Allow TypeAlias and PlaceholderNode to be stringified/printed
davidfstr Aug 5, 2025
502e1a5
Apply feedback: Alter primitives.pyi fixture rather than tuple.pyi an…
davidfstr Aug 5, 2025
d8c59f5
NOMERGE: mypy_primer: Enable --enable-incomplete-feature=TypeForm whe…
davidfstr Mar 8, 2025
3521896
Merge branch 'master' into f/typeform4
davidfstr Aug 5, 2025
5a64c78
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 5, 2025
cc4fc23
SQ -> Allow TypeAlias and PlaceholderNode to be stringified/printed
davidfstr Aug 5, 2025
f14b163
SQ -> Merge branch 'master' into f/typeform4 -- Fix bad merge
davidfstr Aug 6, 2025
f4cb3f9
Fix test: testUnionOrSyntaxWithinRuntimeContextNotAllowed
davidfstr Aug 6, 2025
53174d4
Fix error: Never apply isinstance() to unexpanded types
davidfstr Aug 6, 2025
4cc1b18
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 6, 2025
45d9379
Make ruff happy
davidfstr Aug 6, 2025
e91d02d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 6, 2025
80d84b6
Fix {NameAndMemberCollector, all_name_and_member_expressions} to visi…
davidfstr Oct 23, 2025
f191c95
Alter TypeForm tests to import TypeForm from typing_extensions
davidfstr Oct 23, 2025
84d87cb
Merge remote-tracking branch 'origin/master' into f/typeform4
davidfstr Oct 23, 2025
690af88
Revert "NOMERGE: mypy_primer: Enable --enable-incomplete-feature=Type…
davidfstr Oct 23, 2025
e19533a
Fix test that was missing: --enable-incomplete-feature=TypeForm
davidfstr Oct 23, 2025
3dfb36a
Fix test 2 that was missing: --enable-incomplete-feature=TypeForm
davidfstr Oct 25, 2025
fadc994
Fix recognition of several typing special forms, including: Optional,…
davidfstr Oct 25, 2025
820d58f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2025
ca6f8a5
SQ -> Fix recognition of several typing special forms, including: Opt…
davidfstr Oct 25, 2025
e704c07
Downgrade syntax related to type statement, TypeVarTuple, and Unpack,…
davidfstr Oct 25, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 25, 2025
commit 820d58f819d0a320ff69c264a9122142bd48f3dd
35 changes: 19 additions & 16 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7843,8 +7843,9 @@ def try_parse_as_type_expression(self, maybe_type_expr: Expression) -> None:
return
elif isinstance(maybe_type_expr, IndexExpr):
if isinstance(maybe_type_expr.base, NameExpr):
if (isinstance(maybe_type_expr.base.node, Var) and
not self.var_is_typing_special_form(maybe_type_expr.base)):
if isinstance(
maybe_type_expr.base.node, Var
) and not self.var_is_typing_special_form(maybe_type_expr.base):
# Leftmost part of IndexExpr refers to a Var. Not a valid type.
maybe_type_expr.as_type = None
return
Expand All @@ -7856,8 +7857,9 @@ def try_parse_as_type_expression(self, maybe_type_expr: Expression) -> None:
break
next_leftmost = leftmost
if isinstance(leftmost, NameExpr):
if (isinstance(leftmost.node, Var) and
not self.var_is_typing_special_form(leftmost.node)):
if isinstance(leftmost.node, Var) and not self.var_is_typing_special_form(
leftmost.node
):
# Leftmost part of IndexExpr refers to a Var. Not a valid type.
maybe_type_expr.as_type = None
return
Expand Down Expand Up @@ -7907,18 +7909,19 @@ def try_parse_as_type_expression(self, maybe_type_expr: Expression) -> None:

@staticmethod
def var_is_typing_special_form(var: Var) -> bool:
return (
var.fullname.startswith('typing') and
var.fullname in [
'typing.Annotated', 'typing_extensions.Annotated',
'typing.Callable',
'typing.Literal', 'typing_extensions.Literal',
'typing.Optional',
'typing.TypeGuard', 'typing_extensions.TypeGuard',
'typing.TypeIs', 'typing_extensions.TypeIs',
'typing.Union',
]
)
return var.fullname.startswith("typing") and var.fullname in [
"typing.Annotated",
"typing_extensions.Annotated",
"typing.Callable",
"typing.Literal",
"typing_extensions.Literal",
"typing.Optional",
"typing.TypeGuard",
"typing_extensions.TypeGuard",
"typing.TypeIs",
"typing_extensions.TypeIs",
"typing.Union",
]

@contextmanager
def isolated_error_analysis(self) -> Iterator[None]:
Expand Down
Loading