overloads_basic error

No matching overload for subscript indexing

When a class defines overloaded __getitem__ methods and a module-level subscript expression (e.g. b"") passes an argument whose type is incompatible with all overload signatures, Basilisk reports the error.

from typing import overload

class Bytes:
    @overload
    def __getitem__(self, __i: int) -> int: ...
    @overload
    def __getitem__(self, __s: slice) -> bytes: ...
    def __getitem__(self, __i_or_s: int | slice) -> int | bytes: ...

b = Bytes()
b[""]  # E0072 -- no overload of __getitem__ accepts str

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial overloads_basic down per-file or per-path from your editor or pyproject.toml, or fix the code so it type-checks. See the Type System rules and the complete diagnostic reference.

Canonical URL: https://www.basilisk-python.dev/errors/overloads_basic