generics_basic_3 error

Generic type argument violations

Detects several generic-type errors:

1. **Constrained TypeVar constraint mismatch**: When a function parameter is typed with a constrained TypeVar (e.g. AnyStr = TypeVar("AnyStr", str, bytes)), all arguments bound to the same type variable must belong to the same constraint. Passing (str_val, bytes_val) for (x: AnyStr, y: AnyStr) is an error.

2. **Mapping subscript key type mismatch**: When a Mapping-derived type has a known key type (e.g. MyMapstr, int), indexing with a literal of the wrong type (e.g. my_map0) is an error.

3. **Generic metaclass usage**: Using a parameterized generic class as a metaclass (metaclass=SomeGenericT) is not supported by the Python type system.

How to handle it

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