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

Temporarily put back --enable-recursive-aliases (as depreceated) #13852

Merged
merged 3 commits into from
Oct 9, 2022
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
10 changes: 10 additions & 0 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,10 @@ def add_invertible_flag(
action="store_true",
help="Disable experimental support for recursive type aliases",
)
# Deprecated reverse variant of the above.
internals_group.add_argument(
"--enable-recursive-aliases", action="store_true", help=argparse.SUPPRESS
)
parser.add_argument(
"--enable-incomplete-feature",
action="append",
Expand Down Expand Up @@ -1336,6 +1340,12 @@ def set_strict_flags() -> None:
if options.logical_deps:
options.cache_fine_grained = True

if options.enable_recursive_aliases:
print(
"Warning: --enable-recursive-aliases is deprecated;"
" recursive types are enabled by default"
)

# Set target.
if special_opts.modules + special_opts.packages:
options.build_type = BuildType.MODULE
Expand Down
2 changes: 2 additions & 0 deletions mypy/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ def __init__(self) -> None:
self.many_errors_threshold = defaults.MANY_ERRORS_THRESHOLD
# Disable recursive type aliases (currently experimental)
self.disable_recursive_aliases = False
# Deprecated reverse version of the above, do not use.
self.enable_recursive_aliases = False

# To avoid breaking plugin compatibility, keep providing new_semantic_analyzer
@property
Expand Down
8 changes: 8 additions & 0 deletions test-data/unit/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -1476,3 +1476,11 @@ note: A user-defined top-level module with name "typing" is not supported
[out]
Failed to find builtin module mypy_extensions, perhaps typeshed is broken?
== Return code: 2

[case testRecursiveAliasesFlagDeprecated]
# cmd: mypy --enable-recursive-aliases a.py
[file a.py]
pass
[out]
Warning: --enable-recursive-aliases is deprecated; recursive types are enabled by default
== Return code: 0