basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

`reportAbstractUsage` conflicts with `reportMissingSuperCall`

Open DetachHead opened this issue 2 years ago • 1 comments

from abc import abstractmethod
from typing import override


class Foo:
    @abstractmethod
    def __enter__(self) -> None: ...

class Bar(Foo):
    @override
    def __enter__(self) -> None: # error: Method "__enter__" does not call the method of the same name in parent class (reportMissingSuperCall)
        ...

attempting to fix this triggers reportAbstractUsage:

class Bar(Foo):
    @override
    def __enter__(self) -> None:
        super().__enter__() # error: Method "__enter__" cannot be called because it is abstract and unimplemented (reportAbstractUsage)

playground

https://github.com/microsoft/pyright/issues/7328

DetachHead avatar Feb 24 '24 13:02 DetachHead

related: #120

DetachHead avatar May 02 '24 08:05 DetachHead