Skip to content

Commit fe7ed8e

Browse files
committed
[ignore] Minor improvements
1 parent b7cf79d commit fe7ed8e

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

exist-core/src/main/java/org/exist/xquery/SequenceConstructor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ public String toString() {
125125
/**
126126
* Add another PathExpr to this object's expression list.
127127
* Performs a static check, if return type is a function type other than array.
128-
* see #id-content setion 1.e.i and 1.e.ii
128+
* see #id-content section 1.e.i and 1.e.ii
129129
*
130130
* @throws XPathException when Path returns a function type
131131
* @param path A path to add to this path
132132
*/
133133
public void addPathIfNotFunction(final PathExpr path) throws XPathException {
134-
int retType = path.returnsType();
134+
final int retType = path.returnsType();
135135
if (Type.subTypeOf(retType, Type.FUNCTION_REFERENCE) && retType != Type.ARRAY) {
136136
throw new XPathException(path, ErrorCodes.XQTY0105, "Function types are not allowed in element content. Got " + Type.getTypeName(retType));
137137
}

exist-core/src/test/java/org/exist/xquery/FunctionTypeInElementContentTest.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
import static org.exist.test.XQueryAssertions.*;
3131

3232
/**
33-
* Ensure function types returned in element content throws at compile time and has location information
34-
* https://github.com/eXist-db/exist/issues/3474
33+
* Ensure function types returned in element content throws at compile time and
34+
* has location information.
35+
* See issue :<a href="https://github.com/eXist-db/exist/issues/3474">#3474</a>.
3536
*
3637
* @author <a href="mailto:[email protected]">Juri Leino</a>
3738
*/
@@ -43,7 +44,7 @@ public void arrayLiteral() throws EXistException, PermissionDeniedException {
4344
assertXQResultSimilar(elemSource("<test/>"), executeQuery(query));
4445
}
4546

46-
// TODO: array content could be removed after https://github.com/eXist-db/exist/issues/3472 is fixed
47+
// TODO(JL): array content could be removed after https://github.com/eXist-db/exist/issues/3472 is fixed
4748
@Test
4849
public void arrayConstructor() throws EXistException, PermissionDeniedException {
4950
final String query = "element test { array { () } }";
@@ -63,23 +64,23 @@ public void partialBuiltIn() throws EXistException, PermissionDeniedException {
6364
assertXQStaticError(ErrorCodes.XQTY0105, 1, 16, error, compileQuery(query));
6465
}
6566

66-
// TODO: Does still throw without location info
67+
// TODO(JL): Does still throw without location info
6768
@Test
6869
public void functionReference() throws EXistException, PermissionDeniedException {
6970
final String query = "element test { sum#0 }";
7071
final String error = "Function types are not allowed in element content. Got function(*)";
7172
assertXQStaticError(ErrorCodes.XQTY0105, 0, 0, error, compileQuery(query));
7273
}
7374

74-
// TODO: Does not throw at compile time
75+
// TODO(JL): Does not throw at compile time
7576
@Test
7677
public void functionVariable() throws EXistException, PermissionDeniedException {
7778
final String query = "let $f := function () {} return element test { $f }";
7879
final String error = "Enclosed expression contains function item";
7980
assertXQDynamicError(ErrorCodes.XQTY0105, 1, 49, error, executeQuery(query));
8081
}
8182

82-
// TODO: user defined function has its location offset to a weird location
83+
// TODO(JL): user defined function has its location offset to a weird location
8384
@Test
8485
public void userDefinedFunction() throws EXistException, PermissionDeniedException {
8586
final String query = "element test { function () {} }";
@@ -110,29 +111,29 @@ public void sequenceOfMaps() throws EXistException, PermissionDeniedException {
110111
assertXQDynamicError(ErrorCodes.XQTY0105, 0, 0, error, executeQuery(query));
111112
}
112113

114+
// TODO(JL): add (sub-expression) location
113115
/**
114116
* This is an edge case, which would evaluate to empty sequence
115117
* but should arguably still throw.
116118
*/
117-
// TODO: add (sub-expression) location
118119
@Test
119120
public void sequenceOfMapsEdgeCase() throws EXistException, PermissionDeniedException {
120121
final String query = "element test { (map {})[2] }";
121122
final String error = "Function types are not allowed in element content. Got map(*)";
122123
assertXQStaticError(ErrorCodes.XQTY0105, 0, 0, error, compileQuery(query));
123124
}
124125

125-
// TODO: add (sub-expression) location
126-
// TODO: this could throw at compile time
126+
// TODO(JL): add (sub-expression) location
127+
// TODO(JL): this could throw at compile time
127128
@Test
128129
public void arrayOfMaps() throws EXistException, PermissionDeniedException {
129130
final String query = "element test { [map {}] }";
130131
final String error = "Enclosed expression contains function item";
131132
assertXQDynamicError(ErrorCodes.XQTY0105, 1, 16, error, executeQuery(query));
132133
};
133134

134-
// TODO: add (sub-expression) location
135-
// TODO: This should throw at compile time, but does not
135+
// TODO(JL): add (sub-expression) location
136+
// TODO(JL): This should throw at compile time, but does not
136137
@Test
137138
public void mapConstructorInSubExpression() throws EXistException, PermissionDeniedException {
138139
final String query = "element test { \"a\", map {} }";

0 commit comments

Comments
 (0)