package Ġarrow . inject . compiler . plugin . fir Ċ Ċ import Ġarrow . inject . compiler . plugin . fir . collect ors . External Proof Collector Ċ import Ġarrow . inject . compiler . plugin . fir . collect ors . Local Proof Collectors Ċ import Ġarrow . inject . compiler . plugin . fir . resolution . resolver . Proof Cache Ċ import Ġarrow . inject . compiler . plugin . fir . resolution . resolver . Proof Resolution Result Ċ import Ġarrow . inject . compiler . plugin . fir . resolution . resolver . Proof Resolution Stage Runner Ċ import Ġarrow . inject . compiler . plugin . model . Proof Ċ import Ġarrow . inject . compiler . plugin . model . Proof Resolution Ċ import Ġarrow . inject . compiler . plugin . model . as Proof CacheKey Ċ import Ġorg . jetbrains . kotlin . fir . resolve . calls . Candidate Ċ import Ġorg . jetbrains . kotlin . fir . types . Con e Kotlin Type Ċ import Ġorg . jetbrains . kotlin . name . Fq Name Ċ Ċ internal Ġinterface ĠF ir Resolution Proof Ġ: ĠF ir Proof Id Signature Ġ{ ĊĊĠ Ġval Ġproof Cache : ĠPro of Cache ĊĊĠ Ġval Ġall Pro ofs : ĠList < Proof > ĊĊĠ Ġval Ġproof Resolution Stage Runner : ĠPro of Resolution Stage Runner ĊĠĠĠ Ġget () Ġ= ĠPro of Resolution Stage Runner ( session , Ġthis ) ĊĊĠ Ġval Ġall Collected Pro ofs : ĠList < Proof > ĊĠĠĠ Ġget () Ġ= ĊĠĠĠĠĠ Ġlocal Proof Collector . collect Local Pro ofs () Ġ+ Ġexternal Proof Collector . collect External Pro ofs () ĊĊĠ Ġval Ġlocal Proof Collector : ĠLocal Proof Collectors ĊĠĠĠ Ġget () Ġ= ĠLocal Proof Collectors ( session ) ĊĊĠ Ġval Ġexternal Proof Collector : ĠExternal Proof Collector ĊĠĠĠ Ġget () Ġ= ĠExternal Proof Collector ( session ) ĊĊĠ Ġfun Ġresolve Proof ( ĊĠĠĠ Ġcontext Fq Name : ĠF q Name , ĊĠĠĠ Ġtype : ĠC one Kotlin Type , ĊĠĠĠ Ġprevious Pro ofs : ĠMutable List < Proof > ĊĠ Ġ): ĠPro of Resolution Ġ{ ĊĠĠĠ Ġval Ġresolution Result Ġ= Ġresolution Result ( context Fq Name , Ġtype , Ġprevious Pro ofs ) ĊĠĠĠ Ġreturn Ġwhen Ġ( resolution Result ) Ġ{ ĊĠĠĠĠĠ Ġis ĠPro of Resolution Result . Candidates Ġ-> Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcandidates Ġ= Ġresolution Result . candidates ĊĠĠĠĠĠĠĠ Ġval Ġproof Resolution Ġ= Ġproof Candidate ( candidates , Ġtype , Ġresolution Result ) ĊĠĠĠĠĠĠĠ Ġval Ġcandidate Proof Ġ= Ġproof Resolution . proof ĊĠĠĠĠĠĠĠ Ġ// ĠTODO Ġif Ġ( candidate Proof Ġin Ġcycles ) ĠPro of Resolution ( candidate Proof , Ġtype , Ġempty List (), ĊĠĠĠĠĠĠĠ Ġ// Ġresolution Result ) ĊĠĠĠĠĠĠĠ Ġreturn Ġproof Resolution . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġproof Cache . put Proof Into Cache ( type . as Proof CacheKey ( context Fq Name ), Ġthis ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġis ĠPro of Resolution Result . Cycles Found Ġ-> Ġ{ ĊĠĠĠĠĠĠĠ ĠPro of Resolution ( resolution Result . proof , Ġtype , Ġempty List (), Ġresolution Result ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġresolution Result ( ĊĠĠĠ Ġcontext Fq Name : ĠF q Name , ĊĠĠĠ Ġtype : ĠC one Kotlin Type , ĊĠĠĠ Ġprevious Pro ofs : ĠMutable List < Proof > ĊĠ Ġ): ĠPro of Resolution Result Ġ= ĊĠĠĠ Ġproof Resolution Stage Runner . run Ġ{ ĊĠĠĠĠĠ Ġall Pro ofs ĊĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġcontext Fq Name Ġin Ġit . declaration . context Fq Names Ġ} ĊĠĠĠĠĠĠĠ Ġ. matching Candidates ( type , Ġprevious Pro ofs ) ĊĠĠĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġproof Candidate ( ĊĠĠĠ Ġcandidates : ĠSet < Candidate >, ĊĠĠĠ Ġtype : ĠC one Kotlin Type , ĊĠĠĠ Ġresolution Result : ĠPro of Resolution Result . Candidates , ĊĠ Ġ): ĠPro of Resolution Ġ{ ĊĠĠĠ Ġval Ġcandidate : ĠC andidate ? Ġ= Ġcandidates . first OrNull () ĊĊĠĠĠ Ġreturn ĠPro of Resolution ( ĊĠĠĠĠĠ Ġproof Ġ= Ġcandidate ?. as Proof (), ĊĠĠĠĠĠ Ġtarget Type Ġ= Ġtype , ĊĠĠĠĠĠ Ġambiguous Pro ofs Ġ= ĊĠĠĠĠĠĠĠ Ġcandidates . map Ġ{ ĠPro of . Imp lication ( it . symbol . fir . id Signature , Ġit . symbol . fir ) Ġ}, ĊĠĠĠĠĠ Ġresult Ġ= Ġresolution Result ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġfun ĠC andidate . as Proof (): ĠPro of Ġ= ĠPro of . Imp lication ( symbol . fir . id Signature , Ġsymbol . fir ) Ċ } Ċ