Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update conformance test sources to allow some errors in additional positions #1807

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions conformance/results/mypy/generics_variance.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ generics_variance.py:131: error: Variance of TypeVar "T_contra" incompatible wit
conformance_automated = "Fail"
errors_diff = """
Line 113: Expected 1 errors
Line 126: Expected 1 errors
Line 132: Expected 1 errors
Line 142: Expected 1 errors
Line 163: Expected 1 errors
Line 167: Expected 1 errors
Line 191: Expected 1 errors
Line 196: Expected 1 errors
Line 125: Unexpected errors ['generics_variance.py:125: error: Variance of TypeVar "T_co" incompatible with variance in parent type [type-var]']
Line 131: Unexpected errors ['generics_variance.py:131: error: Variance of TypeVar "T_contra" incompatible with variance in parent type [type-var]']
Lines 141, 142: Expected error (tag 'CoContra_Child5')
Lines 195, 196: Expected error (tag 'ContraToContraToContra_WithTA')
"""
2 changes: 1 addition & 1 deletion conformance/results/mypy/tuples_unpacked.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ errors_diff = """
Line 40: Expected 1 errors
Line 41: Expected 1 errors
Line 51: Expected 1 errors
Line 61: Expected 1 errors
Lines 60, 61: Expected error (tag 't14')
"""
8 changes: 2 additions & 6 deletions conformance/results/pyre/generics_variance.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ conformance_automated = "Fail"
errors_diff = """
Line 14: Expected 1 errors
Line 113: Expected 1 errors
Line 126: Expected 1 errors
Line 132: Expected 1 errors
Line 142: Expected 1 errors
Line 163: Expected 1 errors
Line 167: Expected 1 errors
Line 191: Expected 1 errors
Line 196: Expected 1 errors
Line 125: Unexpected errors ['generics_variance.py:125:0 Invalid type variance [46]: The type variable `Variable[T_co](covariant)` is incompatible with parent class type variable `Variable[T_contra](contravariant)` because subclasses cannot use more permissive type variables than their superclasses.']
Line 131: Unexpected errors ['generics_variance.py:131:0 Invalid type variance [46]: The type variable `Variable[T_contra](contravariant)` is incompatible with parent class type variable `Variable[T_co](covariant)` because subclasses cannot use more permissive type variables than their superclasses.']
Lines 141, 142: Expected error (tag 'CoContra_Child5')
Lines 195, 196: Expected error (tag 'ContraToContraToContra_WithTA')
"""
2 changes: 0 additions & 2 deletions conformance/results/pyre/tuples_unpacked.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ tuples_unpacked.py:60:5 Invalid type [31]: Expression `tuple[(typing.Unpack[tupl
"""
conformance_automated = "Fail"
errors_diff = """
Line 61: Expected 1 errors
Line 16: Unexpected errors ['tuples_unpacked.py:16:13 Invalid type [31]: Expression `tuple[(int, *tuple[(bool, bool)], str)]` is not a valid type.']
Line 18: Unexpected errors ['tuples_unpacked.py:18:19 Invalid type [31]: Expression `tuple[(*tuple[(int, bool)], bool, str)]` is not a valid type.']
Line 19: Unexpected errors ['tuples_unpacked.py:19:19 Invalid type [31]: Expression `tuple[(int, bool, *tuple[(bool, str)])]` is not a valid type.']
Expand All @@ -32,5 +31,4 @@ Line 38: Unexpected errors ['tuples_unpacked.py:38:4 Invalid type [31]: Expressi
Line 39: Unexpected errors ['tuples_unpacked.py:39:4 Invalid type [31]: Expression `tuple[(*tuple[(str, *tuple[(str, ...)])])]` is not a valid type.']
Line 49: Unexpected errors ['tuples_unpacked.py:49:13 Invalid type [31]: Expression `tuple[(*Ts)]` is not a valid type.']
Line 50: Unexpected errors ['tuples_unpacked.py:50:8 Invalid type [31]: Expression `tuple[(*tuple[str], *Ts)]` is not a valid type.']
Line 60: Unexpected errors ['tuples_unpacked.py:60:5 Invalid type [31]: Expression `tuple[(typing.Unpack[tuple[(str, typing.Unpack[tuple[(str, ...)]])]], typing.Unpack[tuple[(int, ...)]])]` is not a valid type.']
"""
2 changes: 1 addition & 1 deletion conformance/results/pyre/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "pyre 0.9.22"
test_duration = 1.7
test_duration = 1.6
8 changes: 4 additions & 4 deletions conformance/results/pytype/generics_variance.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Line 81: Expected 1 errors
Line 93: Expected 1 errors
Line 105: Expected 1 errors
Line 113: Expected 1 errors
Line 126: Expected 1 errors
Line 132: Expected 1 errors
Line 142: Expected 1 errors
Line 163: Expected 1 errors
Line 167: Expected 1 errors
Line 191: Expected 1 errors
Line 196: Expected 1 errors
Lines 125, 126: Expected error (tag 'CoContra_Child2')
Lines 131, 132: Expected error (tag 'CoContra_Child3')
Lines 141, 142: Expected error (tag 'CoContra_Child5')
Lines 195, 196: Expected error (tag 'ContraToContraToContra_WithTA')
Line 18: Unexpected errors ['File "generics_variance.py", line 18, in <module>: argument "covariant" to TypeVar not supported yet [not-supported-yet]']
Line 19: Unexpected errors ['File "generics_variance.py", line 19, in <module>: argument "contravariant" to TypeVar not supported yet [not-supported-yet]']
Line 27: Unexpected errors ['File "generics_variance.py", line 27, in __iter__: bad return type [bad-return-type]']
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/pytype/tuples_unpacked.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ File "tuples_unpacked.py", line 51, in func3: Invalid type annotation 'tuple[*tu
conformance_automated = "Fail"
errors_diff = """
Line 59: Expected 1 errors
Line 61: Expected 1 errors
Lines 60, 61: Expected error (tag 't14')
Line 13: Unexpected errors ['File "tuples_unpacked.py", line 13, in <module>: typing.Unpack not supported yet [not-supported-yet]', 'File "tuples_unpacked.py", line 13, in <module>: typing.TypeVarTuple not supported yet [not-supported-yet]']
Line 16: Unexpected errors ['File "tuples_unpacked.py", line 16, in <module>: Invalid type annotation \\'<instance of tuple>\\' [invalid-annotation]']
Line 17: Unexpected errors ['File "tuples_unpacked.py", line 17, in func1: Tuple[Any] [assert-type]']
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/pytype/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "pytype 2024.04.11"
test_duration = 34.2
test_duration = 34.0
4 changes: 2 additions & 2 deletions conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ <h3>Python Type System Conformance Test Results</h3>
<div class='tc-time'>1.5sec</div>
</th>
<th class='tc-header'><div class='tc-name'>pyre 0.9.22</div>
<div class='tc-time'>1.7sec</div>
<div class='tc-time'>1.6sec</div>
</th>
<th class='tc-header'><div class='tc-name'>pytype 2024.04.11</div>
<div class='tc-time'>34.2sec</div>
<div class='tc-time'>34.0sec</div>
</th>
</tr>
<tr><th class="column" colspan="5">
Expand Down
16 changes: 8 additions & 8 deletions conformance/tests/generics_variance.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ class CoContra_Child1(CoContra[T_co, T_contra]): # OK
...


class CoContra_Child2(
CoContra[T_co, T_co] # E: Second type arg must be contravariant
class CoContra_Child2( # E[CoContra_Child2]: Second type arg must be contravariant
CoContra[T_co, T_co] # E[CoContra_Child2]: Second type arg must be contravariant
):
...


class CoContra_Child3(
CoContra[T_contra, T_contra] # E: First type arg must be covariant
class CoContra_Child3( # E[CoContra_Child3]: First type arg must be covariant
CoContra[T_contra, T_contra] # E[CoContra_Child3]: First type arg must be covariant
):
...

Expand All @@ -138,8 +138,8 @@ class CoContra_Child4(CoContra[T, T]): # OK
...


class CoContra_Child5(
CoContra[Co[T_co], Co[T_co]] # E: Second type arg must be contravariant
class CoContra_Child5( # E[CoContra_Child5]: Second type arg must be contravariant
CoContra[Co[T_co], Co[T_co]] # E[CoContra_Child5]: Second type arg must be contravariant
):
...

Expand Down Expand Up @@ -192,7 +192,7 @@ class CoToContraToContra_WithTA(Contra_TA[Co_TA[Contra_TA[T_contra]]]): # E
...


class ContraToContraToContra_WithTA(
Contra_TA[Contra_TA[Contra_TA[T_co]]] # E
class ContraToContraToContra_WithTA( # E[ContraToContraToContra_WithTA]
Contra_TA[Contra_TA[Contra_TA[T_co]]] # E[ContraToContraToContra_WithTA]
):
...
4 changes: 2 additions & 2 deletions conformance/tests/tuples_unpacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ def func3(t: tuple[*Ts]):
t11: tuple[Unpack[tuple[str]], Unpack[tuple[str]]] # OK
t12: tuple[Unpack[tuple[str, Unpack[tuple[str, ...]]]]] # OK
t13: tuple[Unpack[tuple[str, ...]], Unpack[tuple[int, ...]]] # E
t14: tuple[
Unpack[tuple[str, Unpack[tuple[str, ...]]]], Unpack[tuple[int, ...]] # E
t14: tuple[ # E[t14]
Unpack[tuple[str, Unpack[tuple[str, ...]]]], Unpack[tuple[int, ...]] # E[t14]
]