You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
types_parser: NamedTuple, __new__-only classes, NewType and type aliases cannot be wired #571
This was generated by AI during a pre-4.0 audit of main at 9cd88e7.
Observation (reproduced)
class NT(NamedTuple): a: A and Factory(NT) fail with "Argument a has no usable type annotation". Hints come from get_type_hints(creator.__init__) (types_parser.py:110), which is object.__init__ here, while inspect.signature reads __new__. Same for any class that defines only __new__. The message is wrong too: there is an annotation.
UserId = NewType("UserId", int): a provider with bound_type=UserId resolves via resolve(UserId), but def f(uid: UserId) fails with "no usable type annotation" (types_parser.py:51 accepts only isinstance(type_, type)). Same for PEP 695 type X = ... aliases.
Suspected, not reproduced: a creator returning A | B gets bound_type=None and is skipped at registration with no warning. Verify.
Cleanup in the same file
hasattr(type_, "__metadata__") should be get_origin(...) is Annotated; hasattr(creator, "__init__") (:109) is always true; the branch at :44->54 is unreachable (None | None handled at :23); narrating comments at :27,33,47,129-130,140.
Acceptance
Failing tests first for each type form; the "no usable type annotation" message only appears when there is none.
Activity
fix!: wire NamedTuple, __new__-only classes, NewType and type aliases (…