code: Symbol findIdentInPackage(Env<AttrContext> env, TypeSymbol pck,
                                Name name, KindSelector kind) {
          Name fullname = TypeSymbol.formFullName(name, pck);
          Symbol bestSoFar = typeNotFound;
          if (kind.contains(KindSelector.TYP)) {
              RecoveryLoadClass recoveryLoadClass =
                      allowModules && !kind.contains(KindSelector.PCK) &&
                      !pck.exists() && !env.info.isSpeculative ?
                          doRecoveryLoadClass : noRecovery;
              Symbol sym = loadClass(env, fullname, recoveryLoadClass);
              if (sym.exists()) {
                  // don't allow programs to use flatnames
                  if (name == sym.name) return sym;
              }
              else bestSoFar = bestOf(bestSoFar, sym);
          }
          if (kind.contains(KindSelector.PCK)) {
              return lookupPackage(env, fullname);
          }
          return bestSoFar;
      }
docs: Find an identifier in a package which matches a specified kind set.
  @param env       The current environment.
  @param name      The identifier's name.
  @param kind      Indicates the possible symbol kinds
  (a nonempty subset of TYP, PCK).