overloads_evaluation
error
Overload union expansion failure
When a function-body call passes a union-typed argument to an overloaded function and, after expanding the union, at least one member fails to match any overload signature, Basilisk reports the error.
@overload
def example(x: int, y: str, z: int) -> str: ...
@overload
def example(x: int, y: int, z: int) -> int: ...
def example(x: int, y: int | str, z: int) -> int | str:
return 1
def check(v: int | str) -> None:
example(v, v, 1) # E -- str not assignable to int in any overload
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
overloads_evaluation 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_evaluation