Skip to content

Unexpected map key type conversion #862

Description

@halvfigur

It seems map keys that aren't strings get implicitly converted to string. For example, the following expressions fail unexpectedly

1 in { 1: 0 }

Error:
cannot use int as type string in map key (1:3)
 | 1 in {1: 0}
 | ..^
{ 1: 0 }[1]

Error:
cannot use int to get an element from map[string]interface {} (1:8)
 | {1: 0}[1]
 | .......^

This expression evaluates to true

{1: 0} | keys() | first() | type() == "string"

Activity

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