Bug #4772
closed
Diagnostics for type errors on $map(xx) and $array(xx)
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:
Description
A dynamic function call on a map ($map(xx)
) is converted at compile time to a static function call (map:get($map, xx)
).
This leads to poor diagnostics if there is a type error in xx: for example
An empty sequence is not allowed as the second argument of map:get()
The same problem applies to calls on $array(index)
The problem can be demonstrated from the command line:
-qs:"declare variable $p external;map{'a':1}($p)" -t ?p=()
The problem can be fixed at the point where we create the call on map:get(). In ApplyFn.makeGetCall()
, after
Expression getter = fnSet.makeFunction("get", 2).makeFunctionCall(target, key);
and before the call on getter.staticTypeCheck()
, we can do custom type-checking on the second argument with a custom RoleDiagnostic. After this change the error becomes
An empty sequence is not allowed as the key value supplied when calling a map as a function
And similarly, mutatis mutandis, for a call on $array(xx)
- Status changed from New to Resolved
- Fix Committed on Branch 10, trunk added
Bug fix applied in the Saxon 10.3 maintenance release
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 10.3 added
Please register to edit this issue
Also available in: Atom
PDF