Project

Profile

Help

Bug #4692

closed

MapTest as subtype of Function Type

Added by Michael Kay about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2020-08-23
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 9.9, trunk
Fix Committed on Branch:
10, 9.9, trunk
Fixed in Maintenance Release:
Platforms:

Description

See https://github.com/w3c/qt3tests/issues/28

Saxon is accepting map { 1:'A','x':'B' } as an instance of function(xs:anyAtomicType) as xs:string. But this is incorrect: if the map is treated as a function $F, then $F(23) returns () which is not an instance of the declared return type xs:string.

The logic in MapType.relationship() line 324 makes map(K, V) a subtype of F if function(K) as V is a subtype of F, which seems quite wrong; the rule is ยง2.5.6.2 rule 35, which says map(K, V), is a subtype of function(xs:anyAtomicType) as V?.

So both Saxon and the QT3 test appear to be wrong.

Actions #1

Updated by Michael Kay about 4 years ago

See also bug #2938, which introduced the current rules, and https://github.com/w3c/qtspecs/issues/14 which discusses the problem in the W3C specs.

The proposed rule is now:

A map M matches a TypedFunctionTest function(P) as R if (a) P is a subtype of xs:anyAtomicType, (b) every value in M is an instance of R, and (c) the empty sequence is an instance of R.

Actions #2

Updated by Michael Kay about 4 years ago

  • Status changed from New to Resolved
  • Applies to branch 10, 9.9, trunk added
  • Fix Committed on Branch 10, 9.9, trunk added

Patch committed (9.9, 10, 11).

Test cases added to QT3 prod-MapTest (MapTest-059 to -066)

Actions #3

Updated by O'Neil Delpratt about 4 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.2 added

Bug fix applied in the Saxon 10.2 maintenance release.

Actions #4

Updated by O'Neil Delpratt about 4 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 9.9.1.8 added

Bug fix applied on the Saxon 9.9.1.8 maintenance release.

Please register to edit this issue

Also available in: Atom PDF