summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java
index a5f00b1ce45..bcf8d8c9172 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java
@@ -153,6 +153,32 @@ class ParsedType {
}
static ParsedType wsetOf(ParsedType vt) {
assert(vt != null);
+ if (vt.getVariant() != Variant.BUILTIN) {
+ throw new IllegalArgumentException("weightedset of complex type '" + vt + "' is not supported");
+ }
+ switch (vt.name()) {
+ // allowed types:
+ case "bool":
+ case "byte":
+ case "int":
+ case "long":
+ case "string":
+ case "uri":
+ break;
+ case "predicate":
+ case "raw":
+ case "tag":
+ throw new IllegalArgumentException("weightedset of complex type '" + vt + "' is not supported");
+ case "float16":
+ case "float":
+ case "double":
+ /* TODO Vespa 8:
+ throw new IllegalArgumentException("weightedset of inexact type '" + vt + "' is not supported");
+ */
+ break;
+ default:
+ throw new IllegalArgumentException("weightedset of unknown type '" + vt + "' is not supported");
+ }
return new ParsedType("weightedset<" + vt.name() + ">", Variant.WSET, vt);
}
static ParsedType documentRef(ParsedType docType) {