From d2a3bdffa2a73eefc83a3bf894f6e3d997213955 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 22 May 2024 22:07:46 -0700 Subject: [PATCH 1/5] Proposed clarification of spec for int/float/complex promotion --- .../results/mypy/specialtypes_promotions.toml | 3 ++- conformance/results/mypy/version.toml | 2 +- .../results/pyre/specialtypes_promotions.toml | 3 ++- conformance/results/pyre/version.toml | 2 +- .../pyright/specialtypes_promotions.toml | 4 +++- conformance/results/pyright/version.toml | 2 +- .../pytype/specialtypes_promotions.toml | 3 ++- conformance/results/pytype/version.toml | 2 +- conformance/results/results.html | 8 +++---- conformance/tests/specialtypes_promotions.py | 21 +++++++++++++--- docs/spec/special-types.rst | 24 +++++++++++++++---- 11 files changed, 54 insertions(+), 20 deletions(-) diff --git a/conformance/results/mypy/specialtypes_promotions.toml b/conformance/results/mypy/specialtypes_promotions.toml index 864bc73e2..2b3f69bfe 100644 --- a/conformance/results/mypy/specialtypes_promotions.toml +++ b/conformance/results/mypy/specialtypes_promotions.toml @@ -1,6 +1,7 @@ conformant = "Pass" output = """ -specialtypes_promotions.py:13: error: "float" has no attribute "numerator" [attr-defined] +specialtypes_promotions.py:15: error: "float" has no attribute "numerator" [attr-defined] +specialtypes_promotions.py:27: error: Incompatible return value type (got "complex", expected "float") [return-value] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 268bd31ac..1ecd16dce 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.10.0" -test_duration = 1.4 +test_duration = 1.2 diff --git a/conformance/results/pyre/specialtypes_promotions.toml b/conformance/results/pyre/specialtypes_promotions.toml index fb9055fb6..5763c8b25 100644 --- a/conformance/results/pyre/specialtypes_promotions.toml +++ b/conformance/results/pyre/specialtypes_promotions.toml @@ -3,8 +3,9 @@ notes = """ Does not reject use of attribute that is compatible only with float. """ output = """ +specialtypes_promotions.py:27:8 Incompatible return type [7]: Expected `float` but got `complex`. """ conformance_automated = "Fail" errors_diff = """ -Line 13: Expected 1 errors +Line 15: Expected 1 errors """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 57ed5696a..8156a667e 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.21" -test_duration = 3.4 +test_duration = 1.7 diff --git a/conformance/results/pyright/specialtypes_promotions.toml b/conformance/results/pyright/specialtypes_promotions.toml index 20daf3a3e..5d5f8239a 100644 --- a/conformance/results/pyright/specialtypes_promotions.toml +++ b/conformance/results/pyright/specialtypes_promotions.toml @@ -1,7 +1,9 @@ conformant = "Pass" output = """ -specialtypes_promotions.py:13:7 - error: Cannot access attribute "numerator" for class "float" +specialtypes_promotions.py:15:7 - error: Cannot access attribute "numerator" for class "float"   Attribute "numerator" is unknown (reportAttributeAccessIssue) +specialtypes_promotions.py:27:16 - error: Expression of type "complex" is incompatible with return type "float" +  "complex" is incompatible with "float" (reportReturnType) """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 6302edbf3..e52cbce97 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.364" -test_duration = 1.4 +test_duration = 1.3 diff --git a/conformance/results/pytype/specialtypes_promotions.toml b/conformance/results/pytype/specialtypes_promotions.toml index dc20943f2..2d7fe2a90 100644 --- a/conformance/results/pytype/specialtypes_promotions.toml +++ b/conformance/results/pytype/specialtypes_promotions.toml @@ -1,6 +1,7 @@ conformant = "Pass" output = """ -File "specialtypes_promotions.py", line 13, in func1: No attribute 'numerator' on float [attribute-error] +File "specialtypes_promotions.py", line 15, in func1: No attribute 'numerator' on float [attribute-error] +File "specialtypes_promotions.py", line 27, in func2: bad return type [bad-return-type] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 68b8ac608..4dcc84244 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.04.11" -test_duration = 30.1 +test_duration = 27.6 diff --git a/conformance/results/results.html b/conformance/results/results.html index 9693b2e83..003ac1430 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

 
mypy 1.10.0
-
1.4sec
+
1.2sec
pyright 1.1.364
-
1.4sec
+
1.3sec
pyre 0.9.21
-
3.4sec
+
1.7sec
pytype 2024.04.11
-
30.1sec
+
27.6sec
diff --git a/conformance/tests/specialtypes_promotions.py b/conformance/tests/specialtypes_promotions.py index fc51e1331..277a05c10 100644 --- a/conformance/tests/specialtypes_promotions.py +++ b/conformance/tests/specialtypes_promotions.py @@ -2,6 +2,8 @@ Tests "type promotions" for float and complex when they appear in annotations. """ +from typing import assert_type + # Specification: https://typing.readthedocs.io/en/latest/spec/special-types.html#special-cases-for-float-and-complex v1: float = 1 @@ -10,7 +12,20 @@ def func1(f: float): - f.numerator # E + f.numerator # E: attribute exists on int but not float + + if isinstance(f, float): + assert_type(f, float) + else: + assert_type(f, int) + - if not isinstance(f, float): - f.numerator # OK +def func2(x: int) -> float: + if x == 0: + return 1 + elif x == 1: + return 1j # E + elif x > 10: + return x + else: + return 1.0 diff --git a/docs/spec/special-types.rst b/docs/spec/special-types.rst index b94222e60..819ffbb56 100644 --- a/docs/spec/special-types.rst +++ b/docs/spec/special-types.rst @@ -113,11 +113,25 @@ Special cases for ``float`` and ``complex`` Python's numeric types ``complex``, ``float`` and ``int`` are not subtypes of each other, but to support common use cases, the type -system contains a straightforward shortcut: -when an argument is annotated as having -type ``float``, an argument of type ``int`` is acceptable; similar, -for an argument annotated as having type ``complex``, arguments of -type ``float`` or ``int`` are acceptable. +system contains a special case. + +When a reference to the built-in type ``float`` appears in a :term:`type expression`, +it is interpreted as if it were a union of the built-in types ``float`` and ``int``. +Similarly, when a reference to the type ``complex`` appears, it is interpreted as +a union of the builtin-types ``complex``, ``float`` and ``int``. +These implicit unions behave exactly like the corresponding explicit union types, +but type checkers may choose to display them differently in user-visible output +for clarity. + +Type checkers should support narrowing the type of a variable to exactly ``float`` +or ``int``, without the implicit union, through a call to ``isinstance()``:: + + def f(x: float) -> None: + reveal_type(x) # float | int, but type checkers may display just "float" + if isinstance(x, float): + reveal_type(x) # float + else: + reveal_type(x) # int .. _`type-brackets`: From cfefa40231f49b7e36ecf4828050eb7c869cf0eb Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 22 May 2024 22:09:52 -0700 Subject: [PATCH 2/5] typo --- docs/spec/special-types.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/spec/special-types.rst b/docs/spec/special-types.rst index 819ffbb56..b0339ae0c 100644 --- a/docs/spec/special-types.rst +++ b/docs/spec/special-types.rst @@ -118,7 +118,7 @@ system contains a special case. When a reference to the built-in type ``float`` appears in a :term:`type expression`, it is interpreted as if it were a union of the built-in types ``float`` and ``int``. Similarly, when a reference to the type ``complex`` appears, it is interpreted as -a union of the builtin-types ``complex``, ``float`` and ``int``. +a union of the built-in types ``complex``, ``float`` and ``int``. These implicit unions behave exactly like the corresponding explicit union types, but type checkers may choose to display them differently in user-visible output for clarity. From cf3486fef90e730e2dc3a364c378677da794e086 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 22 May 2024 22:33:19 -0700 Subject: [PATCH 3/5] remove incorrect case --- conformance/results/pyre/version.toml | 2 +- conformance/results/pytype/version.toml | 2 +- conformance/results/results.html | 4 ++-- conformance/tests/specialtypes_promotions.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 8156a667e..8b31620f0 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.21" -test_duration = 1.7 +test_duration = 2.3 diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 4dcc84244..2d05bc7f2 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.04.11" -test_duration = 27.6 +test_duration = 27.3 diff --git a/conformance/results/results.html b/conformance/results/results.html index 003ac1430..9e7655c7b 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -165,10 +165,10 @@

Python Type System Conformance Test Results

1.3sec
pyre 0.9.21
-
1.7sec
+
2.3sec
pytype 2024.04.11
-
27.6sec
+
27.3sec
diff --git a/conformance/tests/specialtypes_promotions.py b/conformance/tests/specialtypes_promotions.py index 277a05c10..410ff4e64 100644 --- a/conformance/tests/specialtypes_promotions.py +++ b/conformance/tests/specialtypes_promotions.py @@ -15,7 +15,7 @@ def func1(f: float): f.numerator # E: attribute exists on int but not float if isinstance(f, float): - assert_type(f, float) + f.hex() # OK (attribute exists on float but not int) else: assert_type(f, int) From 6155dbdc1a4553a31a0340c096309f27e7e7ad90 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 23 May 2024 07:05:59 -0700 Subject: [PATCH 4/5] Extend test --- conformance/results/mypy/specialtypes_promotions.toml | 4 ++-- conformance/results/mypy/version.toml | 2 +- conformance/results/pyre/specialtypes_promotions.toml | 4 ++-- conformance/results/pyre/version.toml | 2 +- conformance/results/pyright/specialtypes_promotions.toml | 4 ++-- conformance/results/pyright/version.toml | 2 +- conformance/results/pytype/specialtypes_promotions.toml | 4 ++-- conformance/results/pytype/version.toml | 2 +- conformance/results/results.html | 8 ++++---- conformance/tests/specialtypes_promotions.py | 8 +++++--- 10 files changed, 21 insertions(+), 19 deletions(-) diff --git a/conformance/results/mypy/specialtypes_promotions.toml b/conformance/results/mypy/specialtypes_promotions.toml index 2b3f69bfe..f1a466553 100644 --- a/conformance/results/mypy/specialtypes_promotions.toml +++ b/conformance/results/mypy/specialtypes_promotions.toml @@ -1,7 +1,7 @@ conformant = "Pass" output = """ -specialtypes_promotions.py:15: error: "float" has no attribute "numerator" [attr-defined] -specialtypes_promotions.py:27: error: Incompatible return value type (got "complex", expected "float") [return-value] +specialtypes_promotions.py:17: error: "float" has no attribute "numerator" [attr-defined] +specialtypes_promotions.py:29: error: Incompatible return value type (got "complex", expected "float") [return-value] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 1ecd16dce..9c6b57d39 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.10.0" -test_duration = 1.2 +test_duration = 6.2 diff --git a/conformance/results/pyre/specialtypes_promotions.toml b/conformance/results/pyre/specialtypes_promotions.toml index 5763c8b25..4d57e8ce1 100644 --- a/conformance/results/pyre/specialtypes_promotions.toml +++ b/conformance/results/pyre/specialtypes_promotions.toml @@ -3,9 +3,9 @@ notes = """ Does not reject use of attribute that is compatible only with float. """ output = """ -specialtypes_promotions.py:27:8 Incompatible return type [7]: Expected `float` but got `complex`. +specialtypes_promotions.py:29:8 Incompatible return type [7]: Expected `float` but got `complex`. """ conformance_automated = "Fail" errors_diff = """ -Line 15: Expected 1 errors +Line 17: Expected 1 errors """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 8b31620f0..47c7ebccd 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.21" -test_duration = 2.3 +test_duration = 2.6 diff --git a/conformance/results/pyright/specialtypes_promotions.toml b/conformance/results/pyright/specialtypes_promotions.toml index 5d5f8239a..da01e5ad0 100644 --- a/conformance/results/pyright/specialtypes_promotions.toml +++ b/conformance/results/pyright/specialtypes_promotions.toml @@ -1,8 +1,8 @@ conformant = "Pass" output = """ -specialtypes_promotions.py:15:7 - error: Cannot access attribute "numerator" for class "float" +specialtypes_promotions.py:17:7 - error: Cannot access attribute "numerator" for class "float"   Attribute "numerator" is unknown (reportAttributeAccessIssue) -specialtypes_promotions.py:27:16 - error: Expression of type "complex" is incompatible with return type "float" +specialtypes_promotions.py:29:16 - error: Expression of type "complex" is incompatible with return type "float"   "complex" is incompatible with "float" (reportReturnType) """ conformance_automated = "Pass" diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index e52cbce97..f2385b55e 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.364" -test_duration = 1.3 +test_duration = 1.8 diff --git a/conformance/results/pytype/specialtypes_promotions.toml b/conformance/results/pytype/specialtypes_promotions.toml index 2d7fe2a90..89270b31d 100644 --- a/conformance/results/pytype/specialtypes_promotions.toml +++ b/conformance/results/pytype/specialtypes_promotions.toml @@ -1,7 +1,7 @@ conformant = "Pass" output = """ -File "specialtypes_promotions.py", line 15, in func1: No attribute 'numerator' on float [attribute-error] -File "specialtypes_promotions.py", line 27, in func2: bad return type [bad-return-type] +File "specialtypes_promotions.py", line 17, in func1: No attribute 'numerator' on float [attribute-error] +File "specialtypes_promotions.py", line 29, in func2: bad return type [bad-return-type] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 2d05bc7f2..4c23eb4b6 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.04.11" -test_duration = 27.3 +test_duration = 54.5 diff --git a/conformance/results/results.html b/conformance/results/results.html index 9e7655c7b..e0a66c34e 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

 
mypy 1.10.0
-
1.2sec
+
6.2sec
pyright 1.1.364
-
1.3sec
+
1.8sec
pyre 0.9.21
-
2.3sec
+
2.6sec
pytype 2024.04.11
-
27.3sec
+
54.5sec
diff --git a/conformance/tests/specialtypes_promotions.py b/conformance/tests/specialtypes_promotions.py index 410ff4e64..64e728cfb 100644 --- a/conformance/tests/specialtypes_promotions.py +++ b/conformance/tests/specialtypes_promotions.py @@ -6,9 +6,11 @@ # Specification: https://typing.readthedocs.io/en/latest/spec/special-types.html#special-cases-for-float-and-complex -v1: float = 1 -v2: complex = 1.2 -v2 = 1 +v1: int = 1 +v2: float = 1 +v3: float = v1 +v4: complex = 1.2 +v4 = 1 def func1(f: float): From a442bfe0353973966b39eb8d2232bebeab38a9a7 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 23 May 2024 07:39:15 -0700 Subject: [PATCH 5/5] Guard against unreachability --- conformance/results/mypy/specialtypes_promotions.toml | 10 +++++++--- conformance/results/mypy/version.toml | 2 +- conformance/results/pyre/specialtypes_promotions.toml | 4 +++- conformance/results/pyre/version.toml | 2 +- .../results/pyright/specialtypes_promotions.toml | 4 +++- conformance/results/pyright/version.toml | 2 +- .../results/pytype/specialtypes_promotions.toml | 10 +++++++--- conformance/results/pytype/version.toml | 2 +- conformance/results/results.html | 8 ++++---- conformance/tests/specialtypes_promotions.py | 6 +++++- 10 files changed, 33 insertions(+), 17 deletions(-) diff --git a/conformance/results/mypy/specialtypes_promotions.toml b/conformance/results/mypy/specialtypes_promotions.toml index f1a466553..04499e866 100644 --- a/conformance/results/mypy/specialtypes_promotions.toml +++ b/conformance/results/mypy/specialtypes_promotions.toml @@ -1,8 +1,12 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +Does not narrow from float to int after isinstance() check +""" output = """ specialtypes_promotions.py:17: error: "float" has no attribute "numerator" [attr-defined] -specialtypes_promotions.py:29: error: Incompatible return value type (got "complex", expected "float") [return-value] +specialtypes_promotions.py:33: error: Incompatible return value type (got "complex", expected "float") [return-value] """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 26: Expected 1 errors """ diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 9c6b57d39..dc9b55ed5 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.10.0" -test_duration = 6.2 +test_duration = 1.5 diff --git a/conformance/results/pyre/specialtypes_promotions.toml b/conformance/results/pyre/specialtypes_promotions.toml index 4d57e8ce1..f17ad77f7 100644 --- a/conformance/results/pyre/specialtypes_promotions.toml +++ b/conformance/results/pyre/specialtypes_promotions.toml @@ -1,11 +1,13 @@ conformant = "Partial" notes = """ Does not reject use of attribute that is compatible only with float. +Does not narrow from float to int after isinstance() check """ output = """ -specialtypes_promotions.py:29:8 Incompatible return type [7]: Expected `float` but got `complex`. +specialtypes_promotions.py:33:8 Incompatible return type [7]: Expected `float` but got `complex`. """ conformance_automated = "Fail" errors_diff = """ Line 17: Expected 1 errors +Line 26: Expected 1 errors """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 47c7ebccd..1fec89dee 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.21" -test_duration = 2.6 +test_duration = 2.9 diff --git a/conformance/results/pyright/specialtypes_promotions.toml b/conformance/results/pyright/specialtypes_promotions.toml index da01e5ad0..560cb1193 100644 --- a/conformance/results/pyright/specialtypes_promotions.toml +++ b/conformance/results/pyright/specialtypes_promotions.toml @@ -2,7 +2,9 @@ conformant = "Pass" output = """ specialtypes_promotions.py:17:7 - error: Cannot access attribute "numerator" for class "float"   Attribute "numerator" is unknown (reportAttributeAccessIssue) -specialtypes_promotions.py:29:16 - error: Expression of type "complex" is incompatible with return type "float" +specialtypes_promotions.py:26:16 - error: Expression of type "Literal['x']" is incompatible with return type "int" +  "Literal['x']" is incompatible with "int" (reportReturnType) +specialtypes_promotions.py:33:16 - error: Expression of type "complex" is incompatible with return type "float"   "complex" is incompatible with "float" (reportReturnType) """ conformance_automated = "Pass" diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index f2385b55e..789c07a2b 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.364" -test_duration = 1.8 +test_duration = 1.6 diff --git a/conformance/results/pytype/specialtypes_promotions.toml b/conformance/results/pytype/specialtypes_promotions.toml index 89270b31d..3d6ee0732 100644 --- a/conformance/results/pytype/specialtypes_promotions.toml +++ b/conformance/results/pytype/specialtypes_promotions.toml @@ -1,8 +1,12 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +Does not narrow from float to int after isinstance() check +""" output = """ File "specialtypes_promotions.py", line 17, in func1: No attribute 'numerator' on float [attribute-error] -File "specialtypes_promotions.py", line 29, in func2: bad return type [bad-return-type] +File "specialtypes_promotions.py", line 33, in func2: bad return type [bad-return-type] """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 26: Expected 1 errors """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 4c23eb4b6..bbfb29cda 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.04.11" -test_duration = 54.5 +test_duration = 49.8 diff --git a/conformance/results/results.html b/conformance/results/results.html index e0a66c34e..bc90bed9c 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

 
mypy 1.10.0
-
6.2sec
+
1.5sec
pyright 1.1.364
-
1.8sec
+
1.6sec
pyre 0.9.21
-
2.6sec
+
2.9sec
pytype 2024.04.11
-
54.5sec
+
49.8sec
diff --git a/conformance/tests/specialtypes_promotions.py b/conformance/tests/specialtypes_promotions.py index 64e728cfb..0216337df 100644 --- a/conformance/tests/specialtypes_promotions.py +++ b/conformance/tests/specialtypes_promotions.py @@ -13,13 +13,17 @@ v4 = 1 -def func1(f: float): +def func1(f: float) -> int: f.numerator # E: attribute exists on int but not float if isinstance(f, float): f.hex() # OK (attribute exists on float but not int) + return 1 else: assert_type(f, int) + # Make sure type checkers don't treat this branch as unreachable + # and skip checking it. + return "x" # E def func2(x: int) -> float: