Skip to content

generics with circular dependency through bound typevar do not resolve signatures correctly #1280

@xhantu

Description

@xhantu

Describe the Bug

Checked code

Multiple generics with type variables bound to the generics so that circular dependencies are created.
See sandbox link.

Observed behavior

Error `Object of class `object` has no attribute `f` [missing-attribute]

The signatures of the the bound types do not seem to be fully build when the type check is performed.

Which signatures are available seems to be related to the order of the used type definitions and not the order of the definitions of the generics.

Expected behavior

No error.

Further info

Also fails if bound types are not defined explicitly on there own but used directly when defining the type vars. See additional sandbox link.

This may be related to #177

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEALqcROgOZ0Q3G6UN0AqADroRIpsRh0A4gH0AgnQC8deQG156UgBpVWgLrjmUuQCFldUxq27NpQ%2BgknZAYQsvrOvfbHoAxlCocHCqagAqAGqypogy0bqRrrFyLvqIvnSZdJgwYHSysqwQDAUAFHAwUGC62LGJprp%2BdVEuAJR0ALQAfHQAcrjoMOnoWaN02IRgpa0iY1l%2Bk9MZWTl5UxVV7d19A0Ozc3TEQXC%2BAceW4VHyyQoJLTepw-uZq-mF6MVlG9V0qM23dCadESbU6PX6g2GB1%2BixmIwOCymcOe2VydHWlTAW3BuyhByOwVOgWCdA8iWucXkd2iN1MaWWLzRBSKJVk5Uxuj%2BwKuNX%2BpmxO0hKNGqFhwqyEyRDNRa3ZmzBgr28LmBJO6BA2hAZEouSgpEIDFoUAoAGI6AAFUg6sB6uhoLB4fCAgaQNgAV0oqAYEAGhBEZoAyjApAALBgMYhwRAAemj2t1%2Bt4bGjMHQ0cwuD8cGjfhdEHdnu9A2j6N4vwAbqhoKhsLBnehXR6vT6RrhiEX0HA-egyAwQwMOuWYJQ4C2LEIQABmQgARgATBORCAAL6a1B%2Bb1DgBi0BgFHtOAIJHIy6AA

(Only applicable for extension issues) IDE Information

No response

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