<commit_before>package org.jetbrains.plugins.scala.lang.psi.implicits

import org.jetbrains.plugins.scala.lang.psi.types._
import org.jetbrains.plugins.scala.lang.resolve._
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil
import processor.{ImplicitProcessor, MostSpecificUtil}
import result.{Success, TypingContext}
import com.intellij.psi._
import org.jetbrains.plugins.scala.lang.psi.api.statements._
import org.jetbrains.plugins.scala.lang.psi.api.base.patterns.ScBindingPattern
import params.{ScParameterClause, ScParameter, ScTypeParam}
import util.PsiTreeUtil
import collection.immutable.HashSet
import org.jetbrains.plugins.scala.lang.psi.api.ScalaFile
import collection.mutable.ArrayBuffer
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScMember}

/**
 * @param place        The call site
 * @param tp           Search for an implicit definition of this type. May have type variables.
 * @param concreteType The type from which to determine the implicit scope.
 *
 * User: <NAME>
 * Date: 23.11.2009
 */
class ImplicitParametersCollector(place: PsiElement, tp: ScType, concreteType: ScType) {
  def collect: Seq[ScalaResolveResult] = {
    val processor = new ImplicitParametersProcessor
    def treeWalkUp(placeForTreeWalkUp: PsiElement, lastParent: PsiElement) {
      if (placeForTreeWalkUp == null) return
      if (!placeForTreeWalkUp.processDeclarations(processor,
        ResolveState.initial(), lastParent, place)) return
      treeWalkUp(placeForTreeWalkUp.getContext, placeForTreeWalkUp)
    }
    treeWalkUp(place, null) //collecting all references from scope

    val candidates = processor.candidatesS.toSeq
    if (!candidates.isEmpty) return candidates

    processor.clear()

    //todo: objects should be dependent
    for (obj <- ScalaPsiUtil.collectImplicitObjects(concreteType, place)) {
      processor.processType(obj, place, ResolveState.initial())
    }<commit_msg>cleanup<commit_after>package org.jetbrains.plugins.scala.lang.psi.implicits

import org.jetbrains.plugins.scala.lang.psi.types._
import org.jetbrains.plugins.scala.lang.resolve._
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil
import processor.{ImplicitProcessor, MostSpecificUtil}
import result.{Success, TypingContext}
import com.intellij.psi._
import org.jetbrains.plugins.scala.lang.psi.api.statements._
import org.jetbrains.plugins.scala.lang.psi.api.base.patterns.ScBindingPattern
import params.{ScParameterClause, ScParameter, ScTypeParam}
import util.PsiTreeUtil
import collection.immutable.HashSet
import org.jetbrains.plugins.scala.lang.psi.api.ScalaFile
import collection.mutable.ArrayBuffer
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScMember}

/**
 * @param place        The call site
 * @param tp           Search for an implicit definition of this type. May have type variables.
 * @param concreteType The type from which to determine the implicit scope.
 *
 * User: <NAME>
 * Date: 23.11.2009
 */
class ImplicitParametersCollector(place: PsiElement, tp: ScType, concreteType: ScType) {
  def collect: Seq[ScalaResolveResult] = {
    val processor = new ImplicitParametersProcessor
    def treeWalkUp(placeForTreeWalkUp: PsiElement, lastParent: PsiElement) {
      if (placeForTreeWalkUp == null) return
      if (!placeForTreeWalkUp.processDeclarations(processor,
        ResolveState.initial(), lastParent, place)) return
      treeWalkUp(placeForTreeWalkUp.getContext, placeForTreeWalkUp)
    }
    treeWalkUp(place, null) //collecting all references from scope

    val candidates = processor.candidatesS.toSeq
    if (!candidates.isEmpty) return candidates

    processor.clear()

    for (obj <- ScalaPsiUtil.collectImplicitObjects(concreteType, place)) {
      processor.processType(obj, place, ResolveState.initial())
    }
{'fraction_non_alphanumeric': 0.09602302459445317, 'fraction_numerical': 0.004186289900575615, 'mean_word_length': 4.723053892215569, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7154597', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1115, 'n_words': 249}