Node lifetime is shorter than expected due to let variable inlining
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
Fix Released
|
High
|
Markos Zaharioudakis |
Bug Description
A query like
let $x:=<a/>
return by-ref(ref($x))
gets rewritten (in some case, depending on the complexity of the expression and number of references to the variable) as:
by-ref(ref(<a/>))
Thus the node has been destroyed when by-ref is called.
The following test named reference_5.xq:
import module namespace idd = "http://
import module namespace id = "http://
import module namespace doc = "http://
variable $node:=
fn:put(
<result>
<temporary-
<temporary-
let $temp:=
return
let $ref:=id:
return
id:node-
}</temporary-
<temporary-
for $i in (1 to 3)
let $temp:=
let $ref:=id:
return
id:node-
}</temporary-
<temporary-
</result>
Should return:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<temporary-
<root>
</temporary-
<temporary-
<root>
</temporary-
<temporary-
<root>
<root>
<root>
</temporary-
<temporary-
<root>
</temporary-
</result>
Instead it returns:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<temporary-
<temporary-
<temporary-
<temporary-
</result>
Changed in zorba: | |
assignee: | nobody → Markos Zaharioudakis (markos-za) |
importance: | Undecided → Medium |
Changed in zorba: | |
importance: | Medium → High |
Changed in zorba: | |
milestone: | none → 2.7 |
Changed in zorba: | |
milestone: | 2.7 → 3.0 |
Changed in zorba: | |
milestone: | 3.0 → 2.8 |
Changed in zorba: | |
status: | New → Fix Committed |
Changed in zorba: | |
status: | Fix Committed → Fix Released |