Skip to content

Commit c497205

Browse files
committed
docs ✏️ summarize more
1 parent 73f3547 commit c497205

File tree

1 file changed

+12
-56
lines changed

1 file changed

+12
-56
lines changed

src/json-path/__context__/rfc9535-short.txt

Lines changed: 12 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,62 +1170,18 @@ Example: $ applied to {"k": "v"} returns [{"k": "v"}]
11701170

11711171
2.4.3. Well-Typedness of Function Expressions
11721172

1173-
For a function expression to be well-typed:
1174-
1175-
1. Its declared type must be well-typed in the context in which it
1176-
occurs.
1177-
1178-
As per the grammar, a function expression can occur in three
1179-
different immediate contexts, which lead to the following
1180-
conditions for well-typedness:
1181-
1182-
As a test-expr in a logical expression:
1183-
The function's declared result type is LogicalType or (giving
1184-
rise to conversion as per Section 2.4.2) NodesType.
1185-
1186-
As a comparable in a comparison:
1187-
The function's declared result type is ValueType.
1188-
1189-
As a function-argument in another function expression:
1190-
The function's declared result type fulfills the following
1191-
rules for the corresponding parameter of the enclosing
1192-
function.
1193-
1194-
2. Its arguments must be well-typed for the declared type of the
1195-
corresponding parameters.
1196-
1197-
The arguments of the function expression are well-typed when each
1198-
argument of the function can be used for the declared type of the
1199-
corresponding parameter, according to one of the following
1200-
conditions:
1201-
1202-
* When the argument is a function expression with the same
1203-
declared result type as the declared type of the parameter.
1204-
1205-
* When the declared type of the parameter is LogicalType and the
1206-
argument is one of the following:
1207-
1208-
- A function expression with declared result type NodesType.
1209-
In this case, the argument is converted to LogicalType as
1210-
per Section 2.4.2.
1211-
1212-
- A logical-expr that is not a function expression.
1213-
1214-
* When the declared type of the parameter is NodesType and the
1215-
argument is a query (which includes singular query).
1216-
1217-
* When the declared type of the parameter is ValueType and the
1218-
argument is one of the following:
1219-
1220-
- A value expressed as a literal.
1221-
1222-
- A singular query. In this case:
1223-
1224-
o If the query results in a nodelist consisting of a
1225-
single node, the argument is the value of the node.
1226-
1227-
o If the query results in an empty nodelist, the argument
1228-
is the special result Nothing.
1173+
Function expressions must be well-typed:
1174+
1175+
1. Declared type must match context:
1176+
- As test-expr: LogicalType or NodesType
1177+
- As comparable: ValueType
1178+
- As function-argument: Must fulfill parameter type rules
1179+
1180+
2. Arguments must match parameter types:
1181+
- Function expression: Same declared result type as parameter
1182+
- LogicalType parameter accepts: NodesType function (converted), logical-expr
1183+
- NodesType parameter accepts: Any query
1184+
- ValueType parameter accepts: Literals, singular queries (single node→value, empty→Nothing)
12291185

12301186
2.4.4. length() Function Extension
12311187

0 commit comments

Comments
 (0)