use of io.crate.types.ParameterTypeSignature in project crate by crate.
the class SignatureBinder method applyBoundVariables.
private static TypeSignature applyBoundVariables(TypeSignature typeSignature, BoundVariables boundVariables) {
String baseType = typeSignature.getBaseTypeName();
if (boundVariables.containsTypeVariable(baseType)) {
if (typeSignature.getParameters().isEmpty() == false) {
throw new IllegalStateException("Type parameters cannot have parameters");
}
var boundTS = boundVariables.getTypeVariable(baseType).getTypeSignature();
if (typeSignature instanceof ParameterTypeSignature) {
return new ParameterTypeSignature(((ParameterTypeSignature) typeSignature).parameterName(), boundTS);
}
return boundTS;
}
List<TypeSignature> parameters = Lists2.map(typeSignature.getParameters(), typeSignatureParameter -> applyBoundVariables(typeSignatureParameter, boundVariables));
if (typeSignature instanceof ParameterTypeSignature) {
return new ParameterTypeSignature(((ParameterTypeSignature) typeSignature).parameterName(), new TypeSignature(baseType, parameters));
}
return new TypeSignature(baseType, parameters);
}
Aggregations