Skip to content

Commit

Permalink
Updated conformance results for pyright 1.1.362 (#1733)
Browse files Browse the repository at this point in the history
Updated conformance results for pyright 1.1.362, which fixed two non-conformance issues but introduced a regression in another conformance test.

Improved callables_annotation test to cover a few missing cases and make the test more resilient to differences in interpretation for `assert_type`.
  • Loading branch information
erictraut authored May 9, 2024
1 parent 6a787bf commit d8c80ac
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 100 deletions.
23 changes: 11 additions & 12 deletions conformance/results/mypy/callables_annotation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ callables_annotation.py:58: error: Please use "Callable[[<parameters>], <return
callables_annotation.py:59: error: Unexpected "..." [misc]
callables_annotation.py:91: error: Incompatible types in assignment (expression has type "Callable[[], str]", variable has type "Callable[[int, VarArg(Any), KwArg(Any)], str]") [assignment]
callables_annotation.py:93: error: Incompatible types in assignment (expression has type "Callable[[NamedArg(int, 'a')], str]", variable has type "Callable[[int, VarArg(Any), KwArg(Any)], str]") [assignment]
callables_annotation.py:136: error: Expression is of type "Proto3", not "Callable[..., None]" [assert-type]
callables_annotation.py:139: error: Incompatible types in assignment (expression has type "Proto7", variable has type "Proto6") [assignment]
callables_annotation.py:139: note: Following member(s) of "Proto7" have conflicts:
callables_annotation.py:139: note: Expected:
callables_annotation.py:139: note: def __call__(self, int, /, *args: Any, k: str, **kwargs: Any) -> None
callables_annotation.py:139: note: Got:
callables_annotation.py:139: note: def __call__(self, float, /, b: int, *, k: str, m: str) -> None
callables_annotation.py:152: error: Incompatible types in assignment (expression has type "Callable[[], str]", variable has type "Callable[[int, VarArg(Any), KwArg(Any)], str]") [assignment]
callables_annotation.py:167: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "Callable[[str, VarArg(Any), KwArg(Any)], str]") [assignment]
callables_annotation.py:169: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "Callable[[str, VarArg(Any), KwArg(Any)], str]") [assignment]
callables_annotation.py:157: error: Incompatible types in assignment (expression has type "Proto7", variable has type "Proto6") [assignment]
callables_annotation.py:157: note: Following member(s) of "Proto7" have conflicts:
callables_annotation.py:157: note: Expected:
callables_annotation.py:157: note: def __call__(self, int, /, *args: Any, k: str, **kwargs: Any) -> None
callables_annotation.py:157: note: Got:
callables_annotation.py:157: note: def __call__(self, float, /, b: int, *, k: str, m: str) -> None
callables_annotation.py:172: error: Incompatible types in assignment (expression has type "Callable[[], str]", variable has type "Callable[[int, VarArg(Any), KwArg(Any)], str]") [assignment]
callables_annotation.py:187: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "Callable[[str, VarArg(Any), KwArg(Any)], str]") [assignment]
callables_annotation.py:189: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "Callable[[str, VarArg(Any), KwArg(Any)], str]") [assignment]
"""
conformance_automated = "Fail"
errors_diff = """
Line 134: Expected 1 errors
Line 139: Unexpected errors ['callables_annotation.py:139: error: Incompatible types in assignment (expression has type "Proto7", variable has type "Proto6") [assignment]']
Line 159: Expected 1 errors
Line 157: Unexpected errors ['callables_annotation.py:157: error: Incompatible types in assignment (expression has type "Proto7", variable has type "Proto6") [assignment]']
"""
2 changes: 1 addition & 1 deletion conformance/results/mypy/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "mypy 1.10.0"
test_duration = 1.3
test_duration = 1.0
53 changes: 26 additions & 27 deletions conformance/results/pyre/callables_annotation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@ callables_annotation.py:56:4 Invalid type [31]: Expression `typing.Callable[(int
callables_annotation.py:57:4 Invalid type [31]: Expression `typing.Callable[([], [int])]` is not a valid type.
callables_annotation.py:58:4 Invalid type [31]: Expression `typing.Callable[(int, int, int)]` is not a valid type.
callables_annotation.py:89:5 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], str)]` is not a valid type.
callables_annotation.py:133:29 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[typing.Any, None]`.
callables_annotation.py:134:20 Undefined attribute [16]: `Proto5` has no attribute `__getitem__`.
callables_annotation.py:135:29 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[object, None]`.
callables_annotation.py:136:29 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[typing.Any, None]`.
callables_annotation.py:137:20 Undefined attribute [16]: `Proto4` has no attribute `__getitem__`.
callables_annotation.py:139:4 Incompatible variable type [9]: f1 is declared to have type `Proto6` but is used as type `Proto7`.
callables_annotation.py:146:0 Incompatible variable type [9]: Callback1 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:147:0 Incompatible variable type [9]: Callback2 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:151:8 Undefined or invalid type [11]: Annotation `Callback1` is not defined as a type.
callables_annotation.py:152:8 Undefined or invalid type [11]: Annotation `Callback2` is not defined as a type.
callables_annotation.py:161:0 Incompatible variable type [9]: CallbackWithInt is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:162:0 Incompatible variable type [9]: CallbackWithStr is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:166:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], str)]` is not a valid type.
callables_annotation.py:167:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(str, ...)], str)]` is not a valid type.
callables_annotation.py:168:8 Undefined or invalid type [11]: Annotation `CallbackWithInt` is not defined as a type.
callables_annotation.py:169:8 Undefined or invalid type [11]: Annotation `CallbackWithStr` is not defined as a type.
callables_annotation.py:145:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], None)]` is not a valid type.
callables_annotation.py:151:9 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], None)]` is not a valid type.
callables_annotation.py:156:4 Incompatible variable type [9]: ok10 is declared to have type `Proto3` but is used as type `Proto4[[...]]`.
callables_annotation.py:157:4 Incompatible variable type [9]: ok11 is declared to have type `Proto6` but is used as type `Proto7`.
callables_annotation.py:159:4 Incompatible variable type [9]: err1 is declared to have type `Proto5[typing.Any]` but is used as type `Proto8`.
callables_annotation.py:166:0 Incompatible variable type [9]: Callback1 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:167:0 Incompatible variable type [9]: Callback2 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:171:8 Undefined or invalid type [11]: Annotation `Callback1` is not defined as a type.
callables_annotation.py:172:8 Undefined or invalid type [11]: Annotation `Callback2` is not defined as a type.
callables_annotation.py:181:0 Incompatible variable type [9]: CallbackWithInt is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:182:0 Incompatible variable type [9]: CallbackWithStr is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.
callables_annotation.py:186:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], str)]` is not a valid type.
callables_annotation.py:187:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(str, ...)], str)]` is not a valid type.
callables_annotation.py:188:8 Undefined or invalid type [11]: Annotation `CallbackWithInt` is not defined as a type.
callables_annotation.py:189:8 Undefined or invalid type [11]: Annotation `CallbackWithStr` is not defined as a type.
"""
conformance_automated = "Fail"
errors_diff = """
Expand All @@ -41,15 +40,15 @@ Line 91: Expected 1 errors
Line 93: Expected 1 errors
Line 51: Unexpected errors ['callables_annotation.py:51:28 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[Type[int], typing.Any]`.']
Line 89: Unexpected errors ['callables_annotation.py:89:5 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], str)]` is not a valid type.']
Line 133: Unexpected errors ['callables_annotation.py:133:29 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[typing.Any, None]`.']
Line 135: Unexpected errors ['callables_annotation.py:135:29 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[object, None]`.']
Line 137: Unexpected errors ['callables_annotation.py:137:20 Undefined attribute [16]: `Proto4` has no attribute `__getitem__`.']
Line 139: Unexpected errors ['callables_annotation.py:139:4 Incompatible variable type [9]: f1 is declared to have type `Proto6` but is used as type `Proto7`.']
Line 146: Unexpected errors ['callables_annotation.py:146:0 Incompatible variable type [9]: Callback1 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 147: Unexpected errors ['callables_annotation.py:147:0 Incompatible variable type [9]: Callback2 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 151: Unexpected errors ['callables_annotation.py:151:8 Undefined or invalid type [11]: Annotation `Callback1` is not defined as a type.']
Line 161: Unexpected errors ['callables_annotation.py:161:0 Incompatible variable type [9]: CallbackWithInt is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 162: Unexpected errors ['callables_annotation.py:162:0 Incompatible variable type [9]: CallbackWithStr is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 166: Unexpected errors ['callables_annotation.py:166:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], str)]` is not a valid type.']
Line 168: Unexpected errors ['callables_annotation.py:168:8 Undefined or invalid type [11]: Annotation `CallbackWithInt` is not defined as a type.']
Line 145: Unexpected errors ['callables_annotation.py:145:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], None)]` is not a valid type.']
Line 151: Unexpected errors ['callables_annotation.py:151:9 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], None)]` is not a valid type.']
Line 156: Unexpected errors ['callables_annotation.py:156:4 Incompatible variable type [9]: ok10 is declared to have type `Proto3` but is used as type `Proto4[[...]]`.']
Line 157: Unexpected errors ['callables_annotation.py:157:4 Incompatible variable type [9]: ok11 is declared to have type `Proto6` but is used as type `Proto7`.']
Line 166: Unexpected errors ['callables_annotation.py:166:0 Incompatible variable type [9]: Callback1 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 167: Unexpected errors ['callables_annotation.py:167:0 Incompatible variable type [9]: Callback2 is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 171: Unexpected errors ['callables_annotation.py:171:8 Undefined or invalid type [11]: Annotation `Callback1` is not defined as a type.']
Line 181: Unexpected errors ['callables_annotation.py:181:0 Incompatible variable type [9]: CallbackWithInt is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 182: Unexpected errors ['callables_annotation.py:182:0 Incompatible variable type [9]: CallbackWithStr is declared to have type `TypeAlias` but is used as type `Type[typing.Callable[..., str]]`.']
Line 186: Unexpected errors ['callables_annotation.py:186:8 Invalid type [31]: Expression `typing.Callable[(typing.Concatenate[(int, ...)], str)]` is not a valid type.']
Line 188: Unexpected errors ['callables_annotation.py:188:8 Undefined or invalid type [11]: Annotation `CallbackWithInt` is not defined as a 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.19"
test_duration = 4.1
test_duration = 2.8
28 changes: 8 additions & 20 deletions conformance/results/pyright/callables_annotation.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
conformant = "Partial"
notes = """
Does not treat "*args: Any, **kwargs: Any" as "...".
"""
conformant = "Pass"
output = """
callables_annotation.py:25:5 - error: Expected 1 more positional argument (reportCallIssue)
callables_annotation.py:26:11 - error: Argument of type "Literal[2]" cannot be assigned to parameter of type "str"
Expand All @@ -21,33 +18,24 @@ callables_annotation.py:91:7 - error: Expression of type "() -> str" is incompat
callables_annotation.py:93:7 - error: Expression of type "(*, a: int) -> str" is incompatible with declared type "(int, ...) -> str"
  Type "(*, a: int) -> str" is incompatible with type "(int, ...) -> str"
    Function accepts too many positional parameters; expected 0 but received 2 (reportAssignmentType)
callables_annotation.py:133:17 - error: "assert_type" mismatch: expected "(...) -> None" but received "Proto1" (reportAssertTypeFailure)
callables_annotation.py:134:17 - error: "assert_type" mismatch: expected "Proto5[Any]" but received "Proto1" (reportAssertTypeFailure)
callables_annotation.py:135:17 - error: "assert_type" mismatch: expected "(int, ...) -> None" but received "Proto2" (reportAssertTypeFailure)
callables_annotation.py:136:17 - error: "assert_type" mismatch: expected "(...) -> None" but received "Proto3" (reportAssertTypeFailure)
callables_annotation.py:137:17 - error: "assert_type" mismatch: expected "Proto4[...]" but received "Proto3" (reportAssertTypeFailure)
callables_annotation.py:139:18 - error: Expression of type "Proto7" is incompatible with declared type "Proto6"
  "Proto7" is incompatible with protocol "Proto6"
callables_annotation.py:159:25 - error: Expression of type "Proto8" is incompatible with declared type "Proto5[Any]"
  "Proto8" is incompatible with protocol "Proto5[Any]"
    "__call__" is an incompatible type
      Type "(a: float, /, b: int, *, k: str, m: str) -> None" is incompatible with type "(a: int, /, *args: Any, k: str, **kwargs: Any) -> None"
      Type "() -> None" is incompatible with type "(*args: T_contra@Proto5, **kwargs: T_contra@Proto5) -> None"
        Parameter "*args" has no corresponding parameter
        Parameter "**kwargs" has no corresponding parameter (reportAssignmentType)
callables_annotation.py:152:26 - error: Expression of type "() -> str" is incompatible with declared type "Callback2[...]"
callables_annotation.py:172:26 - error: Expression of type "() -> str" is incompatible with declared type "Callback2[...]"
  Type "() -> str" is incompatible with type "Callback2[...]"
    Function accepts too many positional parameters; expected 0 but received 2 (reportAssignmentType)
callables_annotation.py:167:48 - error: Expression of type "(int, str) -> str" is incompatible with declared type "(str, ...) -> str"
callables_annotation.py:187:48 - error: Expression of type "(int, str) -> str" is incompatible with declared type "(str, ...) -> str"
  Type "(int, str) -> str" is incompatible with type "(str, ...) -> str"
    Parameter 1: type "str" is incompatible with type "int"
      "str" is incompatible with "int" (reportAssignmentType)
callables_annotation.py:169:32 - error: Expression of type "(int, str) -> str" is incompatible with declared type "CallbackWithStr[...]"
callables_annotation.py:189:32 - error: Expression of type "(int, str) -> str" is incompatible with declared type "CallbackWithStr[...]"
  Type "(int, str) -> str" is incompatible with type "CallbackWithStr[...]"
    Parameter 1: type "str" is incompatible with type "int"
      "str" is incompatible with "int" (reportAssignmentType)
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 133: Unexpected errors ['callables_annotation.py:133:17 - error: "assert_type" mismatch: expected "(...) -> None" but received "Proto1" (reportAssertTypeFailure)']
Line 135: Unexpected errors ['callables_annotation.py:135:17 - error: "assert_type" mismatch: expected "(int, ...) -> None" but received "Proto2" (reportAssertTypeFailure)']
Line 137: Unexpected errors ['callables_annotation.py:137:17 - error: "assert_type" mismatch: expected "Proto4[...]" but received "Proto3" (reportAssertTypeFailure)']
Line 139: Unexpected errors ['callables_annotation.py:139:18 - error: Expression of type "Proto7" is incompatible with declared type "Proto6"']
"""
2 changes: 1 addition & 1 deletion conformance/results/pyright/constructors_call_init.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ constructors_call_init.py:56:1 - error:
  Could not bind method "__init__" because "Class4[str]" is not assignable to parameter "self"
    "Class4[str]" is incompatible with "Class4[int]"
      Type parameter "T@Class4" is invariant, but "str" is not the same as "int" (reportGeneralTypeIssues)
constructors_call_init.py:107:24 - warning: Type annotation for "self" parameter of "__init__" method cannot contain class-scoped type varaiables (reportInvalidTypeVarUse)
constructors_call_init.py:107:24 - warning: Type annotation for "self" parameter of "__init__" method cannot contain class-scoped type variables (reportInvalidTypeVarUse)
constructors_call_init.py:130:1 - error: Expected no arguments to "Class11" constructor (reportCallIssue)
"""
2 changes: 1 addition & 1 deletion conformance/results/pyright/constructors_callable.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ constructors_callable.py:77:13 - information: Type of "r4" is "(x: int) -> int"
constructors_callable.py:79:1 - error: Argument missing for parameter "x" (reportCallIssue)
constructors_callable.py:80:1 - error: Argument missing for parameter "x" (reportCallIssue)
constructors_callable.py:80:4 - error: No parameter named "y" (reportCallIssue)
constructors_callable.py:97:13 - information: Type of "r5" is "(*args: Any, **kwargs: Any) -> NoReturn"
constructors_callable.py:97:13 - information: Type of "r5" is "(...) -> NoReturn"
constructors_callable.py:125:13 - information: Type of "r6" is "() -> Class6Proxy"
constructors_callable.py:127:4 - error: Expected 0 positional arguments (reportCallIssue)
constructors_callable.py:142:13 - information: Type of "r6_any" is "() -> Any"
Expand Down
Loading

0 comments on commit d8c80ac

Please sign in to comment.