In the below example we expect pyright to flag all 3 overrides as violations due to all methods decorated with @final in the base-class. However, only simple is flagged:
from functools import cache
from typing import final
class Parent:
@final
def simple(self):
...
@final
@cache
def final_over_cache(self):
...
@cache
@final
def cache_over_final(self):
...
class Child(Parent):
def simple(self):
...
@cache
def final_over_cache(self):
...
@cache
def cache_over_final(self):
...
Output:
>pyright pyright_final.py
pyright_final.py
pyright_final.py:24:9 - error: Method "simple" cannot override final method defined in class "Parent" (reportIncompatibleMethodOverride)
1 error, 0 warnings, 0 informations
Version information:
Python 3.10.11
pyright 1.1.401
In the below example we expect pyright to flag all 3 overrides as violations due to all methods decorated with
@finalin the base-class. However, onlysimpleis flagged:Output:
Version information:
Python 3.10.11
pyright 1.1.401