Skip to content

Cannot use T as type int in array #796

Open

Description

@loggerhead

I have read the document several times but still can't understand where the usage issues are. Could you please help take a look?

https://go.dev/play/p/LwYtRm2NuXM

Image

Activity

  1. seruman commented on May 30, 2025

    @seruman

    Looks like #632

  2. antonmedv commented on May 30, 2025

    @antonmedv
    Member

    Yes, this is by design.

    type Platform int
    

    In internal golang representation, Platform is different from the int. Although Expr does automative type conversions for ints, in this case you will need to case to int explisitly:

    int(platform) in [1, 2]

    Explanation about why Golang behaves this way: #632 (comment)

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