Project

Profile

Help

Bug #5587

closed

Dynamic calls on integrated extension functions with multiple arity

Added by Michael Kay almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2022-07-04
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

When an extension function (implementing the interface ExtensionFunctionDefinition) allows multiple arities (minimum number of arguments != maximum number of arguments), dynamic function calls on the function fail. This applies both to static lookup of the function (my:func#2) and to dynamic lookup (function-lookup(QName($ns, 'func'), 2)).

Reported at https://saxonica.plan.io/boards/3/topics/8869.

Unit tests added to TestIntegratedFunctions.java, initially on the 12.x branch.

Actions #1

Updated by Michael Kay almost 2 years ago

  • Status changed from New to Resolved
  • Applies to branch 11, trunk added
  • Fix Committed on Branch 11, trunk added
  • Platforms .NET added

Fixed.

To allow dynamic calling, the ExtensionFunctionCall object needs to know the actual arity of the function, rather than inferring it either from the function definition or from the function call.

The code path is the same for both the static binding (my:fn#1) and the dynamic binding (function-lookup(QName(..), 1)

Actions #2

Updated by Michael Kay almost 2 years ago

  • Platforms Java added
  • Platforms deleted (.NET)
Actions #3

Updated by Michael Kay almost 2 years ago

  • Status changed from Resolved to In Progress

Resolved for SaxonJ; needs testing also in SaxonCS.

Actions #4

Updated by Michael Kay almost 2 years ago

I added corresponding tests for SaxonCS and found that the Java patch was sufficient to make the dynamic calls work.

However, I found a separate problem with static calls on a C# extension function declared with variable arity: The class ExtensionFunctionDefinitionWrapper.cs needs to implement the methods getMinimumNumberOfArguments() and getMaximumNumberOfArguments().

Actions #5

Updated by Michael Kay almost 2 years ago

  • Status changed from In Progress to Resolved
  • Platforms .NET added
Actions #6

Updated by Debbie Lockett over 1 year ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 11.4 added

Bug fix applied in the Saxon 11.4 maintenance release.

Please register to edit this issue

Also available in: Atom PDF