]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeChecking.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / compilation / TypeChecking.java
index b8d959e197b65dd56b9fc23dd9a9a521a0be0857..ff713b1705a85284c841e1fb2a9393aa0a3a4d19 100644 (file)
@@ -186,6 +186,7 @@ public class TypeChecking {
                                     .closure(vars));
                             value.setType(Types.forAll(vars, 
                                     Types.constrained(constraints, value.getType())));
+                            //System.out.println(value.getName() + " :: " + value.getType());
                             
                             // Add evidence parameters to recursive calls
                             for(EPlaceholder ref : recursiveReferences) {
@@ -220,12 +221,13 @@ public class TypeChecking {
                                 for(EAmbiguous overloaded : context.overloadedExpressions)
                                     overloaded.assertResolved(compilationContext.errorLog);
                                 expression.getType().addPolarity(Polarity.POSITIVE);
+                                //System.out.println("--- " + value.getName() + " -------------------------------------------------------------------------");
                                 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.");
+                                        compilationContext.errorLog.logWarning(value.definitionLocation, "Possible problem: type declaration has " + typeArity + " parameter types, but function definition has " + functionArity + " parameters.");
                                 }
                                 
                                 ArrayList<EVariable> demands = context.getConstraintDemand();
@@ -343,7 +345,7 @@ public class TypeChecking {
     }
     
     public void typeCheck() {
-        ce = new ConstraintEnvironment(environment);
+        ce = new ConstraintEnvironment(compilationContext);
         scheduler = new TypeCheckingScheduler(compilationContext);
         
         typeCheckValues();
@@ -408,7 +410,7 @@ public class TypeChecking {
                 for(TransformationRule rule : module.getRules())
                     for(Query[] queries : rule.sections.values())
                         for(Query query : queries)
-                            query.collectRefs(allRefs, refs);                
+                            query.collectRefs(allRefs, refs);
             }
             
             @Override