If the constant is a constant expression, then getAggregateElement() will return null. Guard against this before calling HasFn(). (cherry picked from commit af382b93)