mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
73 lines
1.8 KiB
YAML
73 lines
1.8 KiB
YAML
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
cases:
|
|
- note: basic
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
import future.keywords
|
|
|
|
r1 = value {
|
|
value = p + a[0] # p and a are defined later
|
|
q = p # q depends on p; p depends on q
|
|
q = t[0] # t is defined at end
|
|
a = [ t[i] | # a uses a compr which depends on t
|
|
i := 1
|
|
]
|
|
t = [8, 4]
|
|
}
|
|
|
|
query: data.test
|
|
want_result:
|
|
r1: 12
|
|
|
|
- note: input-dependency
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
|
|
default p = null
|
|
p = input.p
|
|
|
|
q {
|
|
input.p
|
|
true
|
|
}
|
|
|
|
r1 = s {
|
|
# Dependency on null input before erroring stmt.
|
|
input.p
|
|
s = concat("", ["", p])
|
|
}
|
|
|
|
#r2 = s {
|
|
# s = concat("", ["", p])
|
|
# # Dependency on null input after erroring stmt.
|
|
# # This doesn't reordered before assignment to s
|
|
# # since s also has no other local var dependency.
|
|
# # The written order of statements is preserved.
|
|
# input.p
|
|
#}
|
|
|
|
r3 = s {
|
|
# Indirect dependency on null input before erroring stmt.
|
|
q
|
|
s = concat("", ["", p])
|
|
}
|
|
|
|
#r3 = s {
|
|
# s := concat("", ["", p])
|
|
# # Indirect dependency on null input after erroring stmt.
|
|
# # This doesn't reordered before assignment to s
|
|
# # since s also has no other local var dependency.
|
|
# # The written order of statements is preserved.
|
|
# input.p
|
|
# q
|
|
#}
|
|
|
|
query: data.test
|
|
want_result:
|
|
p: null
|