Project

Profile

Help

Bug #6051

open

Bug on exist() with non-existing attribute

Added by Christian Grün 11 days ago. Updated 10 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2023-05-25
Due date:
% Done:

0%

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

Description

Actions #1

Updated by Michael Kay 11 days ago

  • Status changed from New to Rejected
  • Assignee set to Michael Kay

Thanks.

But Saxon appears to give the correct result.

Test case fn-exists-101 added to qt4tests.

Actions #2

Updated by Michael Kay 11 days ago

  • Status changed from Rejected to In Progress

Reopening. The test is working from the command line but not in the test driver.

The test is working in 12.x but not in 11.x. In 11.x, the predicate is being rewritten to [exists(data(@n1) ge -1)] which is incorrect; the ge operator returns () when one of the operands is ().

Actions #3

Updated by Michael Kay 11 days ago

In 11.x, GeneralComparison.typeCheck() line 305 rewrites the comparison to a value comparison like this:

                    Expression vun = makeCompareUntypedToNumeric(getLhsExpression(), getRhsExpression(), singletonOperator);
                    return vun.typeCheck(visitor, contextInfo);

In 12.x this has been changed to:

                    setAtomicComparer(new UntypedNumericComparer());
                    return this;

Git Blame dates this as 19/08/22 and attributes it to bytecode changes, I suspect a bug fix mixed into the same commit as something else.

Actions #4

Updated by Michael Kay 11 days ago

I've done a fair bit of digging in the history and I can't find any record of what motivated this code change on 2022-08-19. So I'm going to have to deal with it from first principles.

Actions #5

Updated by Christian Grün 11 days ago

Coincidental bug fixes are not the worst ;)

Actions #6

Updated by Michael Kay 11 days ago

  • Category set to XPath conformance
  • Status changed from In Progress to Resolved
  • Priority changed from Low to Normal
  • Applies to branch 11 added
  • Fix Committed on Branch 11 added
  • Platforms .NET, Java added

I've retrofitted the code change from 12.x to 11.x and it seems to regression test OK.

Actions #7

Updated by John Lumley 11 days ago

The worst I’ve had was where a bug went away when run under the debugger, due to a bug in the debugger!

Sent from my iPad

On 25 May 2023, at 18:04, Saxonica Developer Community wrote:


Actions #8

Updated by Christian Grün 11 days ago

…must have been a heisen(de)bugger!

Actions #9

Updated by Michael Kay 10 days ago

  • Status changed from Resolved to In Progress

Reopened because there are reports that this fails on 12.2 see https://github.com/BaseXdb/basex/issues/2212

Please register to edit this issue

Also available in: Atom PDF