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
24 changes: 17 additions & 7 deletions conformance/results/mypy/constructors_call_init.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@ conformant = "Partial"
notes = """
Does not report errors during binding to self parameter of `__init__` method.
Does not reject use of class-scoped type variables in annotation of self parameter in `__init__` method.
Does not solve a subclass's type parameters from the self annotation of an inherited `__init__` method.
"""
conformance_automated = "Fail"
errors_diff = """
Line 56: Expected 1 errors
Line 107: Expected 1 errors
Line 73: Unexpected errors ['constructors_call_init.py:73: error: Expression is of type "Class5[list[int]]", not "Class5[int]" [assert-type]']
Line 57: Expected 1 errors
Line 108: Expected 1 errors
Line 147: Expected 1 errors
Line 159: Expected 1 errors
Line 167: Expected 1 errors
Line 74: Unexpected errors ['constructors_call_init.py:74: error: Expression is of type "Class5[list[int]]", not "Class5[int]" [assert-type]']
Line 129: Unexpected errors ['constructors_call_init.py:129: error: Expression is of type "Class13[Never, Never]", not "Class13[int, str]" [assert-type]']
Line 136: Unexpected errors ['constructors_call_init.py:136: error: Expression is of type "Class14[Never, Never, Never]", not "Class14[Any, str, int]" [assert-type]']
Line 189: Unexpected errors ['constructors_call_init.py:189: error: Expression is of type "Class20[int]", not "Class20[int | None]" [assert-type]']
"""
output = """
constructors_call_init.py:21: error: Argument 1 to "Class1" has incompatible type "float"; expected "int" [arg-type]
constructors_call_init.py:42: error: Argument 1 to "Class3" has incompatible type "Class2[Never]"; expected "Class3 | None" [arg-type]
constructors_call_init.py:73: error: Expression is of type "Class5[list[int]]", not "Class5[int]" [assert-type]
constructors_call_init.py:130: error: Too many arguments for "Class11" [call-arg]
constructors_call_init.py:22: error: Argument 1 to "Class1" has incompatible type "float"; expected "int" [arg-type]
constructors_call_init.py:43: error: Argument 1 to "Class3" has incompatible type "Class2[Never]"; expected "Class3 | None" [arg-type]
constructors_call_init.py:74: error: Expression is of type "Class5[list[int]]", not "Class5[int]" [assert-type]
constructors_call_init.py:129: error: Expression is of type "Class13[Never, Never]", not "Class13[int, str]" [assert-type]
constructors_call_init.py:136: error: Expression is of type "Class14[Never, Never, Never]", not "Class14[Any, str, int]" [assert-type]
constructors_call_init.py:189: error: Expression is of type "Class20[int]", not "Class20[int | None]" [assert-type]
constructors_call_init.py:211: error: Too many arguments for "Class11" [call-arg]
"""
6 changes: 6 additions & 0 deletions conformance/results/mypy/constructors_callable.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ notes = """
Does not generate a union type for `__new__` and `__init__` when converting class to callable.
Does not ignore `__init__` based on `__new__` return type when converting class to callable.
Does not support `__new__` return type that is different from class being constructed.
Does not solve a subclass's type parameters from the self annotation of an inherited `__init__` method when converting class to callable.
"""
conformance_automated = "Fail"
errors_diff = """
Expand All @@ -14,6 +15,8 @@ Line 107: Unexpected errors ['constructors_callable.py:107: error: Expression is
Line 118: Unexpected errors ['constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]']
Line 128: Unexpected errors ['constructors_callable.py:128: error: Expression is of type "Class6", not "Class6Proxy" [assert-type]', 'constructors_callable.py:128: error: Too few arguments [call-arg]']
Line 145: Unexpected errors ['constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any" [assert-type]', 'constructors_callable.py:145: error: Too few arguments [call-arg]']
Line 219: Unexpected errors ['constructors_callable.py:219: error: Need type annotation for "r11" [var-annotated]']
Line 221: Unexpected errors ['constructors_callable.py:221: error: Expression is of type "Class11[Any, Any]", not "Class11[int, str]" [assert-type]']
"""
output = """
constructors_callable.py:36: note: Revealed type is "def (x: int) -> constructors_callable.Class1"
Expand Down Expand Up @@ -46,4 +49,7 @@ constructors_callable.py:187: error: Cannot infer function type argument [misc]
constructors_callable.py:196: note: Revealed type is "def [T] (x: list[T], y: list[T]) -> constructors_callable.Class9"
constructors_callable.py:197: error: Argument 2 has incompatible type "str"; expected "list[str]" [arg-type]
constructors_callable.py:199: error: Cannot infer function type argument [misc]
constructors_callable.py:219: error: Need type annotation for "r11" [var-annotated]
constructors_callable.py:220: note: Revealed type is "def () -> constructors_callable.Class11[Any, Any]"
constructors_callable.py:221: error: Expression is of type "Class11[Any, Any]", not "Class11[int, str]" [assert-type]
"""
30 changes: 24 additions & 6 deletions conformance/results/pycroscope/constructors_call_init.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
conformance_automated = "Pass"
conformant = "Partial"
notes = """
Does not solve a subclass's type parameters from the self annotation of an inherited `__init__` method.
Does not report errors during binding to the self parameter of an inherited `__init__` method.
"""
conformance_automated = "Fail"
errors_diff = """
Line 147: Expected 1 errors
Line 159: Expected 1 errors
Line 167: Expected 1 errors
Line 129: Unexpected errors ['./constructors_call_init.py:129:12: ./constructors_call_init.py.Class13~[Any[generic_argument], Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class13[int, str]']
Line 136: Unexpected errors ['./constructors_call_init.py:136:12: ./constructors_call_init.py.Class14~[Any[generic_argument], Any[generic_argument], Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class14[Any[explicit], str, int]']
Line 187: Unexpected errors ['./constructors_call_init.py:187:12: ./constructors_call_init.py.Class20~[Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class20[int]']
Line 188: Unexpected errors ['./constructors_call_init.py:188:12: ./constructors_call_init.py.Class20~[Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class20[int]']
Line 189: Unexpected errors ['./constructors_call_init.py:189:12: ./constructors_call_init.py.Class20~[Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class20[int | None]']
"""
output = """
./constructors_call_init.py:21:12: Incompatible argument type for x: expected int but got Literal[1.0] [incompatible_argument]
./constructors_call_init.py:42:7: Incompatible argument type for x: expected ./constructors_call_init.py.Class3 | None but got ./constructors_call_init.py.Class2 [incompatible_argument]
./constructors_call_init.py:56:0: Missing required positional argument '%self' [incompatible_call]
./constructors_call_init.py:107:17: Class-scoped type variables are not allowed in __init__ self annotation [invalid_self_usage]
./constructors_call_init.py:130:0: Takes 0 positional arguments but 1 were given [incompatible_call]
./constructors_call_init.py:22:12: Incompatible argument type for x: expected int but got Literal[1.0] [incompatible_argument]
./constructors_call_init.py:43:7: Incompatible argument type for x: expected ./constructors_call_init.py.Class3 | None but got ./constructors_call_init.py.Class2 [incompatible_argument]
./constructors_call_init.py:57:0: Missing required positional argument '%self' [incompatible_call]
./constructors_call_init.py:108:17: Class-scoped type variables are not allowed in __init__ self annotation [invalid_self_usage]
./constructors_call_init.py:129:12: ./constructors_call_init.py.Class13~[Any[generic_argument], Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class13[int, str]
./constructors_call_init.py:136:12: ./constructors_call_init.py.Class14~[Any[generic_argument], Any[generic_argument], Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class14[Any[explicit], str, int]
./constructors_call_init.py:187:12: ./constructors_call_init.py.Class20~[Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class20[int]
./constructors_call_init.py:188:12: ./constructors_call_init.py.Class20~[Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class20[int]
./constructors_call_init.py:189:12: ./constructors_call_init.py.Class20~[Any[generic_argument]] is not equivalent to ./constructors_call_init.py.Class20[int | None]
./constructors_call_init.py:211:0: Takes 0 positional arguments but 1 were given [incompatible_call]
"""
9 changes: 8 additions & 1 deletion conformance/results/pycroscope/constructors_callable.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
conformance_automated = "Pass"
conformant = "Partial"
notes = """
Does not solve a subclass's type parameters from the self annotation of an inherited `__init__` method when converting class to callable.
"""
conformance_automated = "Fail"
errors_diff = """
Line 221: Unexpected errors ['./constructors_callable.py:221:12: ./constructors_callable.py.Class11[Any[generic_argument], Any[generic_argument]] is not equivalent to ./constructors_callable.py.Class11[int, str]']
"""
output = """
./constructors_callable.py:36:12: Revealed type is '(x: int) -> ./constructors_callable.py.Class1' [reveal_type]
Expand All @@ -26,4 +31,6 @@ output = """
./constructors_callable.py:196:12: Revealed type is '(x: list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__], y: list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__]) -> ./constructors_callable.py.Class9' [reveal_type]
./constructors_callable.py:197:9: Incompatible argument type for y: expected list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__] but got Literal['not a list'] [incompatible_argument]
./constructors_callable.py:199:0: Cannot resolve type variables [incompatible_call]
./constructors_callable.py:220:12: Revealed type is '() -> ./constructors_callable.py.Class11[~T1@./constructors_callable.py.Class11, ~T2@./constructors_callable.py.Class11]' [reveal_type]
./constructors_callable.py:221:12: ./constructors_callable.py.Class11[Any[generic_argument], Any[generic_argument]] is not equivalent to ./constructors_callable.py.Class11[int, str]
"""
20 changes: 13 additions & 7 deletions conformance/results/pyrefly/constructors_call_init.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
conformant = "Pass"
conformance_automated = "Pass"
conformant = "Partial"
notes = """
Does not report errors during binding to the self parameter of an inherited `__init__` method when the class is specialized via the `__new__` method return type.
"""
conformance_automated = "Fail"
errors_diff = """
Line 167: Expected 1 errors
"""
output = """
ERROR constructors_call_init.py:21:13-16: Argument `float` is not assignable to parameter `x` with type `int` in function `Class1.__init__` [bad-argument-type]
ERROR constructors_call_init.py:42:8-20: Argument `Class2[@_]` is not assignable to parameter `x` with type `Class3 | None` in function `Class2.__init__` [bad-argument-type]
ERROR constructors_call_init.py:56:12-14: Argument `Class4[str]` is not assignable to parameter `self` with type `Class4[int]` in function `Class4.__init__` [bad-argument-type]
ERROR constructors_call_init.py:107:9-17: `__init__` method self type cannot reference class type parameters `T2`, `T1` [invalid-annotation]
ERROR constructors_call_init.py:130:9-10: Expected 0 positional arguments, got 1 in function `object.__init__` [bad-argument-count]
ERROR constructors_call_init.py:22:13-16: Argument `float` is not assignable to parameter `x` with type `int` in function `Class1.__init__` [bad-argument-type]
ERROR constructors_call_init.py:43:8-20: Argument `Class2[@_]` is not assignable to parameter `x` with type `Class3 | None` in function `Class2.__init__` [bad-argument-type]
ERROR constructors_call_init.py:57:12-14: Argument `Class4[str]` is not assignable to parameter `self` with type `Class4[int]` in function `Class4.__init__` [bad-argument-type]
ERROR constructors_call_init.py:108:9-17: `__init__` method self type cannot reference class type parameters `T2`, `T1` [invalid-annotation]
ERROR constructors_call_init.py:147:8-10: Argument `Class15[@_]` is not assignable to parameter `self` with type `Class12[int, str]` in function `Class12.__init__` [bad-argument-type]
ERROR constructors_call_init.py:159:9-10: Argument `Literal[1]` is not assignable to parameter `value` with type `str` in function `Class16.__init__` [bad-argument-type]
ERROR constructors_call_init.py:211:9-10: Expected 0 positional arguments, got 1 in function `object.__init__` [bad-argument-count]
"""
9 changes: 7 additions & 2 deletions conformance/results/pyrefly/constructors_callable.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
conformant = "Pass"
conformance_automated = "Pass"
conformant = "Partial"
notes = """
Returns the base class from the self annotation of an inherited `__init__` method when converting class to callable.
"""
conformance_automated = "Fail"
errors_diff = """
Line 221: Unexpected errors ['assert_type(Class10[int, str], Class11[int, str]) failed [assert-type]']
"""
output = """
ERROR constructors_callable.py:38:3-5: Missing argument `x` [missing-argument]
Expand All @@ -20,4 +24,5 @@ ERROR constructors_callable.py:185:10-22: Argument `Literal['not a list']` is no
ERROR constructors_callable.py:187:9-13: Argument `list[str]` is not assignable to parameter `y` with type `list[int]` [bad-argument-type]
ERROR constructors_callable.py:197:10-22: Argument `Literal['not a list']` is not assignable to parameter `y` with type `list[str]` [bad-argument-type]
ERROR constructors_callable.py:199:9-13: Argument `list[str]` is not assignable to parameter `y` with type `list[int]` [bad-argument-type]
ERROR constructors_callable.py:221:12-38: assert_type(Class10[int, str], Class11[int, str]) failed [assert-type]
"""
31 changes: 24 additions & 7 deletions conformance/results/pyright/constructors_call_init.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
conformant = "Pass"
conformance_automated = "Pass"
conformant = "Partial"
notes = """
Does not solve a subclass's type parameters from the self annotation of an inherited `__init__` method.
Does not report an error when a subclass's specialization of a base class is not assignable to the self annotation of an inherited `__init__` method.
"""
conformance_automated = "Fail"
errors_diff = """
Line 147: Expected 1 errors
Line 129: Unexpected errors ['constructors_call_init.py:129:13 - error: "assert_type" mismatch: expected "Class13[int, str]" but received "Class13[Unknown, Unknown]" (reportAssertTypeFailure)']
Line 136: Unexpected errors ['constructors_call_init.py:136:13 - error: "assert_type" mismatch: expected "Class14[Any, str, int]" but received "Class14[Unknown, Unknown, Unknown]" (reportAssertTypeFailure)']
Line 189: Unexpected errors ['constructors_call_init.py:189:13 - error: "assert_type" mismatch: expected "Class20[int | None]" but received "Class20[int]" (reportAssertTypeFailure)']
"""
output = """
constructors_call_init.py:21:13 - error: Argument of type "float" cannot be assigned to parameter "x" of type "int" in function "__init__"
constructors_call_init.py:22:13 - error: Argument of type "float" cannot be assigned to parameter "x" of type "int" in function "__init__"
  "float" is not assignable to "int" (reportArgumentType)
constructors_call_init.py:42:8 - error: Argument of type "Class2[Unknown]" cannot be assigned to parameter "x" of type "Class3 | None" in function "__init__"
constructors_call_init.py:43:8 - error: Argument of type "Class2[Unknown]" cannot be assigned to parameter "x" of type "Class3 | None" in function "__init__"
  Type "Class2[Unknown]" is not assignable to type "Class3 | None"
    "Class2[Unknown]" is not assignable to "Class3"
    "Class2[Unknown]" is not assignable to "None" (reportArgumentType)
constructors_call_init.py:56:1 - error:
constructors_call_init.py:57:1 - error:
  Could not bind method "__init__" because "Class4[str]" is not assignable to parameter "self"
    "Class4[str]" is not assignable to "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 variables (reportInvalidTypeVarUse)
constructors_call_init.py:130:9 - error: Expected 0 positional arguments (reportCallIssue)
constructors_call_init.py:108:24 - warning: Type annotation for "self" parameter of "__init__" method cannot contain class-scoped type variables (reportInvalidTypeVarUse)
constructors_call_init.py:129:13 - error: "assert_type" mismatch: expected "Class13[int, str]" but received "Class13[Unknown, Unknown]" (reportAssertTypeFailure)
constructors_call_init.py:136:13 - error: "assert_type" mismatch: expected "Class14[Any, str, int]" but received "Class14[Unknown, Unknown, Unknown]" (reportAssertTypeFailure)
constructors_call_init.py:159:9 - error: Argument of type "Literal[1]" cannot be assigned to parameter "value" of type "str" in function "__init__"
  "Literal[1]" is not assignable to "str" (reportArgumentType)
constructors_call_init.py:167:1 - error:
  Could not bind method "__init__" because "Class18[str, str]" is not assignable to parameter "self"
    "Class18[str, str]" is not assignable to "Class12[int, str]"
      Type parameter "T1@Class12" is invariant, but "str" is not the same as "int" (reportGeneralTypeIssues)
constructors_call_init.py:189:13 - error: "assert_type" mismatch: expected "Class20[int | None]" but received "Class20[int]" (reportAssertTypeFailure)
constructors_call_init.py:211:9 - error: Expected 0 positional arguments (reportCallIssue)
"""
9 changes: 8 additions & 1 deletion conformance/results/pyright/constructors_callable.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
conformance_automated = "Pass"
conformant = "Partial"
notes = """
Returns the base class from the self annotation of an inherited `__init__` method when converting class to callable.
"""
conformance_automated = "Fail"
errors_diff = """
Line 221: Unexpected errors ['constructors_callable.py:221:13 - error: "assert_type" mismatch: expected "Class11[int, str]" but received "Class10[int, str]" (reportAssertTypeFailure)']
"""
output = """
constructors_callable.py:36:13 - information: Type of "r1" is "(x: int) -> Class1"
Expand Down Expand Up @@ -33,4 +38,6 @@ constructors_callable.py:197:10 - error: Argument of type "Literal['not a list']
  "Literal['not a list']" is not assignable to "list[str]" (reportArgumentType)
constructors_callable.py:199:10 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@__init__]"
  "Literal['']" is not assignable to "int" (reportArgumentType)
constructors_callable.py:220:13 - information: Type of "r11" is "() -> Class10[int, str]"
constructors_callable.py:221:13 - error: "assert_type" mismatch: expected "Class11[int, str]" but received "Class10[int, str]" (reportAssertTypeFailure)
"""
Loading