Skip to content

(🐞) [1.15 REGRESSION] tuple fallback reports any expression #18770

Description

@KotlinIsland
# mypy: allow-any-expr=False
a: tuple[int, int]
print(a[:]) # Expression type contains "Any" (has type "tuple[int, int]")  [misc]

playground

Activity

  1. sterliakov commented on Mar 8, 2025

    @sterliakov
    Collaborator

    Exposed by #18585. At some point fallback is constructed as self.named_type("builtins.tuple") (there are several such places) and wrong Any (from_omitted_generics) ends up in slice tuple_fallback.

    Minimal repro:

    a: tuple[int, int]
    print(a[:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-disallow-anyThe disallow-any-* family of flags

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions