@NotNull
    private Type resolveCall(@NotNull Type fun,
                             Name newName,
                             List<Type> pos,
                             Map<String, Type> hash,
                             Type kw,
                             Type star,
                             Type block,
                             State s)
    {
        if (fun instanceof FunType) {
            FunType ft = (FunType) fun;
            return apply(ft, pos, hash, kw, star, block, this);
        } else if (fun instanceof ClassType) {
            // constructor
            InstanceType inst = new InstanceType(fun, newName, this, pos);
            ((ClassType) fun).setCanon(inst);

            if (!isSuperCall()) {
                return inst;
            } else {
                Type selfType = s.lookupType(Constants.INSTNAME);
                if (selfType != null) {
                    selfType.table.putAll(inst.table);
                }
                return Type.CONT;
            }
        } else {
            addWarning("calling non-function and non-class: " + fun);
            return Type.UNKNOWN;
        }
    }