Bug #3992
closed![Author: Michael Kay](https://www.gravatar.com/avatar/db6526d63053f09b62e52c2da8b2230a?rating=PG&size=50&default=https%3A%2F%2Fassets.plan.io%2Fimages%2Fdefault_avatar.png)
![Assignee: Michael Kay](https://www.gravatar.com/avatar/db6526d63053f09b62e52c2da8b2230a?rating=PG&size=22&default=https%3A%2F%2Fassets.plan.io%2Fimages%2Fdefault_avatar.png)
Overriding a variable in a used package fails if neither variable has an explicit declared type
100%
Description
If a public global variable declared in a used package has no "as" attribute, an attempt to override the variable in a using package (with another variable that also has no "as" attribute) fails saying
XTSE3070: The declared type of the overriding variable $v is different from that of the overridden variable
The spec (ยง3.5.3.3) says the two variables must have identical declared types. This is a little open to interpretation (it could be read as saying that they must have explicit declared types).
Updated by Michael Kay almost 6 years ago
It is failing because it is actually comparing the inferred type of the two variables, which is different because one has been through type checking and the other has not.
Updated by Michael Kay almost 6 years ago
W3C spec bug raised: https://www.w3.org/Bugs/Public/show_bug.cgi?id=30313
Updated by Michael Kay almost 6 years ago
- Status changed from New to Resolved
- Fix Committed on Branch 9.8, 9.9 added
Resolved (for 9.8 and 9.9). For the overriding variable, in XSLGlobalVariable we now use getSourceBinding().getDeclaredType (defaulting to item()*) in place of getRequiredType() (which gives us the inferred type in the case where there is no explicit as attribute). For the overridden variable, we continue to use GlobalVariable.getRequiredType(), which seems to give the right answer.
Test case override-f-035.
Updated by O'Neil Delpratt almost 6 years ago
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.15 added
Bug fix applied in the Saxon 9.8.0.15 maintenance release. Leave open to the Saxon 9.9 maintenance release.
Updated by O'Neil Delpratt almost 6 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 9.9.0.2 added
Bug fix applied in the Saxon 9.9.0.2 maintenance release.
Please register to edit this issue