From bb88d12cffadb1efde8d6b621ebf9e690215bf99 Mon Sep 17 00:00:00 2001 From: Leo Woerteler Date: Thu, 26 Mar 2015 14:07:36 +0100 Subject: [PATCH] [FIX] XQuery, GH-1113: Wrong cached `SeqType` for `array(*)*`. --- .../main/java/org/basex/query/value/type/SeqType.java | 4 ++-- .../src/test/java/org/basex/query/ast/FuncItemTest.java | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/basex-core/src/main/java/org/basex/query/value/type/SeqType.java b/basex-core/src/main/java/org/basex/query/value/type/SeqType.java index 5b0aadbcc0..d1f89fa247 100644 --- a/basex-core/src/main/java/org/basex/query/value/type/SeqType.java +++ b/basex-core/src/main/java/org/basex/query/value/type/SeqType.java @@ -218,9 +218,9 @@ public String toString() { /** Single map. */ public static final SeqType MAP_O = new SeqType(ANY_MAP); /** Zero or more arrays. */ - public static final SeqType ARRAY_ZM = new SeqType(ANY_ARRAY); + public static final SeqType ARRAY_ZM = new SeqType(ANY_ARRAY, Occ.ZERO_MORE); /** Single array. */ - public static final SeqType ARRAY_O = new SeqType(ANY_ARRAY); + public static final SeqType ARRAY_O = ANY_ARRAY.seqType(); /** One xs:hexBinary. */ public static final SeqType HEX = AtomType.HEX.seqType(); /** Single xs:base64Binary. */ diff --git a/basex-core/src/test/java/org/basex/query/ast/FuncItemTest.java b/basex-core/src/test/java/org/basex/query/ast/FuncItemTest.java index e15dc16830..b176fc003e 100644 --- a/basex-core/src/test/java/org/basex/query/ast/FuncItemTest.java +++ b/basex-core/src/test/java/org/basex/query/ast/FuncItemTest.java @@ -289,4 +289,13 @@ public void gh1038() { "", "exists(//" + Util.className(Empty.class) + ")"); } + + /** Tests inlining of a function literal. */ + @Test + public void gh1113() { + check("let $join := array:join#1 return $join(([], []))", + "[\n]", + "empty(//" + Util.className(DynFuncCall.class) + ')', + "empty(//" + Util.className(StaticFuncCall.class) + ')'); + } }