@Override
    public Type resolve(@NotNull Scope s, int tag) {
        if (module == null) {
            return Indexer.idx.builtins.Cont;
        }

        ModuleType mod = Indexer.idx.loadModule(module, s, tag);

        if (mod == null) {
            Indexer.idx.putProblem(this, "Cannot load module");
        } else if (isImportStar()) {
            importStar(s, mod, tag);
        } else {
            for (Alias a : names) {
                Type t = mod.getTable().lookupType(a.name.get(0).id);
                if (t == null) return Indexer.idx.builtins.Cont;

                if (a.asname != null) {
                    s.put(a.asname.id, a.asname, t, Binding.Kind.MODULE, tag);
                } else {
                    Binding b = mod.getTable().lookup(a.name.get(0).id);
                    if (b != null) {
                        s.put(a.name.get(0).id, b);
                    }
                }
            }
        }

        return Indexer.idx.builtins.Cont;
    }