public Type renameVar(String v1, String v2) {
        if (var) {
            if (this.cons.equals(v1)) {
                return new Type(var, nat,box, v2, wildcard, superType, params);
            } else {
                return this;
            }
        } else {
            Type[] nparams = new Type[this.params.length];
            int i=0;
            for (Type p : params) {
                nparams[i++]=p.renameVar(v1, v2);
            }
            return new Type(var, nat, box, cons, wildcard, superType, nparams);
        }

    }