diff --git a/conformance/results/mypy/literals_literalstring.toml b/conformance/results/mypy/literals_literalstring.toml index 1bde97a4d..dc1470fc2 100644 --- a/conformance/results/mypy/literals_literalstring.toml +++ b/conformance/results/mypy/literals_literalstring.toml @@ -9,14 +9,14 @@ literals_literalstring.py:43: error: Incompatible types in assignment (expressio literals_literalstring.py:73: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment] literals_literalstring.py:74: error: Incompatible types in assignment (expression has type "bytes", variable has type "str") [assignment] literals_literalstring.py:156: error: Overloaded function signature 3 will never be matched: signature 2's parameter type(s) are the same or broader [overload-cannot-match] -literals_literalstring.py:166: error: Expression is of type "B", not "A" [assert-type] +literals_literalstring.py:167: error: Expression is of type "B", not "A" [assert-type] """ conformance_automated = "Fail" errors_diff = """ Line 65: Expected 1 errors Line 119: Expected 1 errors Line 133: Expected 1 errors -Line 170: Expected 1 errors +Line 171: Expected 1 errors Line 156: Unexpected errors ["literals_literalstring.py:156: error: Overloaded function signature 3 will never be matched: signature 2's parameter type(s) are the same or broader [overload-cannot-match]"] -Line 166: Unexpected errors ['literals_literalstring.py:166: error: Expression is of type "B", not "A" [assert-type]'] +Line 167: Unexpected errors ['literals_literalstring.py:167: error: Expression is of type "B", not "A" [assert-type]'] """ diff --git a/conformance/results/pyrefly/literals_literalstring.toml b/conformance/results/pyrefly/literals_literalstring.toml index fd23249c2..f88425491 100644 --- a/conformance/results/pyrefly/literals_literalstring.toml +++ b/conformance/results/pyrefly/literals_literalstring.toml @@ -11,5 +11,5 @@ ERROR literals_literalstring.py:73:25-26: `Literal[3]` is not assignable to `Lit ERROR literals_literalstring.py:74:25-32: `Literal[b'test']` is not assignable to `LiteralString` [bad-assignment] ERROR literals_literalstring.py:119:21-24: `str` is not assignable to upper bound `LiteralString` of type variable `TLiteral` [bad-specialization] ERROR literals_literalstring.py:133:51-52: Argument `str` is not assignable to parameter `value` with type `LiteralString` in function `Container.__init__` [bad-argument-type] -ERROR literals_literalstring.py:170:21-24: `list[LiteralString]` is not assignable to `list[str]` [bad-assignment] +ERROR literals_literalstring.py:171:21-24: `list[LiteralString]` is not assignable to `list[str]` [bad-assignment] """ diff --git a/conformance/results/pyright/literals_literalstring.toml b/conformance/results/pyright/literals_literalstring.toml index e91750ea7..c917941ac 100644 --- a/conformance/results/pyright/literals_literalstring.toml +++ b/conformance/results/pyright/literals_literalstring.toml @@ -16,7 +16,7 @@ literals_literalstring.py:119:22 - error: Argument of type "str" cannot be assig literals_literalstring.py:133:51 - error: Argument of type "str" cannot be assigned to parameter "value" of type "T@Container" in function "__init__"   Type "str" is not assignable to type "LiteralString"     "str" is not assignable to "LiteralString" (reportArgumentType) -literals_literalstring.py:170:21 - error: Type "list[LiteralString]" is not assignable to declared type "list[str]" +literals_literalstring.py:171:21 - error: Type "list[LiteralString]" is not assignable to declared type "list[str]"   "list[LiteralString]" is not assignable to "list[str]"     Type parameter "_T@list" is invariant, but "LiteralString" is not the same as "str"     Consider switching from "list" to "Sequence" which is covariant (reportAssignmentType) diff --git a/conformance/results/ty/literals_literalstring.toml b/conformance/results/ty/literals_literalstring.toml index 052d2d4c3..e3dec3612 100644 --- a/conformance/results/ty/literals_literalstring.toml +++ b/conformance/results/ty/literals_literalstring.toml @@ -11,5 +11,5 @@ literals_literalstring.py:74:25: error[invalid-assignment] Object of type `Liter literals_literalstring.py:119:22: error[invalid-argument-type] Argument to function `literal_identity` is incorrect: Argument type `str` does not satisfy upper bound `LiteralString` of type variable `TLiteral` literals_literalstring.py:133:51: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Argument type `str` does not satisfy upper bound `LiteralString` of type variable `T` literals_literalstring.py:133:51: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `LiteralString`, found `str` -literals_literalstring.py:170:21: error[invalid-assignment] Object of type `list[LiteralString]` is not assignable to `list[str]` +literals_literalstring.py:171:21: error[invalid-assignment] Object of type `list[LiteralString]` is not assignable to `list[str]` """ diff --git a/conformance/results/zuban/literals_literalstring.toml b/conformance/results/zuban/literals_literalstring.toml index e29e362f4..6db478d33 100644 --- a/conformance/results/zuban/literals_literalstring.toml +++ b/conformance/results/zuban/literals_literalstring.toml @@ -10,7 +10,7 @@ literals_literalstring.py:73: error: Incompatible types in assignment (expressio literals_literalstring.py:74: error: Incompatible types in assignment (expression has type "Literal[b'test']", variable has type "LiteralString") [assignment] literals_literalstring.py:119: error: Value of type variable "TLiteral" of "literal_identity" cannot be "str" [type-var] literals_literalstring.py:133: error: Value of type variable "T" of "Container" cannot be "str" [type-var] -literals_literalstring.py:170: error: Incompatible types in assignment (expression has type "list[LiteralString]", variable has type "list[str]") [assignment] -literals_literalstring.py:170: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance -literals_literalstring.py:170: note: Consider using "Sequence" instead, which is covariant +literals_literalstring.py:171: error: Incompatible types in assignment (expression has type "list[LiteralString]", variable has type "list[str]") [assignment] +literals_literalstring.py:171: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance +literals_literalstring.py:171: note: Consider using "Sequence" instead, which is covariant """ diff --git a/conformance/tests/literals_literalstring.py b/conformance/tests/literals_literalstring.py index e299fa43d..798c6c7a6 100644 --- a/conformance/tests/literals_literalstring.py +++ b/conformance/tests/literals_literalstring.py @@ -161,9 +161,10 @@ def func8(x: Any) -> Any: raise NotImplementedError -assert_type(func8("foo"), C) # First overload -assert_type(func8("bar"), B) # Second overload -assert_type(func8(input()), A) # Third overload +def call_func8(x: str) -> None: + assert_type(func8("foo"), C) # First overload + assert_type(func8("bar"), B) # Second overload + assert_type(func8(x), A) # Third overload def func9(val: list[LiteralString]):