Skip to content

Commit

Permalink
Document --enable-incomplete-feature possible values in "mypy --help" (
Browse files Browse the repository at this point in the history
…#16661)

By the way, also remove `--enable-incomplete-feature=Unpack
--enable-incomplete-feature=TypeVarTuple` when running the tests, as
they are no more incomplete features.
    
Fixes #14452

Co-authored-by: David Froger <[email protected]>
  • Loading branch information
dfroger and David Froger committed Dec 13, 2023
1 parent 09cb2d1 commit 5e77c3e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ format into the specified directory.
Enabling incomplete/experimental features
*****************************************

.. option:: --enable-incomplete-feature FEATURE
.. option:: --enable-incomplete-feature {PreciseTupleTypes}

Some features may require several mypy releases to implement, for example
due to their complexity, potential for backwards incompatibility, or
Expand Down
2 changes: 1 addition & 1 deletion mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ def add_invertible_flag(
parser.add_argument(
"--enable-incomplete-feature",
action="append",
metavar="FEATURE",
metavar="{" + ",".join(sorted(INCOMPLETE_FEATURES)) + "}",
help="Enable support of incomplete/experimental features for early preview",
)
internals_group.add_argument(
Expand Down
3 changes: 1 addition & 2 deletions mypyc/test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from mypy import build
from mypy.errors import CompileError
from mypy.options import TYPE_VAR_TUPLE, UNPACK, Options
from mypy.options import Options
from mypy.test.config import test_temp_dir
from mypy.test.data import DataDrivenTestCase
from mypy.test.helpers import assert_module_equivalence, perform_file_operations
Expand Down Expand Up @@ -194,7 +194,6 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) ->
options.preserve_asts = True
options.allow_empty_bodies = True
options.incremental = self.separate
options.enable_incomplete_feature = [TYPE_VAR_TUPLE, UNPACK]

# Avoid checking modules/packages named 'unchecked', to provide a way
# to test interacting with code we don't have types for.
Expand Down
3 changes: 1 addition & 2 deletions test-data/unit/pythoneval.test
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ _testInferenceOfDunderDictOnClassObjects.py:4: error: Property "__dict__" define
_testInferenceOfDunderDictOnClassObjects.py:4: error: Incompatible types in assignment (expression has type "Dict[Never, Never]", variable has type "MappingProxyType[str, Any]")

[case testTypeVarTuple]
# flags: --enable-incomplete-feature=TypeVarTuple --enable-incomplete-feature=Unpack --python-version=3.11
# flags: --python-version=3.11
from typing import Any, Callable, Unpack, TypeVarTuple

Ts = TypeVarTuple("Ts")
Expand All @@ -2019,7 +2019,6 @@ def call(callback: Callable[[Unpack[Ts]], Any], *args: Unpack[Ts]) -> Any:
...

[case testTypeVarTupleTypingExtensions]
# flags: --enable-incomplete-feature=TypeVarTuple --enable-incomplete-feature=Unpack
from typing_extensions import Unpack, TypeVarTuple
from typing import Any, Callable

Expand Down

0 comments on commit 5e77c3e

Please sign in to comment.