INLINER : bug ?
Hi Everybody
@Leo, there might be a bug in the BaseX INLINER (I am currently profiling your module https://github.com/LeoWoerteler/xq-modules/).
To reproduce it :
- use the 3 files attached.
- Edit baseX config file .baseX, set the following Local options : # Local Options
INLINELIMIT = 5
- launch the XQUERY file MapProfiler.xquery. With these settings, the profile function works finely.
Then
- Edit baseX config file .baseX, set the following Local options : # Local Options
INLINELIMIT = 6
With these settings, I am raising a [XPTY0004] Single item expected error.
Cheers,
Jean-Marc
Dear Jean-Marc,
Quoted text · jean-marc Mercier · 3 lines
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!
Quoted text · jean-marc Mercier · 1 line
> 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
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 at basex.org>
Quoted text · Leo Wörteler · 31 lines
> 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 >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.