Expression expression = value.getExpression();
+ int errorCountBeforeTypeChecking = compilationContext.errorLog.getErrorCount();
+ int functionArity = expression.getSyntacticFunctionArity();
+
try {
ArrayList<TVar> vars = new ArrayList<TVar>();
type = Types.removeForAll(type, vars);
overloaded.assertResolved(compilationContext.errorLog);
expression.getType().addPolarity(Polarity.POSITIVE);
context.solveSubsumptions(expression.getLocation());
+
+ if(compilationContext.errorLog.getErrorCount() != errorCountBeforeTypeChecking) {
+ int typeArity = Types.getArity(type);
+ if(typeArity != functionArity)
+ compilationContext.errorLog.logWarning(value.definitionLocation, "Possible problem: type declaration has " + typeArity + " parameter types, but function definition has " + functionArity + " parameters.");
+ }
+
ArrayList<EVariable> demands = context.getConstraintDemand();
if(!demands.isEmpty() || !givenConstraints.isEmpty()) {
ReducedConstraints red =
compilationContext.errorLog.log(c.getDemandLocation(),
"Constraint <"+c.constraint+"> is not given and cannot be derived.");
}
- if(compilationContext.errorLog.isEmpty()) { // To prevent exceptions
+ if(compilationContext.errorLog.hasNoErrors()) { // To prevent exceptions
expression = ExpressionAugmentation.augmentSolved(
red.solvedConstraints,
expression);
}
}
else {
- if(compilationContext.errorLog.isEmpty()) // To prevent exceptions
+ if(compilationContext.errorLog.hasNoErrors()) // To prevent exceptions
expression = expression.decomposeMatching();
}
expression = expression.closure(vars.toArray(new TVar[vars.size()]));
for(TransformationRule rule : module.getRules())
for(Query[] queries : rule.sections.values())
for(Query query : queries)
- query.collectRefs(allRefs, refs);
+ query.collectRefs(allRefs, refs);
}
@Override