Skip to content

Distinguish "missing" constraint set lower/upper bounds from Never and object #3558

Description

@dcreager

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].

Metadata

Metadata

Assignees

Labels

genericsBugs or features relating to ty's generics implementation

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions