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

Add additional Unpack/kwargs conformance test cases #1918

Merged
merged 20 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 18 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
10 changes: 8 additions & 2 deletions conformance/results/mypy/callables_kwargs.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
conformant = "Pass"
conformant = "Partial"
erictraut marked this conversation as resolved.
Show resolved Hide resolved
notes="""
Allows callable without kwargs to be assigned to callable with unpacked kwargs
Allows unpacked kwargs to be used when invoking function without kwargs
"""
output = """
callables_kwargs.py:22: note: "func1" defined here
callables_kwargs.py:46: error: Missing named argument "v1" for "func1" [call-arg]
Expand All @@ -21,6 +25,8 @@ callables_kwargs.py:103: note: "TDProtocol5.__call__" has type "Callable[[Arg(in
callables_kwargs.py:111: error: Overlap between argument names and ** TypedDict items: "v1" [misc]
callables_kwargs.py:122: error: Unpack item in ** argument must be a TypedDict [misc]
"""
conformance_automated = "Pass"
conformance_automated = "Fail"
errors_diff = """
Line 130: Expected 1 errors
Line 138: Expected 1 errors
"""
4 changes: 2 additions & 2 deletions conformance/results/mypy/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "mypy 1.14.0"
test_duration = 1.6
version = "mypy 1.14.1"
test_duration = 1.2
2 changes: 2 additions & 0 deletions conformance/results/pyre/callables_kwargs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ callables_kwargs.py:102:0 Incompatible variable type [9]: v4 is declared to have
callables_kwargs.py:103:0 Incompatible variable type [9]: v5 is declared to have type `TDProtocol5` but is used as type `typing.Callable(func1)[[Keywords(Unpack[TD2])], None]`.
callables_kwargs.py:111:21 Duplicate parameter [65]: Duplicate parameter name `v1`.
callables_kwargs.py:122:12 Invalid type [31]: `Unpack` in kwargs may only be used with typed dictionaries. `Variable[T (bound to TD2)]` is not a typed dictionary.
callables_kwargs.py:130:0 Incompatible variable type [9]: v7 is declared to have type `TDProtocol6` but is used as type `typing.Callable(func7)[[KeywordOnly(v1, int), KeywordOnly(v3, str), KeywordOnly(v2, str, default)], None]`.
callables_kwargs.py:138:4 Missing argument [20]: Call `func7` expects argument `v2` to be a required typed dictionary key, as the corresponding parameter has no default.
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
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.23"
test_duration = 7.3
test_duration = 8.1
10 changes: 5 additions & 5 deletions conformance/results/pyright/aliases_explicit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ aliases_explicit.py:79:21 - error: Invalid expression form for type alias defini
aliases_explicit.py:79:21 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
aliases_explicit.py:80:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
aliases_explicit.py:80:21 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_explicit.py:80:21 - error: Expected class but received "list[Unknown]" (reportGeneralTypeIssues)
aliases_explicit.py:81:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
aliases_explicit.py:81:21 - error: Tuple expression not allowed in type expression
  Use tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use tuple[T1, ..., Tn] to indicate a tuple type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_explicit.py:82:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
aliases_explicit.py:82:21 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_explicit.py:82:21 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
aliases_explicit.py:83:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
aliases_explicit.py:83:21 - error: Dictionary expression not allowed in type expression
  Use Dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
  Use dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
aliases_explicit.py:83:21 - error: Expected class but received "dict[str, Unknown]" (reportGeneralTypeIssues)
aliases_explicit.py:83:28 - error: "b" is not defined (reportUndefinedVariable)
aliases_explicit.py:84:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
aliases_explicit.py:84:21 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
aliases_explicit.py:85:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
aliases_explicit.py:85:21 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_explicit.py:85:21 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
aliases_explicit.py:85:27 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
aliases_explicit.py:86:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
Expand Down
10 changes: 5 additions & 5 deletions conformance/results/pyright/aliases_type_statement.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ aliases_type_statement.py:31:22 - error: Argument of type "TypeAliasType" cannot
    "TypeAliasType" is not assignable to "tuple[_ClassInfo, ...]" (reportArgumentType)
aliases_type_statement.py:37:22 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
aliases_type_statement.py:38:22 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_type_statement.py:38:22 - error: Expected class but received "list[Unknown]" (reportGeneralTypeIssues)
aliases_type_statement.py:39:22 - error: Tuple expression not allowed in type expression
  Use tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use tuple[T1, ..., Tn] to indicate a tuple type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_type_statement.py:40:22 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_type_statement.py:40:22 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
aliases_type_statement.py:41:22 - error: Dictionary expression not allowed in type expression
  Use Dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
  Use dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
aliases_type_statement.py:41:22 - error: Expected class but received "dict[str, Unknown]" (reportGeneralTypeIssues)
aliases_type_statement.py:41:29 - error: "b" is not defined (reportUndefinedVariable)
aliases_type_statement.py:42:22 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
aliases_type_statement.py:43:22 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_type_statement.py:43:22 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
aliases_type_statement.py:43:28 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
aliases_type_statement.py:44:22 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/pyright/aliases_typealiastype.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ aliases_typealiastype.py:56:42 - error: Expected class but received "dict[str, U
aliases_typealiastype.py:56:49 - error: "b" is not defined (reportUndefinedVariable)
aliases_typealiastype.py:57:42 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
aliases_typealiastype.py:58:42 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
aliases_typealiastype.py:58:42 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
aliases_typealiastype.py:58:48 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
aliases_typealiastype.py:59:42 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
Expand Down
10 changes: 5 additions & 5 deletions conformance/results/pyright/annotations_forward_refs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ annotations_forward_refs.py:24:7 - error: Union syntax cannot be used with strin
annotations_forward_refs.py:25:13 - error: Union syntax cannot be used with string operand; use quotes around entire expression (reportGeneralTypeIssues)
annotations_forward_refs.py:41:10 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
annotations_forward_refs.py:42:10 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_forward_refs.py:42:10 - error: Expected class but received "list[Unknown]" (reportGeneralTypeIssues)
annotations_forward_refs.py:43:10 - error: Tuple expression not allowed in type expression
  Use tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use tuple[T1, ..., Tn] to indicate a tuple type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_forward_refs.py:44:10 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_forward_refs.py:44:10 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
annotations_forward_refs.py:45:10 - error: Dictionary expression not allowed in type expression
  Use Dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
  Use dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
annotations_forward_refs.py:45:10 - error: Expected class but received "dict[Unknown, Unknown]" (reportGeneralTypeIssues)
annotations_forward_refs.py:46:10 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
annotations_forward_refs.py:47:10 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_forward_refs.py:47:10 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
annotations_forward_refs.py:47:16 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
annotations_forward_refs.py:48:10 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
Expand Down
10 changes: 5 additions & 5 deletions conformance/results/pyright/annotations_typeexpr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ conformant = "Pass"
output = """
annotations_typeexpr.py:88:9 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
annotations_typeexpr.py:89:9 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_typeexpr.py:89:9 - error: Expected class but received "list[Unknown]" (reportGeneralTypeIssues)
annotations_typeexpr.py:90:9 - error: Tuple expression not allowed in type expression
  Use tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use tuple[T1, ..., Tn] to indicate a tuple type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_typeexpr.py:91:9 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_typeexpr.py:91:9 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
annotations_typeexpr.py:92:9 - error: Dictionary expression not allowed in type expression
  Use Dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
  Use dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
annotations_typeexpr.py:92:9 - error: Expected class but received "dict[Unknown, Unknown]" (reportGeneralTypeIssues)
annotations_typeexpr.py:93:9 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
annotations_typeexpr.py:94:9 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
annotations_typeexpr.py:94:9 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
annotations_typeexpr.py:94:15 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
annotations_typeexpr.py:95:9 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
Expand Down
10 changes: 8 additions & 2 deletions conformance/results/pyright/callables_kwargs.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
conformant = "Pass"
conformant = "Partial"
notes="""
Allows callable without kwargs to be assigned to callable with unpacked kwargs
Allows unpacked kwargs to be used when invoking function without kwargs
"""
output = """
callables_kwargs.py:28:5 - error: Could not access item in TypedDict
  "v2" is not a required key in "TD2", so access may result in runtime exception (reportTypedDictNotRequiredAccess)
Expand Down Expand Up @@ -28,6 +32,8 @@ callables_kwargs.py:103:19 - error: Type "(**kwargs: **TD2) -> None" is not assi
callables_kwargs.py:111:30 - error: Typed dictionary overlaps with keyword parameter: v1 (reportGeneralTypeIssues)
callables_kwargs.py:122:21 - error: Expected TypedDict type argument for Unpack (reportGeneralTypeIssues)
"""
conformance_automated = "Pass"
conformance_automated = "Fail"
errors_diff = """
Line 130: Expected 1 errors
Line 138: Expected 1 errors
"""
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ generics_syntax_declarations.py:32:11 - error: Cannot access attribute "is_integ
  Attribute "is_integer" is unknown (reportAttributeAccessIssue)
generics_syntax_declarations.py:44:21 - error: TypeVar constraint type cannot be generic (reportGeneralTypeIssues)
generics_syntax_declarations.py:48:17 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
generics_syntax_declarations.py:48:17 - error: Expected class but received "list[Unknown]" (reportGeneralTypeIssues)
generics_syntax_declarations.py:60:17 - error: TypeVar must have at least two constrained types (reportGeneralTypeIssues)
generics_syntax_declarations.py:64:17 - error: TypeVar must have at least two constrained types (reportGeneralTypeIssues)
Expand Down
9 changes: 3 additions & 6 deletions conformance/results/pyright/generics_variance_inference.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ generics_variance_inference.py:58:35 - error: Type "ShouldBeCovariant3[float]" i
  "ShouldBeCovariant3[float]" is not assignable to "ShouldBeCovariant3[int]"
    Type parameter "T@ShouldBeCovariant3" is covariant, but "float" is not a subtype of "int"
      "float" is not assignable to "int" (reportAssignmentType)
generics_variance_inference.py:66:36 - error: Type "ShouldBeCovariant4[int]" is not assignable to declared type "ShouldBeCovariant4[float]"
  "ShouldBeCovariant4[int]" is not assignable to "ShouldBeCovariant4[float]"
    Type parameter "T@ShouldBeCovariant4" is invariant, but "int" is not the same as "float" (reportAssignmentType)
generics_variance_inference.py:67:34 - error: Type "ShouldBeCovariant4[float]" is not assignable to declared type "ShouldBeCovariant4[int]"
  "ShouldBeCovariant4[float]" is not assignable to "ShouldBeCovariant4[int]"
    Type parameter "T@ShouldBeCovariant4" is invariant, but "float" is not the same as "int" (reportAssignmentType)
    Type parameter "T@ShouldBeCovariant4" is covariant, but "float" is not a subtype of "int"
      "float" is not assignable to "int" (reportAssignmentType)
generics_variance_inference.py:80:34 - error: Type "ShouldBeCovariant5[float]" is not assignable to declared type "ShouldBeCovariant5[int]"
  "ShouldBeCovariant5[float]" is not assignable to "ShouldBeCovariant5[int]"
    Type parameter "T@ShouldBeCovariant5" is covariant, but "float" is not a subtype of "int"
Expand Down Expand Up @@ -82,7 +80,6 @@ generics_variance_inference.py:194:37 - error: Type "ShouldBeContravariant2[int]
    Type parameter "T@ShouldBeContravariant2" is contravariant, but "int" is not a supertype of "float"
      "float" is not assignable to "int" (reportAssignmentType)
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 66: Unexpected errors ['generics_variance_inference.py:66:36 - error: Type "ShouldBeCovariant4[int]" is not assignable to declared type "ShouldBeCovariant4[float]"']
"""
2 changes: 1 addition & 1 deletion conformance/results/pyright/qualifiers_annotated.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ qualifiers_annotated.py:46:17 - error: Dictionary expression not allowed in type
qualifiers_annotated.py:46:24 - error: "b" is not defined (reportUndefinedVariable)
qualifiers_annotated.py:47:17 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
qualifiers_annotated.py:48:17 - error: List expression not allowed in type expression
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
qualifiers_annotated.py:48:17 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
qualifiers_annotated.py:48:23 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
qualifiers_annotated.py:49:17 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ qualifiers_final_decorator.py:56:9 - error: Method "method1" cannot override fin
qualifiers_final_decorator.py:60:9 - error: Method "method2" cannot override final method defined in class "Base2" (reportIncompatibleMethodOverride)
qualifiers_final_decorator.py:64:9 - error: Method "method3" cannot override final method defined in class "Base2" (reportIncompatibleMethodOverride)
qualifiers_final_decorator.py:75:9 - error: Method "method4" cannot override final method defined in class "Base2" (reportIncompatibleMethodOverride)
qualifiers_final_decorator.py:86:9 - error: Overload for "method" is marked @final but implementation is not (reportInconsistentOverload)
qualifiers_final_decorator.py:86:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload)
qualifiers_final_decorator.py:89:9 - error: Method "method" cannot override final method defined in class "Base3" (reportIncompatibleMethodOverride)
qualifiers_final_decorator.py:102:9 - error: Method "method" cannot override final method defined in class "Base4" (reportIncompatibleMethodOverride)
qualifiers_final_decorator.py:118:9 - error: Method "method" cannot override final method defined in class "Base5_2" (reportIncompatibleMethodOverride)
Expand Down
4 changes: 2 additions & 2 deletions conformance/results/pyright/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "pyright 1.1.391"
test_duration = 1.2
version = "pyright 1.1.393"
test_duration = 1.5
Loading