problems with unordered map

Bug #872234 reported by Daniel Turcanu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
Undecided
Markos Zaharioudakis

Bug Description

I guess there's a problem with the optimizer.
Try the following code:

import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";

declare namespace ann = "http://www.zorba-xquery.com/annotations";
declare variable $local:processed-internal-links := xs:QName("processed-internal-links");

declare %ann:sequential function local:f1($n as xs:string)
{
  map:insert($local:processed-internal-links, $n, $n);
  fn:trace($n, "n=");

  for $x in ("1", "2", "3")
  return
    if(fn:empty(map:get($local:processed-internal-links, $x))) then
      local:f1($x)
    else
      ()
};

map:create($local:processed-internal-links, xs:QName("xs:string"));

local:f1("0")

It should display 0 1 2 3
But it displays 0 1 2 3 3 2 3

Changed in zorba:
assignee: nobody → Markos Zaharioudakis (markos-za)
Changed in zorba:
status: New → Fix Committed
milestone: none → 2.5
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.