hof-039

declare function local:f($x as xs:long, $y as xs:NCName) as element(e)? {  }; 

The declared type of the function is

function(xs:long, xs:NCName) as element(e)?

Static type inference can determine that a more specific type of the function is

function(xs:long, xs:NCName) as element(e, xs:anyType)

The function never returns the empty sequence and never returns a nil element.

[DefinitionDM30: A function signature represents the type of a function]

local:f#2 instance of function(xs:long, xs:NCName) as element(), 

Expects false because f might return ().

local:f#2 instance of function(xs:long, xs:NCName) as element()+, 

Expects false because f might return ().

local:f#2 instance of function(xs:long, xs:NCName) as element()?, 

Expects true.

local:f#2 instance of function(xs:long, xs:NCName) as element()*, 

Expects true.

local:f#2 instance of function(xs:long, xs:NCName) as element(e)*, 

Expects true.

local:f#2 instance of function(xs:long, xs:NCName) as element(e, xs:anyType?)*, 

Expects true. element(e, xs:anyType?)* is identical to element(e)*.

local:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:anyType?)?, 

Expects true. element(e, xs:anyType?)? is identical to element(e)?.

local:f#2 instance of function(xs:long, xs:NCName) as element(e, xs:anyType)*, 

Expects false, because f might return a nil element.

local:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:anyType)?, 

Expects false, because f might return a nil element.

local:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:untyped)?

Expects false, because f might return a nil element or an element not annotated with xs:untyped.

element()

[element(e)]sequencetype
==
element e nillable of type xs:anyType

element()?

[element(e)?]sequencetype
==
(element e nillable of type xs:anyType)?

element()*

[element(e)*]sequencetype
==
(element e nillable of type xs:anyType)*

element(e, xs:anyType?)*

[element(e,xs:anyType?)]sequencetype
==
(element e nillable of type xs:anyType)*

element(e, xs:anyType?)?

[element(e,xs:anyType?)]sequencetype
==
(element e nillable of type xs:anyType)?

element(e, xs:anyType)*

[element(e,xs:anyType?)]sequencetype
==
(element e of type xs:anyType)*

element(*, xs:anyType)?

[element(*,xs:anyType?)]sequencetype
==
(element * of type xs:anyType)?

element(*, xs:untyped)?

[element(*,xs:untyped)]sequencetype
==
(element * of type xs:untyped)?