Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6030,8 +6030,10 @@ def accept(
# We cannot use cache inside lambdas, because they skip immediate type
# context, and use enclosing one, see infer_lambda_type_using_context().
# TODO: consider using cache for more expression kinds.
elif isinstance(node, (CallExpr, ListExpr, TupleExpr, DictExpr, OpExpr)) and not (
self.in_lambda_expr or self.chk.current_node_deferred
elif (
isinstance(node, (CallExpr, ListExpr, TupleExpr, DictExpr, OpExpr))
and not (self.in_lambda_expr or self.chk.current_node_deferred)
and not self.chk.options.disable_expression_cache
):
if (node, type_context) in self.expr_cache:
binder_version, typ, messages, type_map = self.expr_cache[(node, type_context)]
Expand Down
7 changes: 4 additions & 3 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,14 +1090,15 @@ def add_invertible_flag(
help="Use a custom typing module",
)
internals_group.add_argument(
"--old-type-inference",
action="store_true",
help="Disable new experimental type inference algorithm",
"--old-type-inference", action="store_true", help=argparse.SUPPRESS
)
# Deprecated reverse variant of the above.
internals_group.add_argument(
"--new-type-inference", action="store_true", help=argparse.SUPPRESS
)
internals_group.add_argument(
"--disable-expression-cache", action="store_true", help=argparse.SUPPRESS
)
parser.add_argument(
"--enable-incomplete-feature",
action="append",
Expand Down
2 changes: 2 additions & 0 deletions mypy/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ def __init__(self) -> None:
self.old_type_inference = False
# Deprecated reverse version of the above, do not use.
self.new_type_inference = False
# Disable expression cache (for debugging).
self.disable_expression_cache = False
# Export line-level, limited, fine-grained dependency information in cache data
# (undocumented feature).
self.export_ref_info = False
Expand Down
Loading