Skip to content
Open
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
2 changes: 1 addition & 1 deletion conformance/results/pyrefly/aliases_explicit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ errors_diff = """
"""
output = """
ERROR aliases_explicit.py:67:9-28: `TypeAlias[GoodTypeAlias2, type[int | None]]` is not subscriptable [unsupported-operation]
ERROR aliases_explicit.py:68:9-28: `TypeAlias[GoodTypeAlias3, type[list[GoodTypeAlias2]]]` is not subscriptable [unsupported-operation]
ERROR aliases_explicit.py:68:9-28: `TypeAlias[GoodTypeAlias3, type[list[int | None]]]` is not subscriptable [unsupported-operation]
ERROR aliases_explicit.py:69:9-33: Expected 1 type argument for `GoodTypeAlias4`, got 2 [bad-specialization]
ERROR aliases_explicit.py:70:9-33: Expected 1 type argument for `GoodTypeAlias8`, got 2 [bad-specialization]
ERROR aliases_explicit.py:71:9-33: Expected a valid ParamSpec expression, got `int` [invalid-param-spec]
Expand Down
1 change: 1 addition & 0 deletions conformance/results/pyrefly/aliases_recursive.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ ERROR aliases_recursive.py:63:30-43: `list[list[float] | str | GenericTypeAlias1
ERROR aliases_recursive.py:69:35-64: `list[int | list[int | list[int | list[float] | str | GenericTypeAlias2[str, int]] | str | GenericTypeAlias2[str, int]] | str | GenericTypeAlias2[str, int]]` is not assignable to `list[int | str | GenericTypeAlias2[str, int]]` [bad-assignment]
ERROR aliases_recursive.py:72:29-57: Found cyclic self-reference in `RecursiveUnion` [invalid-type-alias]
ERROR aliases_recursive.py:75:31-61: Found cyclic self-reference in `MutualReference1` [invalid-type-alias]
ERROR aliases_recursive.py:75:93-123: Found cyclic self-reference in `MutualReference2` [invalid-type-alias]
"""
1 change: 1 addition & 0 deletions conformance/results/pyrefly/aliases_type_statement.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ ERROR aliases_type_statement.py:77:7-41: `str` is not assignable to upper bound
ERROR aliases_type_statement.py:79:7-41: `int` is not assignable to upper bound `str` of type variable `T` [bad-specialization]
ERROR aliases_type_statement.py:82:28-47: Found cyclic self-reference in `RecursiveTypeAlias3` [invalid-type-alias]
ERROR aliases_type_statement.py:84:31-59: Found cyclic self-reference in `RecursiveTypeAlias4` [invalid-type-alias]
ERROR aliases_type_statement.py:88:28-47: Found cyclic self-reference in `RecursiveTypeAlias6` [invalid-type-alias]
ERROR aliases_type_statement.py:89:28-47: Found cyclic self-reference in `RecursiveTypeAlias7` [invalid-type-alias]
"""
16 changes: 6 additions & 10 deletions conformance/results/pyrefly/aliases_typealiastype.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
conformant = "Partial"
notes = """
Does not detect circular definitions.
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 48: Expected 1 errors
Line 66: Expected 1 errors
"""
output = """
ERROR aliases_typealiastype.py:32:7-30: Object of class `TypeAliasType` has no attribute `other_attrib` [missing-attribute]
ERROR aliases_typealiastype.py:40:5-30: `int` is not assignable to upper bound `str` of type variable `TStr` [bad-specialization]
ERROR aliases_typealiastype.py:43:13-66: Type variable `S` is out of scope for this `TypeAliasType` [invalid-type-alias]
ERROR aliases_typealiastype.py:44:13-48: Type variable `S` is out of scope for this `TypeAliasType` [invalid-type-alias]
ERROR aliases_typealiastype.py:45:45-65: Value for argument `type_params` must be a tuple literal [invalid-type-alias]
ERROR aliases_typealiastype.py:46:41-50: Found cyclic self-reference in `BadAlias4` [invalid-type-alias]
ERROR aliases_typealiastype.py:47:40-60: Found cyclic self-reference in `BadAlias5` [invalid-type-alias]
ERROR aliases_typealiastype.py:49:40-49: Found cyclic self-reference in `BadAlias7` [invalid-type-alias]
ERROR aliases_typealiastype.py:46:13-52: Found cyclic self-reference in `BadAlias4` [invalid-type-alias]
ERROR aliases_typealiastype.py:47:13-79: Found cyclic self-reference in `BadAlias5` [invalid-type-alias]
ERROR aliases_typealiastype.py:48:13-52: Found cyclic self-reference in `BadAlias6` [invalid-type-alias]
ERROR aliases_typealiastype.py:49:13-50: Found cyclic self-reference in `BadAlias7` [invalid-type-alias]
ERROR aliases_typealiastype.py:52:40-80: Function call cannot be used in annotations [invalid-annotation]
ERROR aliases_typealiastype.py:53:40-50: List literal cannot be used in annotations [invalid-annotation]
ERROR aliases_typealiastype.py:54:42-55: Tuple literal cannot be used in annotations [invalid-annotation]
Expand All @@ -31,4 +26,5 @@ ERROR aliases_typealiastype.py:61:42-46: Bool literal cannot be used in annotati
ERROR aliases_typealiastype.py:62:42-43: Number literal cannot be used in annotations [invalid-annotation]
ERROR aliases_typealiastype.py:63:42-53: Boolean operation cannot be used in annotations [invalid-annotation]
ERROR aliases_typealiastype.py:64:42-52: F-string cannot be used in annotations [invalid-annotation]
ERROR aliases_typealiastype.py:66:14-59: Found cyclic self-reference in `BadAlias21` [invalid-type-alias]
"""
8 changes: 4 additions & 4 deletions conformance/results/pyrefly/generics_scoping.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ Does not implement several scoping checks/restrictions for generics
"""
conformance_automated = "Fail"
errors_diff = """
Line 61: Expected 1 errors
Line 65: Expected 1 errors
Line 86: Expected 1 errors
Line 89: Expected 1 errors
Line 98: Expected 1 errors
Line 105: Expected 1 errors
Line 106: Expected 1 errors
Line 107: Expected 1 errors
"""
output = """
Expand All @@ -19,5 +15,9 @@ ERROR generics_scoping.py:20:12-38: assert_type(str, Literal['a']) failed [asser
ERROR generics_scoping.py:34:10-13: Argument `Literal['a']` is not assignable to parameter `x` with type `int` in function `MyClass.meth_2` [bad-argument-type]
ERROR generics_scoping.py:50:12-48: assert_type(str, Literal['abc']) failed [assert-type]
ERROR generics_scoping.py:54:12-50: assert_type(bytes, Literal[b'abc']) failed [assert-type]
ERROR generics_scoping.py:61:8-15: Type variable `S` is not in scope [invalid-type-var]
ERROR generics_scoping.py:65:14-21: Type variable `S` is not in scope [invalid-type-var]
ERROR generics_scoping.py:76:11-20: Redundant type parameter declaration [invalid-type-var]
ERROR generics_scoping.py:105:14-15: Type variable `T` is not in scope [invalid-type-var]
ERROR generics_scoping.py:106:14-21: Type variable `T` is not in scope [invalid-type-var]
"""
4 changes: 2 additions & 2 deletions conformance/results/pyrefly/generics_typevartuple_args.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ conformance_automated = "Pass"
errors_diff = """
"""
output = """
ERROR generics_typevartuple_args.py:33:8-19: Unpacked argument `tuple[Literal[0], Literal['']]` is not assignable to parameter `*args` with type `tuple[*@_, Env]` in function `exec_le` [bad-argument-type]
ERROR generics_typevartuple_args.py:34:8-30: Unpacked argument `tuple[Literal[0], Literal['']]` is not assignable to parameter `*args` with type `tuple[*@_, Env]` in function `exec_le` [bad-argument-type]
ERROR generics_typevartuple_args.py:33:12-23: Unpacked argument `tuple[Literal[0], Literal['']]` is not assignable to parameter `*args` with type `tuple[*@_, Env]` in function `exec_le` [bad-argument-type]
ERROR generics_typevartuple_args.py:34:12-34: Unpacked argument `tuple[Literal[0], Literal['']]` is not assignable to parameter `*args` with type `tuple[*@_, Env]` in function `exec_le` [bad-argument-type]
ERROR generics_typevartuple_args.py:48:6-17: Unpacked argument `tuple[Literal[1], Literal['2'], Literal[3]]` is not assignable to parameter `*args` with type `tuple[int, ...]` in function `func1` [bad-argument-type]
ERROR generics_typevartuple_args.py:57:6-16: Unpacked argument `tuple[Literal[1], Literal[1], Literal['']]` is not assignable to parameter `*args` with type `tuple[int, *tuple[str, ...], str]` in function `func2` [bad-argument-type]
ERROR generics_typevartuple_args.py:58:6-9: Unpacked argument `tuple[Literal[1]]` is not assignable to parameter `*args` with type `tuple[int, *tuple[str, ...], str]` in function `func2` [bad-argument-type]
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/pyrefly/version.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "pyrefly 0.53.0"
version = "pyrefly 0.54.0"
4 changes: 2 additions & 2 deletions conformance/results/pyright/generics_typevartuple_args.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
conformant = "Pass"
output = """
generics_typevartuple_args.py:33:16 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "Env" in function "exec_le"
generics_typevartuple_args.py:33:20 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "Env" in function "exec_le"
  "Literal['']" is not assignable to "Env" (reportArgumentType)
generics_typevartuple_args.py:34:16 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "Env" in function "exec_le"
generics_typevartuple_args.py:34:20 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "Env" in function "exec_le"
  "Literal['']" is not assignable to "Env" (reportArgumentType)
generics_typevartuple_args.py:48:10 - error: Argument of type "Literal['2']" cannot be assigned to parameter of type "int" in function "func1"
  "Literal['2']" is not assignable to "int" (reportArgumentType)
Expand Down
8 changes: 4 additions & 4 deletions conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ <h3>Python Type System Conformance Test Results</h3>
</th>
<th class='tc-header'><div class='tc-name'>pyright 1.1.408</div>
</th>
<th class='tc-header'><div class='tc-name'>zuban 0.6.0</div>
<th class='tc-header'><div class='tc-name'>zuban 0.6.1</div>
</th>
<th class='tc-header'><div class='tc-name'>pyrefly 0.53.0</div>
<th class='tc-header'><div class='tc-name'>pyrefly 0.54.0</div>
</th>
</tr>
<tr><th class="column" colspan="5">
Expand Down Expand Up @@ -307,7 +307,7 @@ <h3>Python Type System Conformance Test Results</h3>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_scoping</th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 partially-conformant">Partial</th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not implement several scoping checks/restrictions for generics</p></span></div></th>
</tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_self_advanced</th>
Expand Down Expand Up @@ -503,7 +503,7 @@ <h3>Python Type System Conformance Test Results</h3>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Incorrectly rejects some recursive type aliases using TypeAliasType.</p><p>Incorrectly rejects the use of a class-scoped TypeVar in a TypeAliasType definition.</p></span></div></th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not detect circular definitions.</p></span></div></th>
<th class="column col2 conformant">Pass</th>
</tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;aliases_variance</th>
<th class="column col2 conformant">Pass</th>
Expand Down
11 changes: 5 additions & 6 deletions conformance/results/zuban/generics_scoping.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
conformance_automated = "Fail"
conformant = "Partial"
conformance_automated = "Pass"
errors_diff = """
Lines 15, 16: Expected error (tag 'fun1')
Lines 19, 20: Expected error (tag 'fun2')
Lines 49, 50: Expected error (tag 'method-str')
Lines 53, 54: Expected error (tag 'method-bytes')
"""
output = """
generics_scoping.py:15: error: Expression is of type "Literal[1]", not "int" [misc]
generics_scoping.py:19: error: Expression is of type "Literal['a']", not "str" [misc]
generics_scoping.py:34: error: Argument 1 to "meth_2" of "MyClass" has incompatible type "str"; expected "int" [arg-type]
generics_scoping.py:49: error: Expression is of type "Literal['abc']", not "str" [misc]
generics_scoping.py:53: error: Expression is of type "Literal[b'abc']", not "bytes" [misc]
generics_scoping.py:61: error: Type variable "generics_scoping.S" is unbound [misc]
generics_scoping.py:61: note: (Hint: Use "Generic[S]" or "Protocol[S]" base class to bind "S" inside a class)
generics_scoping.py:61: note: (Hint: Use "S" in function signature to bind "S" inside a function)
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/zuban/version.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "zuban 0.6.0"
version = "zuban 0.6.1"
14 changes: 7 additions & 7 deletions conformance/tests/generics_typevartuple_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ def args_to_tuple(*args: *Ts) -> tuple[*Ts]:
raise NotImplementedError


assert_type(args_to_tuple(1, "a"), tuple[int, str])


class Env:
...

Expand All @@ -28,10 +25,13 @@ def exec_le(path: str, *args: * tuple[*Ts, Env], env: Env | None = None) -> tupl
raise NotImplementedError


assert_type(exec_le("", Env()), tuple[()]) # OK
assert_type(exec_le("", 0, "", Env()), tuple[int, str]) # OK
exec_le("", 0, "") # E
exec_le("", 0, "", env=Env()) # E
def has_int_and_str(x: int, y: str):
assert_type(args_to_tuple(x, y), tuple[int, str])

assert_type(exec_le("", Env()), tuple[()]) # OK
assert_type(exec_le(y, x, y, Env()), tuple[int, str]) # OK
exec_le("", 0, "") # E
exec_le("", 0, "", env=Env()) # E


# > Using an unpacked unbounded tuple is equivalent to the
Expand Down
3 changes: 2 additions & 1 deletion conformance/tests/generics_typevartuple_callable.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ def func3(*args: * tuple[int, *Ts, T]) -> tuple[T, *Ts]:
raise NotImplementedError


assert_type(func3(1, "", 3j, 3.4), tuple[float, str, complex])
def has_int_and_str(a: int, b: str, c: float, d: complex):
assert_type(func3(a, b, c, d), tuple[float, str, complex])