Skip to content

Result of max with key=len is always Sized #2572

Description

@druzsan

Summary

In the following code I search the longest element in a collection (I tried values of a dict and list):

xs: list[list[str]] = [["foo", "bar"], ["baz", "qux", "quux"]]

x = max(xs, key=len)
reveal_type(x)

I expect x to be revealed as list[str], but it is revealed as Sized.

Am I missing something?

Command executed:

ty check --error-on-warning

No other settings are applied to ty.

Version

0.0.12

Metadata

Metadata

Assignees

No one assigned

    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