Set loop index variable if not "_" (#3)

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2023-02-19 10:56:42 +05:30
parent 267b76e4d3
commit 2a1924efa5
2 changed files with 72 additions and 25 deletions

View File

@@ -0,0 +1,23 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: basic
data: {}
modules:
- |
package test
x1 = y {
y = [ [a, b] | a = [1, 2, 3, 4][b] ]
}
x2 = y {
y = [ [a, b] | a = {1, 2, 3, 4}[b] ]
}
x3 = y {
y = [ [a, b] | a = {"p":"q", "r": "s"}[b] ]
}
query: data.test
want_result:
x1: [[1, 0], [2, 1], [3, 2], [4, 3]]
x2: [[1, 1], [2, 2], [3, 3], [4, 4]]
x3: [["q", "p"], ["s", "r"]]