Skip to content

ALL-OVER0001 · overriding_method_accepts_different_arguments

Count overriding methods that stopped accepting what the method they replace accepts.

This is a deterministic rule for all languages. Read its implementation.

Read every member a base declares beside the declaration the subclass writes for it, and report an override a caller written against the base can no longer reach. Four changes count. A dropped position leaves an argument with nowhere to go. An added position with no default demands one nobody knew to pass. A keyword-only parameter that appeared, vanished, or changed its name is reached by that name alone, so any of the three deletes it. A *args or **kwargs tail the base offered and the override dropped stops swallowing everything else.

Inheritance is a promise that an instance of the subclass goes wherever an instance of the base goes, and each of these breaks that promise in the one place nobody looks. The call site holds a base reference, passes what the base documents, and fails at runtime inside a subclass it never named. The base is almost always in another file, so nothing but a resolved inheritance chain finds the declaration this one replaces.

Continue with evidence and references, or open the examples.