Skip to content

Commit 0c4b763

Browse files
authored
Temporarily put back --enable-recursive-aliases (as depreceated) (#13852)
The motivation here is to not penalize people who try early features with breaking their CI. We can delete this flag after one-two releases.
1 parent b79a20a commit 0c4b763

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

mypy/main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,10 @@ def add_invertible_flag(
979979
action="store_true",
980980
help="Disable experimental support for recursive type aliases",
981981
)
982+
# Deprecated reverse variant of the above.
983+
internals_group.add_argument(
984+
"--enable-recursive-aliases", action="store_true", help=argparse.SUPPRESS
985+
)
982986
parser.add_argument(
983987
"--enable-incomplete-feature",
984988
action="append",
@@ -1336,6 +1340,12 @@ def set_strict_flags() -> None:
13361340
if options.logical_deps:
13371341
options.cache_fine_grained = True
13381342

1343+
if options.enable_recursive_aliases:
1344+
print(
1345+
"Warning: --enable-recursive-aliases is deprecated;"
1346+
" recursive types are enabled by default"
1347+
)
1348+
13391349
# Set target.
13401350
if special_opts.modules + special_opts.packages:
13411351
options.build_type = BuildType.MODULE

mypy/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ def __init__(self) -> None:
326326
self.many_errors_threshold = defaults.MANY_ERRORS_THRESHOLD
327327
# Disable recursive type aliases (currently experimental)
328328
self.disable_recursive_aliases = False
329+
# Deprecated reverse version of the above, do not use.
330+
self.enable_recursive_aliases = False
329331

330332
# To avoid breaking plugin compatibility, keep providing new_semantic_analyzer
331333
@property

test-data/unit/cmdline.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,3 +1476,11 @@ note: A user-defined top-level module with name "typing" is not supported
14761476
[out]
14771477
Failed to find builtin module mypy_extensions, perhaps typeshed is broken?
14781478
== Return code: 2
1479+
1480+
[case testRecursiveAliasesFlagDeprecated]
1481+
# cmd: mypy --enable-recursive-aliases a.py
1482+
[file a.py]
1483+
pass
1484+
[out]
1485+
Warning: --enable-recursive-aliases is deprecated; recursive types are enabled by default
1486+
== Return code: 0

0 commit comments

Comments
 (0)