public class ErlangIncorrectAritySpecificationInspection extends ErlangInspectionBase {
@Override
protected void checkFile(@NotNull ErlangFile file, @NotNull ProblemsHolder problemsHolder) {
for (ErlangSpecification spec : file.getSpecifications()) {
ErlangFunTypeSigs signature = spec.getSignature();
PsiElement psiArity = signature != null ? signature.getSpecFun().getInteger() : null;
int arity = psiArity != null ? ErlangPsiImplUtil.getArity(psiArity) : -1;
if (arity != -1) {
for (ErlangTypeSig typeSig : signature.getTypeSigList()) {
if (typeSig.getFunType().getFunTypeArguments().getTopTypeList().size() != arity) {
problemsHolder.registerProblem(spec, "Specification has the wrong arity '" + signature.getSpecFun().getText() + "'");
}
}
}
}
}