You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Conformance: test @OverRide checks on __init__ and __new__
The @OverRide spec requires the overriding method to be assignable to the
overridden one, with no exemption for __init__/__new__. Add cases to
classes_override.py covering compatible overrides (no error), incompatible
overrides decorated with @OverRide (error), and incompatible overrides
without @OverRide (allowed). Score results: pyrefly conforms; mypy, pyright,
pycroscope, ty, and zuban do not currently honor the check for constructors.
Closes#2222
Copy file name to clipboardExpand all lines: conformance/results/pyrefly/classes_override.toml
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,4 +8,6 @@ ERROR classes_override.py:57:9-16: Class member `ChildA.method4` is marked as an
8
8
ERROR classes_override.py:79:9-23: Class member `ChildA.static_method1` is marked as an override, but no parent class has a matching attribute [bad-override]
9
9
ERROR classes_override.py:84:9-22: Class member `ChildA.class_method1` is marked as an override, but no parent class has a matching attribute [bad-override]
10
10
ERROR classes_override.py:89:9-18: Class member `ChildA.property1` is marked as an override, but no parent class has a matching attribute [bad-override]
11
+
ERROR classes_override.py:135:9-17: Class member `ChildC2.__init__` overrides parent class `ParentC` in an inconsistent manner [bad-override]
12
+
ERROR classes_override.py:138:9-16: Class member `ChildC2.__new__` overrides parent class `ParentC` in an inconsistent manner [bad-override]
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not honor `@override` compatibility checks for `__init__` and `__new__`:</p><p>the incompatible constructor overrides in `ChildC2` are not flagged.</p></span></div></th>
568
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not honor `@override` compatibility checks for `__init__` and `__new__`:</p><p>the incompatible constructor overrides in `ChildC2` are not flagged.</p></span></div></th>
569
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not honor `@override` compatibility checks for `__init__` and `__new__`:</p><p>the incompatible constructor overrides in `ChildC2` are not flagged.</p></span></div></th>
567
570
<thclass="column col2 conformant">Pass</th>
568
-
<thclass="column col2 conformant">Pass</th>
569
-
<thclass="column col2 conformant">Pass</th>
570
-
<thclass="column col2 conformant">Pass</th>
571
-
<thclass="column col2 conformant">Pass</th>
572
-
<thclass="column col2 conformant">Pass</th>
571
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not honor `@override` compatibility checks for `__init__` and `__new__`:</p><p>the incompatible constructor overrides in `ChildC2` are not flagged.</p></span></div></th>
572
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not honor `@override` compatibility checks for `__init__` and `__new__`:</p><p>the incompatible constructor overrides in `ChildC2` are not flagged.</p></span></div></th>
0 commit comments