From: Adam R. <ad...@ex...> - 2012-12-29 13:19:19
|
> However whilst experimenting to find a short reproducible test-case, I > came upon this: > > xs:string( > if(current-date() eq current-date() - xs:dayTimeDuration("P1D"))then > () > else > "thing" > ) > > Now this code should do exactly the same as the above code, as both () > and fn:error(...) are evaluated to an empty sequence. However they > dont, and this code does not cause the warning you were seeing. In > fact if I debug it, it seems that () is being evaluated not to the > type "empty()" but instead to the type "node()". > > This definitely stikes me as a bug in eXist, as () is certainly an > empty sequence and not a node... > > Wolf any thoughts please? Digging a little deeper into this one, it looks to me like PathExpr.returnsType() should be re-written from: public int returnsType() { if (steps.size() == 0) //Not so simple. ITEM should be re-tuned in some circumstances that have to be determined return Type.NODE; return steps.get(steps.size() - 1).returnsType(); } to: @Override public int returnsType() { if(steps.isEmpty()) { return Type.EMPTY; } else { return steps.get(steps.size() - 1).returnsType(); } } I havent run the test suite yet, but a quick play with eXist and a few demo apps and all appears to work - I will run the test suite shortly... -- Adam Retter eXist Developer { United Kingdom } ad...@ex... irc://irc.freenode.net/existdb |