Skip to content

Commit 74d57b3

Browse files
committed
conformance: remove incorrect error from Literal test
1 parent 9ba065d commit 74d57b3

6 files changed

Lines changed: 49 additions & 55 deletions

File tree

‎conformance/results/mypy/literals_parameterizations.toml‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ literals_parameterizations.py:42: error: Invalid type: Literal[...] cannot conta
88
literals_parameterizations.py:43: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
99
literals_parameterizations.py:44: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
1010
literals_parameterizations.py:45: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
11+
literals_parameterizations.py:46: error: Parameter 1 of Literal[...] is invalid [valid-type]
1112
literals_parameterizations.py:47: error: Parameter 1 of Literal[...] is invalid [valid-type]
1213
literals_parameterizations.py:48: error: Parameter 1 of Literal[...] is invalid [valid-type]
1314
literals_parameterizations.py:49: error: Parameter 1 of Literal[...] is invalid [valid-type]
14-
literals_parameterizations.py:50: error: Parameter 1 of Literal[...] is invalid [valid-type]
15-
literals_parameterizations.py:51: error: Parameter 1 of Literal[...] cannot be of type "float" [valid-type]
16-
literals_parameterizations.py:52: error: Parameter 1 of Literal[...] cannot be of type "Any" [valid-type]
17-
literals_parameterizations.py:53: error: Parameter 1 of Literal[...] is invalid [valid-type]
18-
literals_parameterizations.py:56: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
19-
literals_parameterizations.py:60: error: Literal[...] must have at least one parameter [valid-type]
20-
literals_parameterizations.py:61: error: Parameter 1 of Literal[...] is invalid [valid-type]
21-
literals_parameterizations.py:65: error: Incompatible types in assignment (expression has type "Literal[Color.RED]", variable has type "Literal['Color.RED']") [assignment]
15+
literals_parameterizations.py:50: error: Parameter 1 of Literal[...] cannot be of type "float" [valid-type]
16+
literals_parameterizations.py:51: error: Parameter 1 of Literal[...] cannot be of type "Any" [valid-type]
17+
literals_parameterizations.py:52: error: Parameter 1 of Literal[...] is invalid [valid-type]
18+
literals_parameterizations.py:55: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
19+
literals_parameterizations.py:59: error: Literal[...] must have at least one parameter [valid-type]
20+
literals_parameterizations.py:60: error: Parameter 1 of Literal[...] is invalid [valid-type]
21+
literals_parameterizations.py:64: error: Incompatible types in assignment (expression has type "Literal[Color.RED]", variable has type "Literal['Color.RED']") [assignment]
2222
"""
23-
conformance_automated = "Fail"
23+
conformance_automated = "Pass"
2424
errors_diff = """
25-
Line 46: Expected 1 errors
2625
"""

‎conformance/results/pyrefly/literals_parameterizations.toml‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ ERROR literals_parameterizations.py:42:15-38: Invalid literal expression [invali
88
ERROR literals_parameterizations.py:43:15-21: Invalid literal expression [invalid-literal]
99
ERROR literals_parameterizations.py:44:15-17: Invalid literal expression [invalid-literal]
1010
ERROR literals_parameterizations.py:45:15-24: Invalid literal expression [invalid-literal]
11-
ERROR literals_parameterizations.py:46:7-33: `Literal` arguments cannot be parenthesized [invalid-literal]
12-
ERROR literals_parameterizations.py:47:15-35: Invalid literal expression [invalid-literal]
13-
ERROR literals_parameterizations.py:48:15-18: Invalid type inside literal, `int` [invalid-literal]
14-
ERROR literals_parameterizations.py:49:15-23: Expected a type form, got instance of `Literal[3]` [not-a-type]
15-
ERROR literals_parameterizations.py:50:16-17: Invalid type inside literal, `TypeVar[T]` [invalid-literal]
16-
ERROR literals_parameterizations.py:51:16-20: Invalid literal expression [invalid-literal]
17-
ERROR literals_parameterizations.py:52:16-19: Invalid type inside literal, `Any` [invalid-literal]
18-
ERROR literals_parameterizations.py:53:16-19: Invalid literal expression [invalid-literal]
19-
ERROR literals_parameterizations.py:56:28-33: Invalid literal expression [invalid-literal]
20-
ERROR literals_parameterizations.py:60:4-11: Expected a type argument for `Literal` [invalid-annotation]
21-
ERROR literals_parameterizations.py:61:12-23: Expected a type form, got instance of `(x: Unknown) -> int` [not-a-type]
22-
ERROR literals_parameterizations.py:65:32-33: `Literal[Color.RED]` is not assignable to `Literal['Color.RED']` [bad-assignment]
11+
ERROR literals_parameterizations.py:46:15-35: Invalid literal expression [invalid-literal]
12+
ERROR literals_parameterizations.py:47:15-18: Invalid type inside literal, `int` [invalid-literal]
13+
ERROR literals_parameterizations.py:48:15-23: Expected a type form, got instance of `Literal[3]` [not-a-type]
14+
ERROR literals_parameterizations.py:49:15-16: Invalid type inside literal, `TypeVar[T]` [invalid-literal]
15+
ERROR literals_parameterizations.py:50:16-20: Invalid literal expression [invalid-literal]
16+
ERROR literals_parameterizations.py:51:16-19: Invalid type inside literal, `Any` [invalid-literal]
17+
ERROR literals_parameterizations.py:52:16-19: Invalid literal expression [invalid-literal]
18+
ERROR literals_parameterizations.py:55:28-33: Invalid literal expression [invalid-literal]
19+
ERROR literals_parameterizations.py:59:4-11: Expected a type argument for `Literal` [invalid-annotation]
20+
ERROR literals_parameterizations.py:60:12-23: Expected a type form, got instance of `(x: Unknown) -> int` [not-a-type]
21+
ERROR literals_parameterizations.py:64:32-33: `Literal[Color.RED]` is not assignable to `Literal['Color.RED']` [bad-assignment]
2322
"""

‎conformance/results/pyright/literals_parameterizations.toml‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@ literals_parameterizations.py:45:15 - error: Unary operator not allowed in type
1212
literals_parameterizations.py:45:15 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
1313
literals_parameterizations.py:46:15 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
1414
literals_parameterizations.py:47:15 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
15+
literals_parameterizations.py:48:15 - error: Variable not allowed in type expression (reportInvalidTypeForm)
1516
literals_parameterizations.py:48:15 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
16-
literals_parameterizations.py:49:15 - error: Variable not allowed in type expression (reportInvalidTypeForm)
1717
literals_parameterizations.py:49:15 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
1818
literals_parameterizations.py:50:16 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
1919
literals_parameterizations.py:51:16 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
20+
literals_parameterizations.py:52:16 - error: "..." is not allowed in this context (reportInvalidTypeForm)
2021
literals_parameterizations.py:52:16 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
21-
literals_parameterizations.py:53:16 - error: "..." is not allowed in this context (reportInvalidTypeForm)
22-
literals_parameterizations.py:53:16 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
23-
literals_parameterizations.py:56:28 - error: Binary operator not allowed in type expression (reportInvalidTypeForm)
24-
literals_parameterizations.py:56:28 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
25-
literals_parameterizations.py:60:4 - error: "Literal" cannot be used in this context without a type argument (reportInvalidTypeForm)
26-
literals_parameterizations.py:61:12 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
27-
literals_parameterizations.py:65:32 - error: Type "Literal[Color.RED]" is not assignable to declared type "Literal['Color.RED']"
22+
literals_parameterizations.py:55:28 - error: Binary operator not allowed in type expression (reportInvalidTypeForm)
23+
literals_parameterizations.py:55:28 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
24+
literals_parameterizations.py:59:4 - error: "Literal" cannot be used in this context without a type argument (reportInvalidTypeForm)
25+
literals_parameterizations.py:60:12 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
26+
literals_parameterizations.py:64:32 - error: Type "Literal[Color.RED]" is not assignable to declared type "Literal['Color.RED']"
2827
  "Literal[Color.RED]" is not assignable to "Literal['Color.RED']" (reportAssignmentType)
2928
"""
3029
conformance_automated = "Pass"

‎conformance/results/ty/literals_parameterizations.toml‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ literals_parameterizations.py:49:15: error[invalid-type-form] Type arguments for
1414
literals_parameterizations.py:50:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
1515
literals_parameterizations.py:51:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
1616
literals_parameterizations.py:52:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
17-
literals_parameterizations.py:53:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
18-
literals_parameterizations.py:56:28: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
19-
literals_parameterizations.py:60:4: error[invalid-type-form] `typing.Literal` requires at least one argument when used in a type expression
20-
literals_parameterizations.py:61:12: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
21-
literals_parameterizations.py:65:32: error[invalid-assignment] Object of type `Literal[Color.RED]` is not assignable to `Literal["Color.RED"]`
17+
literals_parameterizations.py:55:28: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
18+
literals_parameterizations.py:59:4: error[invalid-type-form] `typing.Literal` requires at least one argument when used in a type expression
19+
literals_parameterizations.py:60:12: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member
20+
literals_parameterizations.py:64:32: error[invalid-assignment] Object of type `Literal[Color.RED]` is not assignable to `Literal["Color.RED"]`
2221
"""

‎conformance/results/zuban/literals_parameterizations.toml‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ literals_parameterizations.py:43: error: Invalid type: Literal[...] cannot conta
88
literals_parameterizations.py:44: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
99
literals_parameterizations.py:45: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
1010
literals_parameterizations.py:46: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
11-
literals_parameterizations.py:47: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
11+
literals_parameterizations.py:47: error: Parameter 1 of Literal[...] is invalid [valid-type]
1212
literals_parameterizations.py:48: error: Parameter 1 of Literal[...] is invalid [valid-type]
13-
literals_parameterizations.py:49: error: Parameter 1 of Literal[...] is invalid [valid-type]
14-
literals_parameterizations.py:50: error: Type variable "literals_parameterizations.T" is unbound [misc]
15-
literals_parameterizations.py:50: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
16-
literals_parameterizations.py:50: note: (Hint: Use "T" in function signature to bind "T" inside a function)
17-
literals_parameterizations.py:51: error: Parameter 1 of Literal[...] cannot be of type "float" [valid-type]
18-
literals_parameterizations.py:52: error: Parameter 1 of Literal[...] cannot be of type "Any" [valid-type]
19-
literals_parameterizations.py:53: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
20-
literals_parameterizations.py:56: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
21-
literals_parameterizations.py:60: error: Literal[...] must have at least one parameter [valid-type]
22-
literals_parameterizations.py:61: error: Parameter 1 of Literal[...] is invalid [valid-type]
23-
literals_parameterizations.py:65: error: Incompatible types in assignment (expression has type "Literal[Color.RED]", variable has type "Literal['Color.RED']") [assignment]
13+
literals_parameterizations.py:49: error: Type variable "literals_parameterizations.T" is unbound [misc]
14+
literals_parameterizations.py:49: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
15+
literals_parameterizations.py:49: note: (Hint: Use "T" in function signature to bind "T" inside a function)
16+
literals_parameterizations.py:50: error: Parameter 1 of Literal[...] cannot be of type "float" [valid-type]
17+
literals_parameterizations.py:51: error: Parameter 1 of Literal[...] cannot be of type "Any" [valid-type]
18+
literals_parameterizations.py:52: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
19+
literals_parameterizations.py:55: error: Invalid type: Literal[...] cannot contain arbitrary expressions [valid-type]
20+
literals_parameterizations.py:59: error: Literal[...] must have at least one parameter [valid-type]
21+
literals_parameterizations.py:60: error: Parameter 1 of Literal[...] is invalid [valid-type]
22+
literals_parameterizations.py:64: error: Incompatible types in assignment (expression has type "Literal[Color.RED]", variable has type "Literal['Color.RED']") [assignment]
2423
"""

‎conformance/tests/literals_parameterizations.py‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@ class Color(Enum):
4343
bad3: Literal[4 + 3j] # E
4444
bad4: Literal[~5] # E
4545
bad5: Literal[not False] # E
46-
bad6: Literal[(1, "foo", "bar")] # E
47-
bad7: Literal[{"a": "b", "c": "d"}] # E
48-
bad8: Literal[int] # E
49-
bad9: Literal[variable] # E
50-
bad10: Literal[T] # E
51-
bad11: Literal[3.14] # E
52-
bad12: Literal[Any] # E
53-
bad13: Literal[...] # E
46+
bad6: Literal[{"a": "b", "c": "d"}] # E
47+
bad7: Literal[int] # E
48+
bad8: Literal[variable] # E
49+
bad9: Literal[T] # E
50+
bad10: Literal[3.14] # E
51+
bad11: Literal[Any] # E
52+
bad12: Literal[...] # E
5453

5554

5655
def my_function(x: Literal[1 + 2]) -> int: # E

0 commit comments

Comments
 (0)