Our representation of individual constraints in a constraint set currently encodes “no lower bound” as Never and “no upper bound” as object. This causes ambiguity: a real Never lower bound can be confused with absence of lower-bound information. generics.rs has a temporary heuristic to avoid selecting Never or object too eagerly; generics/pep695/functions.md has TODOs where Never ≤ R from a no-return constructor is confused with “R has no lower bound,” leading to Unknown instead of Never in some callable/generic contexts.
Introduce a representation or extraction layer that preserves bound presence explicitly. This should remove the heuristic in solve_pending_with, clarify PathBounds::default_solve, and make it safer to delete the HashMap fallback in item 1. It also directly addresses mdtest TODOs for ClassWithNoReturnMetatype and Task[(x: int), Never].
Our representation of individual constraints in a constraint set currently encodes “no lower bound” as
Neverand “no upper bound” asobject. This causes ambiguity: a realNeverlower bound can be confused with absence of lower-bound information.generics.rshas a temporary heuristic to avoid selectingNeverorobjecttoo eagerly;generics/pep695/functions.mdhas TODOs whereNever ≤ Rfrom a no-return constructor is confused with “R has no lower bound,” leading toUnknowninstead ofNeverin some callable/generic contexts.Introduce a representation or extraction layer that preserves bound presence explicitly. This should remove the heuristic in
solve_pending_with, clarifyPathBounds::default_solve, and make it safer to delete the HashMap fallback in item 1. It also directly addresses mdtest TODOs forClassWithNoReturnMetatypeandTask[(x: int), Never].