X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fcompilation%2FTypeChecking.java;h=3118142df09740dce51ead4cf262f058f0b11b0b;hp=667c089c3e24fe58561a674622f053a0ed6d9662;hb=cb5fc8d606d8b322563e9345c441eecfa7f01753;hpb=4bf8562ab7cbb3747f9c5844a07469291d43e905 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeChecking.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeChecking.java index 667c089c3..3118142df 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeChecking.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeChecking.java @@ -204,6 +204,9 @@ public class TypeChecking { Expression expression = value.getExpression(); + int errorCountBeforeTypeChecking = compilationContext.errorLog.getErrorCount(); + int functionArity = expression.getSyntacticFunctionArity(); + try { ArrayList vars = new ArrayList(); type = Types.removeForAll(type, vars); @@ -218,6 +221,13 @@ public class TypeChecking { 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.log(value.definitionLocation, "Possible problem: type declaration has " + typeArity + " parameter types, but function definition has " + functionArity + " parameters."); + } + ArrayList demands = context.getConstraintDemand(); if(!demands.isEmpty() || !givenConstraints.isEmpty()) { ReducedConstraints red =