Skip to content

Commit 2f008ed

Browse files
authored
Zuban Update (#2085)
* Make it possible to run only a specific type checker * In some cases a test around Never could mark too many statements after it as unreachable * Upgrade test results
1 parent e7ad24c commit 2f008ed

19 files changed

+110
-302
lines changed

conformance/results/results.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ <h3>Python Type System Conformance Test Results</h3>
164164
</th>
165165
<th class='tc-header'><div class='tc-name'>pyre 0.9.25</div>
166166
</th>
167-
<th class='tc-header'><div class='tc-name'>zuban 0.0.20</div>
167+
<th class='tc-header'><div class='tc-name'>zuban 0.0.24</div>
168168
</th>
169169
<th class='tc-header'><div class='tc-name'>pyrefly 0.30.0</div>
170170
</th>
@@ -371,7 +371,7 @@ <h3>Python Type System Conformance Test Results</h3>
371371
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Type parameter syntax not yet support.</p></span></div></th>
372372
<th class="column col2 conformant">Pass</th>
373373
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Incorrectly determines that a class cannot be instantiated with __getitem__.</p><p>Incorrectly handles mixing legacy and PEP695 syntax.</p></span></div></th>
374-
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Type parameter syntax not yet support.</p></span></div></th>
374+
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Final is handled a bit different (questionable if this is an issue)</p></span></div></th>
375375
<th class="column col2 conformant">Pass</th>
376376
</tr>
377377
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_syntax_scoping</th>
@@ -565,7 +565,7 @@ <h3>Python Type System Conformance Test Results</h3>
565565
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Support for `LiteralString` is not implemented.</p></span></div></th>
566566
<th class="column col2 conformant">Pass</th>
567567
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Incorrectly infers `str` rather than `LiteralString` when literal string `join` is used.</p></span></div></th>
568-
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Support for `LiteralString` is not implemented.</p></span></div></th>
568+
<th class="column col2 conformant">Pass</th>
569569
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>LiteralString is sometimes converted to str</p></span></div></th>
570570
</tr>
571571
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;literals_parameterizations</th>
@@ -707,7 +707,7 @@ <h3>Python Type System Conformance Test Results</h3>
707707
<th class="column col2 not-conformant"><div class="hover-text">Unupported<span class="tooltip-text" id="bottom"><p>Does not honor metaclass __call__ method when evaluating constructor call.</p><p>Does not skip evaluation of __new__ and __init__ if custom metaclass call returns non-class.</p></span></div></th>
708708
<th class="column col2 conformant">Pass</th>
709709
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not evaluate __new__ if metaclass __call__ is defined.</p></span></div></th>
710-
<th class="column col2 not-conformant"><div class="hover-text">Unupported<span class="tooltip-text" id="bottom"><p>Does not honor metaclass __call__ method when evaluating constructor call.</p><p>Does not skip evaluation of __new__ and __init__ if custom metaclass call returns non-class.</p></span></div></th>
710+
<th class="column col2 conformant">Pass</th>
711711
<th class="column col2 conformant">Pass</th>
712712
</tr>
713713
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;constructors_call_new</th>
@@ -870,7 +870,7 @@ <h3>Python Type System Conformance Test Results</h3>
870870
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Converter parameter not yet supported.</p></span></div></th>
871871
<th class="column col2 conformant">Pass</th>
872872
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Converter parameter not yet supported.</p></span></div></th>
873-
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Converter parameter not yet supported.</p></span></div></th>
873+
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Converters are fully supported, failed to match generic overloads against other generics</p></span></div></th>
874874
<th class="column col2 conformant">Pass</th>
875875
</tr>
876876
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataclasses_transform_field</th>
@@ -922,7 +922,7 @@ <h3>Python Type System Conformance Test Results</h3>
922922
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Not supported.</p></span></div></th>
923923
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not flag illegal use of `closed=False` when inheriting from a non-open TypedDict.</p></span></div></th>
924924
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Not supported.</p></span></div></th>
925-
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Not supported.</p></span></div></th>
925+
<th class="column col2 conformant">Pass</th>
926926
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not fully support extra_items for typed dicts</p></span></div></th>
927927
</tr>
928928
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typeddicts_final</th>
@@ -1140,7 +1140,7 @@ <h3>Python Type System Conformance Test Results</h3>
11401140
<th class="column col2 conformant">Pass</th>
11411141
<th class="column col2 conformant">Pass</th>
11421142
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Does not support @deprecated.</p></span></div></th>
1143-
<th class="column col2 not-conformant">Unsupported</th>
1143+
<th class="column col2 conformant">Pass</th>
11441144
<th class="column col2 not-conformant">Unsupported</th>
11451145
</tr>
11461146
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directives_no_type_check</th>

conformance/results/zuban/callables_kwargs.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ callables_kwargs.py:46: error: Missing named argument "v1" for "func1" [call-ar
66
callables_kwargs.py:46: error: Missing named argument "v3" for "func1" [call-arg]
77
callables_kwargs.py:51: error: Unexpected keyword argument "v4" for "func1" [call-arg]
88
callables_kwargs.py:52: error: Too many positional arguments for "func1" [call-arg]
9+
callables_kwargs.py:52: error: Missing named argument "v1" for "func1" [call-arg]
10+
callables_kwargs.py:52: error: Missing named argument "v3" for "func1" [call-arg]
911
callables_kwargs.py:58: error: Argument 1 to "func1" has incompatible type "**dict[str, str]"; expected "int" [arg-type]
1012
callables_kwargs.py:61: error: Argument 1 to "func1" has incompatible type "**dict[str, int | str]"; expected "int" [arg-type]
1113
callables_kwargs.py:61: error: Argument 1 to "func1" has incompatible type "**dict[str, int | str]"; expected "str" [arg-type]
Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
conformant = "Unupported"
2-
notes = """
3-
Does not honor metaclass __call__ method when evaluating constructor call.
4-
Does not skip evaluation of __new__ and __init__ if custom metaclass call returns non-class.
5-
"""
6-
conformance_automated = "Fail"
1+
conformance_automated = "Pass"
72
errors_diff = """
8-
Line 23: Unexpected errors ['constructors_call_metaclass.py:23: error: Expression is of type "Class1", not "Never" [misc]', 'constructors_call_metaclass.py:23: error: Missing positional argument "x" in call to "Class1" [call-arg]']
9-
Line 36: Unexpected errors ['constructors_call_metaclass.py:36: error: Expression is of type "Class2", not "int | Meta2" [misc]', 'constructors_call_metaclass.py:36: error: Missing positional argument "x" in call to "Class2" [call-arg]']
103
"""
114
output = """
12-
constructors_call_metaclass.py:23: error: Expression is of type "Class1", not "Never" [misc]
13-
constructors_call_metaclass.py:23: error: Missing positional argument "x" in call to "Class1" [call-arg]
14-
constructors_call_metaclass.py:36: error: Expression is of type "Class2", not "int | Meta2" [misc]
15-
constructors_call_metaclass.py:36: error: Missing positional argument "x" in call to "Class2" [call-arg]
16-
constructors_call_metaclass.py:51: error: Missing positional argument "x" in call to "Class3" [call-arg]
17-
constructors_call_metaclass.py:65: error: Missing positional argument "x" in call to "Class4" [call-arg]
5+
constructors_call_metaclass.py:54: error: Missing positional argument "x" in call to "Class3" [call-arg]
6+
constructors_call_metaclass.py:68: error: Missing positional argument "x" in call to "Class4" [call-arg]
187
"""

conformance/results/zuban/constructors_callable.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ errors_diff = """
1010
Line 127: Expected 1 errors
1111
Line 144: Expected 1 errors
1212
Line 73: Unexpected errors ['constructors_callable.py:73: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]']
13-
Line 100: Unexpected errors ['constructors_callable.py:100: error: Expression is of type "Class5", not "Never" [misc]']
14-
Line 105: Unexpected errors ['constructors_callable.py:105: error: Expression is of type "Class5", not "Never" [misc]']
1513
Line 116: Unexpected errors ['constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]']
1614
Line 126: Unexpected errors ['constructors_callable.py:126: error: Expression is of type "Class6", not "Class6Proxy" [misc]', 'constructors_callable.py:126: error: Missing positional argument "x" in call [call-arg]']
1715
Line 143: Unexpected errors ['constructors_callable.py:143: error: Expression is of type "Class6Any", not "Any" [misc]', 'constructors_callable.py:143: error: Missing positional argument "x" in call [call-arg]']
@@ -34,9 +32,7 @@ constructors_callable.py:73: error: Incompatible return type for "__new__" (retu
3432
constructors_callable.py:77: note: Revealed type is "def (x: builtins.int) -> builtins.int"
3533
constructors_callable.py:79: error: Missing positional argument "x" in call [call-arg]
3634
constructors_callable.py:80: error: Unexpected keyword argument "y" [call-arg]
37-
constructors_callable.py:97: note: Revealed type is "def (*args: Any, **kwargs: Any) -> constructors_callable.Class5"
38-
constructors_callable.py:100: error: Expression is of type "Class5", not "Never" [misc]
39-
constructors_callable.py:105: error: Expression is of type "Class5", not "Never" [misc]
35+
constructors_callable.py:97: note: Revealed type is "def (*args: Any, **kwargs: Any) -> Never"
4036
constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]
4137
constructors_callable.py:125: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6"
4238
constructors_callable.py:126: error: Expression is of type "Class6", not "Class6Proxy" [misc]
Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,20 @@
1-
conformant = "Unsupported"
1+
conformant = "Partial"
22
notes = """
3-
Converter parameter not yet supported.
3+
Converters are fully supported, failed to match generic overloads against other generics
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 118: Expected 1 errors
87
Line 104: Unexpected errors ['dataclasses_transform_converter.py:104: error: Incompatible callable argument with type vars [arg-type]']
9-
Line 112: Unexpected errors ['dataclasses_transform_converter.py:112: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:112: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:112: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:112: error: Argument 4 to "DC2" has incompatible type "bytes"; expected "ConverterClass" [arg-type]', 'dataclasses_transform_converter.py:112: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]']
10-
Line 114: Unexpected errors ['dataclasses_transform_converter.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]']
11-
Line 115: Unexpected errors ['dataclasses_transform_converter.py:115: error: Incompatible types in assignment (expression has type "str", variable has type "ConverterClass") [assignment]']
12-
Line 116: Unexpected errors ['dataclasses_transform_converter.py:116: error: Incompatible types in assignment (expression has type "bytes", variable has type "ConverterClass") [assignment]']
13-
Line 121: Unexpected errors ['dataclasses_transform_converter.py:121: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:121: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:121: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:121: error: Argument 4 to "DC2" has incompatible type "str"; expected "ConverterClass" [arg-type]', 'dataclasses_transform_converter.py:121: error: Argument 5 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:121: error: Argument 6 to "DC2" has incompatible type "tuple[tuple[str, str], tuple[str, str]]"; expected "dict[str, str]" [arg-type]']
148
"""
159
output = """
1610
dataclasses_transform_converter.py:48: error: Argument "converter" to "model_field" has incompatible type "Callable[[], int]"; expected "Callable[[Never], int]" [arg-type]
1711
dataclasses_transform_converter.py:49: error: Argument "converter" to "model_field" has incompatible type "Callable[[NamedArg(int, 'x')], int]"; expected "Callable[[Never], int]" [arg-type]
1812
dataclasses_transform_converter.py:104: error: Incompatible callable argument with type vars [arg-type]
19-
dataclasses_transform_converter.py:107: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
20-
dataclasses_transform_converter.py:107: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
21-
dataclasses_transform_converter.py:107: error: Argument 4 to "DC2" has incompatible type "bytes"; expected "ConverterClass" [arg-type]
22-
dataclasses_transform_converter.py:107: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]
23-
dataclasses_transform_converter.py:108: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
24-
dataclasses_transform_converter.py:108: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
25-
dataclasses_transform_converter.py:108: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
26-
dataclasses_transform_converter.py:108: error: Argument 4 to "DC2" has incompatible type "int"; expected "ConverterClass" [arg-type]
27-
dataclasses_transform_converter.py:108: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]
28-
dataclasses_transform_converter.py:109: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
29-
dataclasses_transform_converter.py:109: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
30-
dataclasses_transform_converter.py:109: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
31-
dataclasses_transform_converter.py:109: error: Argument 4 to "DC2" has incompatible type "str"; expected "ConverterClass" [arg-type]
32-
dataclasses_transform_converter.py:109: error: Argument 5 to "DC2" has incompatible type "complex"; expected "int" [arg-type]
33-
dataclasses_transform_converter.py:112: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
34-
dataclasses_transform_converter.py:112: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
35-
dataclasses_transform_converter.py:112: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
36-
dataclasses_transform_converter.py:112: error: Argument 4 to "DC2" has incompatible type "bytes"; expected "ConverterClass" [arg-type]
37-
dataclasses_transform_converter.py:112: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]
38-
dataclasses_transform_converter.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
39-
dataclasses_transform_converter.py:115: error: Incompatible types in assignment (expression has type "str", variable has type "ConverterClass") [assignment]
40-
dataclasses_transform_converter.py:116: error: Incompatible types in assignment (expression has type "bytes", variable has type "ConverterClass") [assignment]
41-
dataclasses_transform_converter.py:119: error: Incompatible types in assignment (expression has type "int", variable has type "ConverterClass") [assignment]
42-
dataclasses_transform_converter.py:121: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
43-
dataclasses_transform_converter.py:121: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
44-
dataclasses_transform_converter.py:121: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
45-
dataclasses_transform_converter.py:121: error: Argument 4 to "DC2" has incompatible type "str"; expected "ConverterClass" [arg-type]
46-
dataclasses_transform_converter.py:121: error: Argument 5 to "DC2" has incompatible type "str"; expected "int" [arg-type]
47-
dataclasses_transform_converter.py:121: error: Argument 6 to "DC2" has incompatible type "tuple[tuple[str, str], tuple[str, str]]"; expected "dict[str, str]" [arg-type]
13+
dataclasses_transform_converter.py:107: error: Argument 1 to "DC2" has incompatible type "int"; expected "str" [arg-type]
14+
dataclasses_transform_converter.py:108: error: Argument 4 to "DC2" has incompatible type "int"; expected "str | bytes" [arg-type]
15+
dataclasses_transform_converter.py:109: error: Argument 5 to "DC2" has incompatible type "complex"; expected "str | list[str]" [arg-type]
16+
dataclasses_transform_converter.py:118: error: Incompatible types in assignment of a dataclass converter (expression has type "int", expected type "str") [assignment]
17+
dataclasses_transform_converter.py:119: error: Incompatible types in assignment of a dataclass converter (expression has type "int", expected type "str | bytes") [assignment]
4818
dataclasses_transform_converter.py:130: error: Argument "default" to "model_field" has incompatible type "int"; expected "str | None" [arg-type]
4919
dataclasses_transform_converter.py:133: error: Argument "default_factory" to "model_field" has incompatible type "Type[int]"; expected "Callable[[], str] | None" [arg-type]
5020
"""

0 commit comments

Comments
 (0)