Skip to content

Extend KnownFunction machinery to work with class methods #1447

@dcreager

Description

@dcreager

KnownFunction lets us detect particular functions that need to be handled specially in our type inference logic. We use this for things like is_subtype_of, to implement "evaluation" rules that are visible in the inferred return type of the function.

With our constraint set work, ty_extensions is become more complex, and now has a ConstraintSet type that we use in some return type annotations, and which has overridden dunder method for things like rich comparison and bool coercion.

There are also some functions that would ideally be implemented as methods on ConstraintSet. (And more are in the works!) But those are currently implemented as top-level functions in the ty_extensions module, since that is what works with our KnownFunction machinery.

It would be nice to extend KnownFunction to work with class methods too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions