Backwards compatibility

I have done an experimental implementation of PR 2218 (changes to numeric comparisons), and to assess the impact on backwards compatibility I have run this Saxon version (with 4.0 mode enabled) over the QT3 test suite, to see how many failures we get.

In fact this provides a general opportunity to assess backwards compatibility not only of this feature but of the 4.0 specs (specifically, XQuery) as a whole.

I'm currently getting 275 failures (out of 30898 tests), as follows:

** SUMMARY AT THE END **

XE denotes tests that are expected to fail in 3.1 but which no longer fail because they are valid in 4.0.

Failures by Test Set: 

  app-FunctxFn : 2

2 test returns xs:float(1.01) but the assertion is <assert-eq>1.01</assert> which fails if evaluated in 4.0 mode

  app-Walmsley : 2

1  XE
1 Unrecognized option is now an error, was previously ignored

  array-for-each : 1  XE
  array-for-each-pair : 1  XE

test expects error but becomes valid in 4.0

  fn-analyze-string : 1  XE
  fn-apply : 1  XE

  fn-avg : 1

test returns xs:float(1.01) but the assertion is <assert-eq>1.01</assert> which fails if evaluated in 4.0 mode. I'm going to make the assertions more precise in such cases.

  fn-compare : 1  XE

  fn-deep-equal : 4

2 failures caused by incompatible spec change regarding adjacent text nodes
2 failures caused by change to decimal=double comparison

  fn-distinct-values : 3

1 failure unidentified
2 failures caused by change to decimal=double comparison

  fn-filter : 2  XE
  fn-for-each-pair : 4  XE
  fn-format-date : 1  XE
  fn-format-dateTime : 1  XE
  fn-format-time : 1  XE

  fn-function-lookup : 18

4.0 makes it an error to do function-lookup() on a context-dependent function when there is no context. 3.1 returned a function which always failed when called.

  fn-function-name : 1

4.0 makes it an error to reference a context-dependent function when there is no context. 3.1 returned a function which always failed when called.

  fn-has-children : 1

4.0 makes it an error to reference a context-dependent function when there is no context. 3.1 returned a function which always failed when called.

  fn-index-of : 3

1 XE, 2 caused by apparent Saxon bug comparing NaN=NaN.

  fn-insert-before : 1

Test returns xs:float(1.1) but expected result is given as decimal 1.1. Fixed the test.

  fn-json-doc : 1

Unrecognized option is now an error, was previously ignored

  fn-load-xquery-module : 3

2 XE
1 Unrecognized option is now an error, was previously ignored

  fn-matches : 2  XE
  fn-matches.re : 27  XE

  fn-max : 10
  fn-min : 12

Spec change for min and max affecting the type of the result

  fn-normalize-unicode : 1  XE

  fn-parse-json : 6

5 XE
1 Unrecognized option is now an error, was previously ignored

  fn-remove : 2

1 Test returns xs:float(1.1) but expected result is given as decimal 1.1. Fixed the test.
1 XE

  fn-replace : 6  XE

  fn-round : 1

1 Test returns xs:float(1.1) but expected result is given as decimal 1.1. Fixed the test.

  fn-round-half-to-even : 3

3  1 Test returns xs:float(1.1) but expected result is given as decimal 1.1. Fixed the test.

  fn-serialize : 4

Spec change affecting HTML META element

  fn-string-join : 1  XE

  fn-subsequence : 2

2  Test returns xs:float(1.1) but expected result is given as decimal 1.1. Fixed the test.

  fn-tokenize : 5  XE

  fn-transform : 1

1 Unrecognized option is now an error, was previously ignored

  fn-unparsed-text-available : 1  XE

  fn-xml-to-json : 4

Format of number is JSON output has changed, not sure why.

  map-merge : 1  XE

  math-exp10 : 1

Some problem with formatting the result.

  method-adaptive : 10

Serialized output of maps has changed

  method-html : 2

Serialized output of meta tag has changed

  method-xhtml : 4

Serialized output of meta tag has changed

  misc-CombinedErrorCodes : 1  XE
  misc-HigherOrderFunctions : 6  XE
  op-base64Binary-greater-than : 1  XE
  op-base64Binary-less-than : 1  XE
  op-hexBinary-greater-than : 1  XE
  op-hexBinary-less-than : 1  XE

  op-numeric-greater-than : 1

Test returns xs:float(1.1) but expected result is given as decimal 1.1. Fixed the test.

  op-same-key : 1

Spec change to make binary values comparable

  prod-Annotation : 1  XE
  prod-ArrayTest : 1  XE
  prod-ArrowPostfix : 1  XE
  prod-CastExpr : 2

Test explicitly compares decimal to double

  prod-CompNamespaceConstructor : 4

Spec change: reserved names in computed node constructors

  prod-ContextItemDecl : 4  XE

  prod-ExtensionExpr : 14

Spec change: whitespace needed before QName in pragma

  prod-ForClause : 5

2  XE
3  Spec change: reserved names in computed node constructors

  prod-FunctionCall : 1  XE
  prod-FunctionDecl : 3  XE
  prod-GroupByClause : 1  XE
  prod-InlineFunctionExpr : 3  XE
  prod-InstanceofExpr : 3

1  spec change: name#0 is an error if context absent
2  test invalid because function signatures have changed

  prod-LetClause : 9  XE
  prod-Literal : 1  XE
  prod-Lookup : 5  XE

  prod-MapTest : 2

Spec has been clarified

  prod-NamedFunctionRef : 15

spec change: name#0 is an error if context absent

  prod-NodeTest : 3  XE

  prod-PathExpr : 4

possible Saxon bug - leading lone slash

  prod-Predicate : 2  XE

  prod-StepExpr : 4

possible Saxon bug - leading lone slash

  prod-SwitchExpr : 1  XE

  prod-TryCatchExpr : 1

Spec change: reserved names in computed node constructors

  prod-UnaryLookup : 3  XE

  prod-ValidateExpr : 1

Spec change: whitespace needed before QName in pragma

  prod-VarDecl.external : 8  XE

** SUMMARY **

Most of the test failures fall into one of the following categories:

1. Something that was an error in 3.1 but is no longer an error in 4.0
2. Reserved names in node constructors
3. Mandatory whitespace in pragmas
4. Unrecognized options in options arguments are now an error
5. 3.0 allowed name#0 when there was no context item, 4.0 makes this an error
6. Comparison of doubles to decimals

For (6) the vast majority of cases were where the result of the test is a double/float, but the expected result is expressed as a decimal. There are also a few cases where the
test was deliberately testing comparisons of doubles to decimals.

Received on Thursday, 2 October 2025 15:05:23 UTC