reportImplicitOverride.md
April 8, 2026 · View on GitHub
Overview
reportImplicitOverride is a diagnostic in Pylance and Pyright that warns when a method or attribute in a subclass implicitly overrides a member from a superclass without an explicit @override decorator. This helps ensure that overrides are intentional and clear, reducing the risk of accidental bugs.
Representative Issues
- #5200: Provide a configuration setting to allow users to customize diagnostic rule severities based on the type checking mode, improving the granularity of error reporting.
- #5887: Ensure that classes inheriting from abstract base classes implement all abstract methods.
- #7192: Avoid redeclaring variables with the same type to prevent shadowing and ensure clear variable identification.
- #7193: After an
isinstancecheck, set the variable to the correct type to avoid false positives. - #7281: Ensure protected members are accessed only from within the class or subclasses.
- #7328: Ensure overridden methods in subclasses call the parent method if required.
- #7624: Ensure type comparisons are clear and explicit.
Examples
class Base:
def method1(self):
pass
class Child(Base):
# Warning: Method "method1" overrides class "Base" without
# an explicit @override decorator
def method1(self):
pass
Fix — add the @override decorator:
from typing import override # Python 3.12+, or typing_extensions
class Child(Base):
@override
def method1(self):
pass
Common Fixes & Workarounds
- Use the
@overridedecorator when overriding methods or attributes from a superclass. - Double-check that overrides are intentional and not accidental name collisions.
- Implement all required abstract methods in subclasses.
- Review the Pyright configuration documentation for options to adjust or suppress this diagnostic if needed.
See Also
python.analysis.diagnosticSeverityOverrides— adjust or suppress this diagnosticpython.analysis.typeCheckingMode— controls which diagnostics are enabled by default