there is a bug that branch will give Expected type DATUM but found FUNCTION