*  @param sym           The symbol.
     *  @param s             The scope.
     */
    boolean checkUnique(DiagnosticPosition pos, Symbol sym, Scope s) {
        if (sym.type.isErroneous())
            return true;
        if (sym.owner.name == names.any) return false;
        for (Scope.Entry e = s.lookup(sym.name); e.scope == s; e = e.next()) {
            if (sym != e.sym &&
                sym.kind == e.sym.kind &&
                sym.name != names.error &&
                (sym.kind != MTH || types.overrideEquivalent(sym.type, e.sym.type))) {
                if ((sym.flags() & VARARGS) != (e.sym.flags() & VARARGS))
                    varargsDuplicateError(pos, sym, e.sym);
                else
                    duplicateError(pos, e.sym);
                return false;
            }
        }
        return true;
    }