public Type inferType(List<Var> vars, List<List<Type>> varTypes) { for (Exp e : exps) { Type t = e.inferType(vars, varTypes); if (t == null || !t.subType(PType.E)) { inferedType = null; // update cache return null; } } inferedType = FType.ET; // update cache return FType.ET; // could we infer subtypes here? }
public Type inferType(List<Var> vars, List<List<Type>> varTypes) { arg.addTypeSig(vars, varTypes); Type t = body.inferType(vars, varTypes); arg.removeTypeSig(vars, varTypes); if (t == null || !t.subType(PType.T)) { inferedType = null; // update cache return null; } inferedType = PType.I; // update cache return PType.I; }