Commit 8c4fbfa
[bugfix] SequenceType: restrict function-arity check to function() typed tests
Commit 0d96ad8 added function-arity + return-type checking in
SequenceType.checkType under Type.subTypeOf(primaryType, Type.FUNCTION).
Because MAP_ITEM and ARRAY_ITEM are declared subtypes of FUNCTION, the
arity check also applied to typed map(K,V) and array(T) tests -- but
the underlying map accessor signature carries one argument (the key),
while map(K,V) carries two type parameters in the test syntax. The
arity comparison therefore always returned false, so any
"$x instance of map(xs:string, item()?)" check failed and the value
flowed down the else branch unchanged. Concretely this caused the
xquery3 recursion-function-calls-002 test to fail with FOTY0013
("A function item other than an array cannot be atomized") when the
recursive local:join was bypassed and a raw map landed inside
string-join.
Narrow the function-type check to primaryType == Type.FUNCTION so the
plain function() typed-test still gets validated (including on map and
array values that satisfy it via FUNCTION subtyping), while map(K,V)
and array(T) tests revert to their pre-0d96ad8a19 behaviour pending
proper typed-test support.
Also: update the id.xqm securitymanager fixture's stored module from
'xquery version "3.0"' to "3.1" so that the stricter loaded-module
version check added in 7966280 no longer rejects it.
Addresses Juri's second review comment on PR #6344 (recursion-function-
calls-002 failure).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 69ef1f7 commit 8c4fbfa
2 files changed
Lines changed: 9 additions & 3 deletions
File tree
- exist-core/src
- main/java/org/exist/xquery/value
- test/xquery/securitymanager
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
182 | 188 | | |
183 | 189 | | |
184 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
0 commit comments