basedpyright
basedpyright copied to clipboard
no error when using `@final` decorator on a method in a `Protocol`
Code sample in basedpyright playground
from typing import Protocol, final, override
class Foo(Protocol):
@final
def foo(self): ...
class Bar(Foo):
@override
def foo(self): # error: can't override foo
...
class Baz(Foo): ... # error: didn't implement foo
note that this is "implementing" the protocol not "extending" it, which is different, see https://github.com/DetachHead/basedpyright/issues/294#issuecomment-2611489040