← 输入框|github.com|刷新
Skip to content

Add strict type checking in tuple #433

Closed

Description

@namannimmo10
def main():
  t: tuple[i32, str]
  t = (1, 2)

main()

This will generate an ASR, but actually should give an error that the second element is expected to be of str type.

Activity

  1. namannimmo10 commented on Apr 30, 2022

    @namannimmo10
    CollaboratorAuthor

    Same goes for dictionaries:

    def main():
      d: dict[i32, i32]
      d = {1: "a", 2: "b"}
    
    main()
  2. yashsain commented on May 3, 2022

    @yashsain
    Contributor

    hey, I'd like to work on this. I am relatively new to open source, so can you please guide me a bit as to how to proceed. Thanks

  3. certik commented on May 3, 2022

    @certik
    Contributor

    See #439 which fixes something similar for lists. You have to implement a similar logic for tuples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions