Bug #5085
closedFunction annotations not reported for anonymous functions
100%
Description
In Saxon 10.3 PE saxon:function-annotations() returns nothing on anonymous functions
See attached XQuery for an example
Perhaps by design? My use case is to attach names to anonymous functions for metadata tagging. Unfortunate, not critical.
Files
Updated by Michael Kay about 3 years ago
I added a test case for saxon:function-annotations()
applied to an inline function, and it worked.
I will now try your test case.
Updated by Michael Kay about 3 years ago
The problem is that the call on function-annotations() is not being applied to the inline function as written, it is being applied to a rewritten (curried) function of the form
function ($v as xs:double) as xs:double { 10 * $v }
in which the annotations have been lost.
I guess it's possible to construct a pure XQuery 3.1 test (without Saxon extensions) (using a FunctionTest
that tests annotations) that fails for the same reason, so we'll probably have to treat this as a conformance issue. Can't say it's high on my list of priorities though!
Updated by Michael Kay about 3 years ago
No, it's not possible to construct a pure XQuery 3.1 test that fails, because annotation assertions are defined to ignore annotations whose meaning is unknown to the XQuery processor; there are no annotations on inline functions whose meaning is known to Saxon, so all annotations are ignored, and therefore dropping them does no (conformance) harm.
Updated by Michael Kay about 3 years ago
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch trunk added
- Fix Committed on Branch 10, trunk added
This turns out to be fairly simple to fix:
(a) the spec says that function coercion should retain type annotations, and it's easy for us to do this simply by adding a method override CoercedFunction.getAnnotations()
that gets the annotations of the original function.
(b) the operation of binding the closure variable $scale to its supplied value 10 is implemented by creating a CurriedFunction
object, and this already retains the annotations of the original function.
Updated by Michael Kay about 3 years ago
Added qt3extra test case function-annotations-003.
Updated by O'Neil Delpratt about 3 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 10.6 added
Bug fix applied in the Saxon 10.6 maintenance release
Please register to edit this issue