File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -979,6 +979,10 @@ def add_invertible_flag(
979
979
action = "store_true" ,
980
980
help = "Disable experimental support for recursive type aliases" ,
981
981
)
982
+ # Deprecated reverse variant of the above.
983
+ internals_group .add_argument (
984
+ "--enable-recursive-aliases" , action = "store_true" , help = argparse .SUPPRESS
985
+ )
982
986
parser .add_argument (
983
987
"--enable-incomplete-feature" ,
984
988
action = "append" ,
@@ -1336,6 +1340,12 @@ def set_strict_flags() -> None:
1336
1340
if options .logical_deps :
1337
1341
options .cache_fine_grained = True
1338
1342
1343
+ if options .enable_recursive_aliases :
1344
+ print (
1345
+ "Warning: --enable-recursive-aliases is deprecated;"
1346
+ " recursive types are enabled by default"
1347
+ )
1348
+
1339
1349
# Set target.
1340
1350
if special_opts .modules + special_opts .packages :
1341
1351
options .build_type = BuildType .MODULE
Original file line number Diff line number Diff line change @@ -326,6 +326,8 @@ def __init__(self) -> None:
326
326
self .many_errors_threshold = defaults .MANY_ERRORS_THRESHOLD
327
327
# Disable recursive type aliases (currently experimental)
328
328
self .disable_recursive_aliases = False
329
+ # Deprecated reverse version of the above, do not use.
330
+ self .enable_recursive_aliases = False
329
331
330
332
# To avoid breaking plugin compatibility, keep providing new_semantic_analyzer
331
333
@property
Original file line number Diff line number Diff line change @@ -1476,3 +1476,11 @@ note: A user-defined top-level module with name "typing" is not supported
1476
1476
[out]
1477
1477
Failed to find builtin module mypy_extensions, perhaps typeshed is broken?
1478
1478
== 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
You can’t perform that action at this time.
0 commit comments