[Bug 26865] New: CastableAs653 and CastableAs654 should expect false instead of true

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 26865] New: CastableAs653 and CastableAs654 should expect false instead of true

Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26865

            Bug ID: 26865
           Summary: CastableAs653 and CastableAs654 should expect false
                    instead of true
           Product: XML Query Test Suite
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XML Query Test Suite
          Assignee: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]

CastableAs653 should expect false instead of true

<test-case name="CastableAs653"
xmlns="http://www.w3.org/2010/09/qt-fots-catalog">
      <description>Pattern must match canonical representation (not the result
of string())</description>
      <created by="Michael Kay" on="2013-04-08"/>
      <environment ref="derived"/>
      <dependency type="spec" value="XQ10+"/>
      <dependency type="feature" value="schemaImport"/>
      <test><![CDATA[
        import schema namespace d="http://www.w3.org/XQueryTest/derivedTypes";
        12 castable as d:canonicalDecimal
      ]]></test>
      <result>
        <assert-true/>
      </result>
</test-case>

d:canonicalDecimal:

  <xs:simpleType name="canonicalDecimal">
    <xs:restriction base="xs:decimal">
      <xs:pattern value="-?[0-9]+\.[0-9]+"/>
    </xs:restriction>
  </xs:simpleType>


We think the result of this query should be false.

http://www.w3.org/TR/xpath-functions-30/#casting-within-branch

"If the value does not conform to the facets defined for the target type, then
a dynamic error is raised [err:FORG0001]. See [XML Schema Part 2: Datatypes
Second Edition]. In the case of the pattern facet (which applies to the lexical
space rather than the value space), the pattern is tested against the canonical
lexical representation of the value, as defined for the source type (or the
result of casting the value to an xs:string, in the case of types that have no
canonical lexical representation defined for them).

Note that this will cause casts to fail if the pattern excludes the canonical
lexical representation of the source type. For example, if the type my:distance
is defined as a restriction of xs:decimal with a pattern that requires two
digits after the decimal point, casting of an xs:integer to my:distance will
always fail, because the canonical representation of an xs:integer does not
conform to this pattern."

--
You are receiving this mail because:
You are the QA Contact for the bug.

Reply | Threaded
Open this post in threaded view
|

[Bug 26865] CastableAs653 and CastableAs654 should expect false instead of true

Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26865

--- Comment #1 from Josh Spiegel <[hidden email]> ---
This also applies to CastableAs655 and CastableAs656.

--
You are receiving this mail because:
You are the QA Contact for the bug.

Reply | Threaded
Open this post in threaded view
|

[Bug 26865] CastableAs653 and CastableAs654 should expect false instead of true

Bugzilla from bugzilla@jessica.w3.org
In reply to this post by Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26865

Michael Kay <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|[hidden email]          |[hidden email]

--- Comment #2 from Michael Kay <[hidden email]> ---
Yes, I think you are probably right.

--
You are receiving this mail because:
You are the QA Contact for the bug.

Reply | Threaded
Open this post in threaded view
|

[Bug 26865] CastableAs653 and CastableAs654 should expect false instead of true

Bugzilla from bugzilla@jessica.w3.org
In reply to this post by Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26865

Michael Kay <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Michael Kay <[hidden email]> ---
Fixed as suggested.

--
You are receiving this mail because:
You are the QA Contact for the bug.

Reply | Threaded
Open this post in threaded view
|

[Bug 26865] CastableAs653 and CastableAs654 should expect false instead of true

Bugzilla from bugzilla@jessica.w3.org
In reply to this post by Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26865

Tim Mills <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |[hidden email]
         Resolution|FIXED                       |---

--- Comment #4 from Tim Mills <[hidden email]> ---
I'm not so sure about CastableAs655 and CastableAs656.

Following through the rules:

TT = d:canonicalDouble
ST = xs:decimal
SV = xs:decimal(93.7)

* Casting across the type hierarchy is logically equivalent to three separate
steps performed in order. Errors can occur in either of the latter two steps.

* Cast the SV, up the hierarchy, to the primitive type of the source, as
described in 18.3.2 Casting from derived types to parent types.

ST' = primitive-type(xs:decimal) = xs:decimal
SV' = xs:decimal(93.7)

* If SV is an instance of xs:string or xs:untypedAtomic, check its value
against the pattern facet of TT, and raise a dynamic error [err:FORG0001] if
the check fails.

SV is not an instance of xs:string or xs:untypedAtomic.

* Cast the value to the primitive type of TT, as described in 18.1 Casting from
primitive types to primitive types.  If TT is derived from xs:NOTATION, assume
for the purposes of this rule that casting to xs:NOTATION succeeds.  

ST'' = primitive-type(d:canonicalDouble) = xs:double
SV'' = xs:double(93.7)

Cast the value down to the TT, as described in 18.3.3 Casting within a branch
of the type hierarchy

We're now casting a double value (SV'') to d:canonicalDouble.  The canonical
form of this value is 9.37E1 which matches the pattern facet.

--
You are receiving this mail because:
You are the QA Contact for the bug.