コード例 #1
0
 public InferenceSolver_c(JL5ProcedureInstance pi, List<Type> actuals, JL5TypeSystem ts) {
   this.pi = pi;
   this.typeVariables = pi.typeVariables();
   this.actuals = actuals;
   this.formals = pi.formalTypes();
   this.ts = ts;
 }
コード例 #2
0
 private List<Constraint> getInitialConstraints() {
   List<Constraint> constraints = new ArrayList<Constraint>();
   int numFormals = formals.size();
   for (int i = 0; i < numFormals - 1; i++) {
     constraints.add(new SubConversionConstraint(actuals.get(i), formals.get(i), this));
   }
   if (numFormals > 0) {
     if (pi != null && pi.isVariableArrity()) {
       JL5ArrayType lastFormal = (JL5ArrayType) pi.formalTypes().get(numFormals - 1);
       for (int i = numFormals - 1; i < actuals.size() - 1; i++) {
         constraints.add(new SubConversionConstraint(actuals.get(i), lastFormal.base(), this));
       }
     }
     constraints.add(
         new SubConversionConstraint(
             actuals.get(numFormals - 1), formals.get(numFormals - 1), this));
   }
   return constraints;
 }