SIGN IN SIGN UP

Improve fixed_dictionaries type annotations

Accept Mapping rather than invariant dict so type-checkers can infer the
value type when strategies are heterogeneous (e.g. a mapping annotated as
dict[str, SearchStrategy[int] | SearchStrategy[str]]).

Overload the function so mapping and optional contribute independent key
and value typevars, unioned in the result: fixed_dictionaries({"a":
booleans()}, optional={1: integers()}) is now inferred as
SearchStrategy[dict[str | int, bool | int]]. A dedicated Mapping[NoReturn,
NoReturn] overload keeps the optional-only case precise.

FixedDictStrategy now honestly types itself as SearchStrategy[Mapping],
since type(mapping)(pairs) may return any Mapping subclass, with a single
cast to dict at the public fixed_dictionaries boundary.

https://claude.ai/code/session_01GGWSpKXv1sihrTexfxyxBo
C
Claude committed
dfb5456e22662ab93ec2caa7dd2b679b5ec28173
Parent: b534eab