Skip to content

Commit e86d37f

Browse files
committed
Allow error on incorrect implicit argument to zero-argument super()
1 parent 7bf2409 commit e86d37f

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

conformance/results/mypy/constructors_call_metaclass.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ conformance_automated = "Fail"
77
errors_diff = """
88
Line 26: Unexpected errors ['constructors_call_metaclass.py:26: error: Expression is of type "Class1", not "Never" [assert-type]', 'constructors_call_metaclass.py:26: error: Missing positional argument "x" in call to "Class1" [call-arg]']
99
Line 39: Unexpected errors ['constructors_call_metaclass.py:39: error: Expression is of type "Class2", not "int | Meta2" [assert-type]', 'constructors_call_metaclass.py:39: error: Missing positional argument "x" in call to "Class2" [call-arg]']
10-
Line 46: Unexpected errors ['constructors_call_metaclass.py:46: error: Argument 2 for "super" not an instance of argument 1 [misc]']
1110
"""
1211
output = """
1312
constructors_call_metaclass.py:26: error: Expression is of type "Class1", not "Never" [assert-type]

conformance/results/results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ <h3>Python Type System Conformance Test Results</h3>
732732
<th class="column col2 conformant">Pass</th>
733733
<th class="column col2 conformant">Pass</th>
734734
<th class="column col2 conformant">Pass</th>
735-
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Emits a diagnostic if `super().__call__()` is called in an overridden `__call__` method on a subclass of `type` and the first argument of the overridden `__call__` method is annotated with `type[T]` where `T` is a type variable with no upper bound.</p></span></div></th>
735+
<th class="column col2 conformant">Pass</th>
736736
</tr>
737737
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;constructors_call_new</th>
738738
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not support __new__ return type that is not a subclass of the class being constructed.</p><p>Does not skip evaluation of __init__ based on __new__ return type.</p><p>Does not report errors during binding to cls parameter of __new__ method.</p></span></div></th>

conformance/results/ty/constructors_call_metaclass.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
conformance_automated = "Fail"
2-
conformant = "Partial"
1+
conformance_automated = "Pass"
2+
conformant = "Pass"
33
notes = """
4-
Emits a diagnostic if `super().__call__()` is called in an overridden `__call__` method on a subclass of `type` and the first argument of the overridden `__call__` method is annotated with `type[T]` where `T` is a type variable with no upper bound.
54
"""
65
errors_diff = """
7-
Line 46: Unexpected errors ["constructors_call_metaclass.py:46:16: error[invalid-super-argument] `type[T@__call__]` is not an instance or subclass of `<class 'Meta3'>` in `super(<class 'Meta3'>, type[T@__call__])` call"]
86
"""
97
output = """
108
constructors_call_metaclass.py:46:16: error[invalid-super-argument] `type[T@__call__]` is not an instance or subclass of `<class 'Meta3'>` in `super(<class 'Meta3'>, type[T@__call__])` call

conformance/tests/constructors_call_metaclass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __new__(cls, x: int) -> Self:
4343

4444
class Meta3(type):
4545
def __call__(cls: type[T], *args, **kwargs) -> T:
46-
return super().__call__(*args, **kwargs)
46+
return super().__call__(*args, **kwargs) # E?: type[T] is not an instance or subclass of `Meta3`
4747

4848

4949
class Class3(metaclass=Meta3):

0 commit comments

Comments
 (0)