Skip to content

Commit 55ea2b9

Browse files
make fn:schema-type return empty sequence for non-schema-types (#2651)
1 parent 03e45ba commit 55ea2b9

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

basex-core/src/main/java/org/basex/query/func/fn/FnSchemaType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.basex.query.value.*;
1010
import org.basex.query.value.item.*;
1111
import org.basex.query.value.map.*;
12+
import org.basex.query.value.seq.*;
1213
import org.basex.query.value.type.*;
1314
import org.basex.query.var.*;
1415
import org.basex.util.*;
@@ -90,7 +91,7 @@ protected static Value annotate(final QueryContext qc, final InputInfo info, fin
9091
constructor = !type.oneOf(QNAME, NOTATION);
9192
}
9293
} else {
93-
throw Util.notExpected();
94+
return Empty.VALUE;
9495
}
9596
final MapBuilder mb = new MapBuilder();
9697
mb.put("name", name);

basex-core/src/test/java/org/basex/query/func/FnModuleTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,6 +3142,8 @@ public final class FnModuleTest extends SandboxTest {
31423142
@Test public void schemaType() {
31433143
final Function func = SCHEMA_TYPE;
31443144

3145+
query(" declare type t as xs:integer; " + func.args(" #t"), "");
3146+
query(func.args(" #fn:schema-type-record"), "");
31453147
query(func.args(" #xs:integer") + " ? name", "#integer");
31463148
query(func.args(" #xs:long") + " ? primitive-type() ? name", "#decimal");
31473149
query(func.args(" #xs:positiveInteger") + " ? base-type() ? name", "#nonNegativeInteger");

0 commit comments

Comments
 (0)