Conditional exprs are not path exprs (fix #1368)

The conditional expression in if-then-elif-else-end cannot contribute to
path expressions because it doesn't change the input to any of the then/
elif/else expressions.  These must be generated via gen_subexp().

See also #1366.
This commit is contained in:
Nicolas Williams committed 2017-03-15 01:07:37 -05:00
1 parent 674e9fb7c2
commit b142d484d5
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -1382,4 +1382,9 @@ true
{"a":null,"b":null}
{"a":null,"b":"b"}
# Regression test for #1368
(.. | select(type == "object" and has("b") and (.b | type) == "array")|.b) |= .[0]
{"a": {"b": [1, {"b": 3}]}}
{"a": {"b": 1}}