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
27 changes: 27 additions & 0 deletions conformance/results/mypy/constructors_class_statements.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
conformant = "Partial"
notes = """
Does not honor the evaluated return type of the implied metaclass call when it isn't a class.
Does not validate keyword arguments in a class statement against the metaclass `__new__` method.
Incorrectly rejects a metaclass `__new__` method annotated to return a type other than a class.
"""
conformance_automated = "Fail"
errors_diff = """
Line 56: Expected 1 errors
Line 60: Expected 1 errors
Line 77: Unexpected errors ['constructors_class_statements.py:77: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "type") [misc]']
Line 85: Unexpected errors ['constructors_class_statements.py:85: error: Expression is of type "type[Class6]", not "int" [assert-type]']
"""
output = """
constructors_class_statements.py:30: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [metaclass]
constructors_class_statements.py:30: note: "constructors_class_statements.MetaA" (metaclass of "constructors_class_statements.BaseA") conflicts with "constructors_class_statements.MetaB" (metaclass of "constructors_class_statements.BaseB")
constructors_class_statements.py:69: error: Argument "key" to "Meta1" has incompatible type "str"; expected "int" [arg-type]
constructors_class_statements.py:77: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "type") [misc]
constructors_class_statements.py:85: error: Expression is of type "type[Class6]", not "int" [assert-type]
constructors_class_statements.py:93: error: Signature of "__prepare__" incompatible with supertype "builtins.type" [override]
constructors_class_statements.py:93: note: Superclass:
constructors_class_statements.py:93: note: @classmethod
constructors_class_statements.py:93: note: def __prepare__(metacls, str, tuple[type, ...], /, **kwds: Any) -> MutableMapping[str, object]
constructors_class_statements.py:93: note: Subclass:
constructors_class_statements.py:93: note: @classmethod
constructors_class_statements.py:93: note: def __prepare__(mcls, name: str, bases: tuple[type, ...]) -> Any
"""
13 changes: 13 additions & 0 deletions conformance/results/mypy/constructors_init_subclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
conformant = "Partial"
notes = """
Does not validate keyword arguments against `__init_subclass__` when the metaclass defines an `__init__` method (but no `__new__` method).
"""
conformance_automated = "Fail"
errors_diff = """
Line 58: Expected 1 errors
"""
output = """
constructors_init_subclass.py:26: error: Argument "flag" to "__init_subclass__" of "Base" has incompatible type "str"; expected "bool" [arg-type]
constructors_init_subclass.py:30: error: Unexpected keyword argument "other" for "__init_subclass__" of "Base" [call-arg]
constructors_init_subclass.py:34: error: Unexpected keyword argument "other" for "__init_subclass__" of "object" [call-arg]
"""
19 changes: 19 additions & 0 deletions conformance/results/mypy/constructors_metaclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
conformant = "Partial"
notes = """
Does not evaluate the `__call__` method of the metaclass's own metaclass.
Incorrectly rejects a metaclass `__new__` method annotated to return a type other than a class.
"""
conformance_automated = "Fail"
errors_diff = """
Line 28: Unexpected errors ['constructors_metaclass.py:28: error: Expression is of type "Meta1", not "Never" [assert-type]']
Line 57: Unexpected errors ['constructors_metaclass.py:57: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "type") [misc]']
Line 67: Unexpected errors ['constructors_metaclass.py:67: error: Expression is of type "Meta3", not "int" [assert-type]', 'constructors_metaclass.py:67: error: Too many arguments for "Meta3" [call-arg]']
"""
output = """
constructors_metaclass.py:28: error: Expression is of type "Meta1", not "Never" [assert-type]
constructors_metaclass.py:47: error: Missing named argument "key" for "Meta2" [call-arg]
constructors_metaclass.py:48: error: Argument "key" to "Meta2" has incompatible type "str"; expected "int" [arg-type]
constructors_metaclass.py:57: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "type") [misc]
constructors_metaclass.py:67: error: Expression is of type "Meta3", not "int" [assert-type]
constructors_metaclass.py:67: error: Too many arguments for "Meta3" [call-arg]
"""
15 changes: 15 additions & 0 deletions conformance/results/mypy/constructors_type_constructor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
conformant = "Partial"
notes = """
Does not report a single-argument call to a subclass of `type`.
"""
conformance_automated = "Fail"
errors_diff = """
Line 29: Expected 1 errors
"""
output = """
constructors_type_constructor.py:30: error: No overload variant of "type" matches argument types "str", "tuple[()]" [call-overload]
constructors_type_constructor.py:30: note: Possible overload variants:
constructors_type_constructor.py:30: note: def type(object, /) -> type
constructors_type_constructor.py:30: note: def type(str, tuple[type, ...], dict[str, Any], /, **kwds: Any) -> type
constructors_type_constructor.py:52: error: Argument 1 to "MetaSingle" has incompatible type "str"; expected "int" [arg-type]
"""
16 changes: 16 additions & 0 deletions conformance/results/pycroscope/constructors_class_statements.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
conformant = "Partial"
notes = """
Does not honor the evaluated return type of the implied metaclass call when it isn't a class.
Does not validate keyword arguments in a class statement against the metaclass `__new__` method.
"""
conformance_automated = "Fail"
errors_diff = """
Line 56: Expected 1 errors
Line 60: Expected 1 errors
Line 85: Unexpected errors ["./constructors_class_statements.py:85:12: <class 'Class6'> is not equivalent to int"]
"""
output = """
./constructors_class_statements.py:69:28: Incompatible argument type for key: expected int but got Literal[''] [incompatible_argument]
./constructors_class_statements.py:85:12: <class 'Class6'> is not equivalent to int
./constructors_class_statements.py:93:4: Value of __prepare__ incompatible with base class type [incompatible_override]
"""
17 changes: 17 additions & 0 deletions conformance/results/pycroscope/constructors_init_subclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
conformant = "Partial"
notes = """
Does not validate class statement keyword arguments against `__init_subclass__`.
Incorrectly rejects a call to `type` with three positional arguments and additional keyword arguments.
"""
conformance_automated = "Fail"
errors_diff = """
Line 26: Expected 1 errors
Line 30: Expected 1 errors
Line 34: Expected 1 errors
Line 58: Expected 1 errors
Line 67: Unexpected errors ['./constructors_init_subclass.py:67:0: Cannot call overloaded function [incompatible_call]']
"""
output = """
./constructors_init_subclass.py:67:0: Cannot call overloaded function [incompatible_call]
./constructors_init_subclass.py:68:0: Cannot call overloaded function [incompatible_call]
"""
8 changes: 8 additions & 0 deletions conformance/results/pycroscope/constructors_metaclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
conformant = "Pass"
conformance_automated = "Pass"
errors_diff = """
"""
output = """
./constructors_metaclass.py:47:0: Missing required argument 'key' [incompatible_call]
./constructors_metaclass.py:48:23: Incompatible argument type for key: expected int but got Literal[''] [incompatible_argument]
"""
15 changes: 15 additions & 0 deletions conformance/results/pycroscope/constructors_type_constructor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
conformant = "Partial"
notes = """
Does not report a single-argument call to a subclass of `type`.
Does not evaluate the result of a single-argument call to `type` as `type[T]`.
"""
conformance_automated = "Fail"
errors_diff = """
Line 29: Expected 1 errors
Line 28: Unexpected errors ["./constructors_type_constructor.py:28:12: type 'int' is not equivalent to type[int]"]
"""
output = """
./constructors_type_constructor.py:28:12: type 'int' is not equivalent to type[int]
./constructors_type_constructor.py:30:0: Cannot call overloaded function [incompatible_call]
./constructors_type_constructor.py:52:11: Incompatible argument type for x: expected int but got Literal[''] [incompatible_argument]
"""
17 changes: 17 additions & 0 deletions conformance/results/pyrefly/constructors_class_statements.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
conformant = "Partial"
notes = """
Does not honor the evaluated return type of the implied metaclass call when it isn't a class.
Does not validate keyword arguments in a class statement against the metaclass `__new__` method.
"""
conformance_automated = "Fail"
errors_diff = """
Line 56: Expected 1 errors
Line 60: Expected 1 errors
Line 85: Unexpected errors ['assert_type(type[Class6], int) failed [assert-type]']
"""
output = """
ERROR constructors_class_statements.py:30:7-20: Class `ClassConflict` has metaclass `MetaA` from base class `BaseA` which is not compatible with metaclass `MetaB` from base class `BaseB` [invalid-inheritance]
ERROR constructors_class_statements.py:69:29-31: Argument `Literal['']` is not assignable to parameter `key` with type `int` in function `Meta1.__new__` [bad-argument-type]
ERROR constructors_class_statements.py:85:12-25: assert_type(type[Class6], int) failed [assert-type]
ERROR constructors_class_statements.py:93:9-20: Class member `Meta3.__prepare__` overrides parent class `type` in an inconsistent manner [bad-override]
"""
14 changes: 14 additions & 0 deletions conformance/results/pyrefly/constructors_init_subclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
conformant = "Partial"
notes = """
Does not validate keyword arguments against `object.__init_subclass__` in a class statement with no explicit base classes.
Does not validate keyword arguments against `__init_subclass__` when the metaclass defines an `__init__` method (but no `__new__` method).
"""
conformance_automated = "Fail"
errors_diff = """
Line 34: Expected 1 errors
Line 58: Expected 1 errors
"""
output = """
ERROR constructors_init_subclass.py:26:25-27: Argument `Literal['']` is not assignable to parameter `flag` with type `bool` in function `Base.__init_subclass__` [bad-argument-type]
ERROR constructors_init_subclass.py:30:20-25: Unexpected keyword argument `other` in function `Base.__init_subclass__` [unexpected-keyword]
"""
8 changes: 8 additions & 0 deletions conformance/results/pyrefly/constructors_metaclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
conformant = "Pass"
conformance_automated = "Pass"
errors_diff = """
"""
output = """
ERROR constructors_metaclass.py:47:6-19: Missing argument `key` in function `Meta2.__new__` [missing-argument]
ERROR constructors_metaclass.py:48:24-26: Argument `Literal['']` is not assignable to parameter `key` with type `int` in function `Meta2.__new__` [bad-argument-type]
"""
12 changes: 12 additions & 0 deletions conformance/results/pyrefly/constructors_type_constructor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
conformant = "Partial"
notes = """
Does not report a single-argument call to a subclass of `type`.
"""
conformance_automated = "Fail"
errors_diff = """
Line 29: Expected 1 errors
"""
output = """
ERROR constructors_type_constructor.py:30:5-14: No matching overload found for function `type.__new__` called with arguments: (type[type], Literal['A'], tuple[()]) [no-matching-overload]
ERROR constructors_type_constructor.py:52:12-14: Argument `Literal['']` is not assignable to parameter `x` with type `int` in function `MetaSingle.__new__` [bad-argument-type]
"""
20 changes: 20 additions & 0 deletions conformance/results/pyright/constructors_class_statements.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
conformant = "Partial"
notes = """
Does not honor the evaluated return type of the implied metaclass call when it isn't a class.
"""
conformance_automated = "Fail"
errors_diff = """
Line 85: Unexpected errors ['constructors_class_statements.py:85:13 - error: "assert_type" mismatch: expected "int" but received "type[Class6]" (reportAssertTypeFailure)']
"""
output = """
constructors_class_statements.py:30:7 - error: The metaclass of a derived class must be a subclass of the metaclasses of all its base classes
  Metaclass "MetaA" conflicts with "MetaB" (reportGeneralTypeIssues)
constructors_class_statements.py:56:35 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "int" in function "__new__"
  "Literal['']" is not assignable to "int" (reportArgumentType)
constructors_class_statements.py:60:7 - error: Argument missing for parameter "key" (reportGeneralTypeIssues)
constructors_class_statements.py:69:29 - error: Argument of type "Literal['']" cannot be assigned to parameter "key" of type "int" in function "__new__"
  "Literal['']" is not assignable to "int" (reportArgumentType)
constructors_class_statements.py:85:13 - error: "assert_type" mismatch: expected "int" but received "type[Class6]" (reportAssertTypeFailure)
constructors_class_statements.py:93:9 - error: Method "__prepare__" overrides class "type" in an incompatible manner
  Parameter "**kwds" has no corresponding parameter (reportIncompatibleMethodOverride)
"""
15 changes: 15 additions & 0 deletions conformance/results/pyright/constructors_init_subclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
conformant = "Pass"
conformance_automated = "Pass"
errors_diff = """
"""
output = """
constructors_init_subclass.py:26:7 - error: Incorrect keyword arguments for __init_subclass__ method (reportGeneralTypeIssues)
constructors_init_subclass.py:26:25 - error: Argument of type "Literal['']" cannot be assigned to parameter "flag" of type "bool" in function "__init_subclass__"
  "Literal['']" is not assignable to "bool" (reportArgumentType)
constructors_init_subclass.py:30:7 - error: Incorrect keyword arguments for __init_subclass__ method (reportGeneralTypeIssues)
constructors_init_subclass.py:30:20 - error: No parameter named "other" (reportCallIssue)
constructors_init_subclass.py:34:7 - error: Incorrect keyword arguments for __init_subclass__ method (reportGeneralTypeIssues)
constructors_init_subclass.py:34:14 - error: No parameter named "other" (reportCallIssue)
constructors_init_subclass.py:58:7 - error: Incorrect keyword arguments for __init_subclass__ method (reportGeneralTypeIssues)
constructors_init_subclass.py:58:40 - error: No parameter named "key" (reportCallIssue)
"""
9 changes: 9 additions & 0 deletions conformance/results/pyright/constructors_metaclass.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
conformant = "Pass"
conformance_automated = "Pass"
errors_diff = """
"""
output = """
constructors_metaclass.py:47:1 - error: Argument missing for parameter "key" (reportCallIssue)
constructors_metaclass.py:48:24 - error: Argument of type "Literal['']" cannot be assigned to parameter "key" of type "int" in function "__new__"
  "Literal['']" is not assignable to "int" (reportArgumentType)
"""
16 changes: 16 additions & 0 deletions conformance/results/pyright/constructors_type_constructor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
conformant = "Partial"
notes = """
Does not report a single-argument call to a subclass of `type`.
"""
conformance_automated = "Fail"
errors_diff = """
Line 29: Expected 1 errors
"""
output = """
constructors_type_constructor.py:30:1 - error: No overloads for "__new__" match the provided arguments
  Argument types: (Literal['A'], tuple[()]) (reportCallIssue)
constructors_type_constructor.py:30:1 - error: No overloads for "__init__" match the provided arguments
  Argument types: (Literal['A'], tuple[()]) (reportCallIssue)
constructors_type_constructor.py:52:12 - error: Argument of type "Literal['']" cannot be assigned to parameter "x" of type "int" in function "__new__"
  "Literal['']" is not assignable to "int" (reportArgumentType)
"""
Loading
Loading