Leo,
You are right, there was a type error in my code, thx a lot for pointing it out. I am recomputing the "profile" result of your code with full inlining.
Cheers, Jean-Marc
2013/12/29 Leo Wörteler lw@basex.org
Dear Jean-Marc,
Am 29.12.2013 13:09, schrieb jean-marc Mercier:
@Leo, there might be a bug in the BaseX INLINER (I am currently
profiling your module https://github.com/LeoWoerteler/xq-modules/).
thanks first for looking at my code!
With these settings, I am raising a [XPTY0004] Single item expected
error.
The behavior *with* inlining is actually the correct one. There is a type error in your code that is not reported unless some functions are inlined.
You declare function parameters in your `idmap` module as `$idmap as function() as function(*)`, which means that `$idmap` must be bound to a function item with no arguments that returns a *single* function item with arbitrary arity. The functions you bind to those parameters however actually return *two* function items, namely the two elements of a pair. A correct type would thus be `$idmap as function() as function(*)+`.
The actual bug is that this type is not always checked if the function item is not inlined, this will be fixed soon.
Hope that helps, Leo