returns_compatibility_2 error

Return type mismatch — inferred return type incompatible with annotation

When a function has a return type annotation, the inferred return type must be assignable to the declared type. This extends the original -> None check to handle all return type mismatches using the inference system.

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial returns_compatibility_2 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/returns_compatibility_2