BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
694 stars 265 forks source link

Focus Optimization: node expected, xs:integer found #2335

Closed ChristianGruen closed 2 months ago

ChristianGruen commented 2 months ago
declare function local:a($e, $v) {
  if ($e) then local:a($e, 0)
};
declare function local:b($e, $v) {
  local:a($e, $v)
};
<a/> ! (local:b(x, random:integer()))

Expected: empty sequence

Apparently, the context value is inlined multiple times. This is the optimized expression:

declare function local:a($e, $v) { if($e) { local:a($e, 0) } };
random:integer() -> local:a(x, .)