Skip to content

Emit diagnostic for unimplemented abstract method on @final class #2525

@vepain

Description

@vepain

Summary

ty does not return any error when a class decorated with @final does not implement a inherited abstract method.

The same false negative is observed when class A is a Protocol.

from abc import ABC, abstractmethod
from typing import final

class A(ABC):
    @abstractmethod
    def foo(self) -> int:
        raise NotImplementedError

@final 
class B(A):  # should error: abstract method foo not implemented
    pass

if __name__ == "__main__":
    b = B()  # should also error 
    b.foo()  # also?

Version

  • Python 3.13
  • ruff 0.14.13
  • ty 0.0.12

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions