BSK-E0129
error
Literal value assignment incompatibility
Detects two classes of Literal-related assignment errors inside function bodies:
1. **Literal0 vs LiteralFalse non-equivalence (PEP 586)**: Literal0 and LiteralFalse are distinct types despite 0 == False in Python. Assigning a Literal0-typed parameter to a LiteralFalse local (or vice versa) is a type error.
2. **Augmented assignment widens a Literal type**: a += 3 where a is typed Literal3, 4, 5 produces an int result, which is not assignable back to Literal3, 4, 5.
def func(a: Literal[0], b: Literal[False]):
x1: Literal[False] = a # E — int 0 ≠ bool False in Literal
x2: Literal[0] = b # E — bool False ≠ int 0 in Literal
def func2(a: Literal[3, 4, 5]):
a += 3 # E — result type is `int`, not `Literal[3, 4, 5]`
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
BSK-E0129 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/BSK-E0129