/* Ċ Ġ* ĠCopyright Ġ 2 0 1 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . Ġand ĠKotlin ĠProgramming ĠLanguage Ġcontributors . Ċ Ġ* ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe Ġlicense / LICENSE . txt Ġfile . Ċ Ġ*/ Ċ Ċ package Ġorg . jetbrains . kotlin . idea . fir . low . level . api . transformers Ċ Ċ import Ġorg . jetbrains . kotlin . fir . F ir Session Ċ import Ġorg . jetbrains . kotlin . fir . declarations .* Ċ import Ġorg . jetbrains . kotlin . fir . resolve . Resolution Mode Ċ import Ġorg . jetbrains . kotlin . fir . resolve . Scope Session Ċ import Ġorg . jetbrains . kotlin . fir . resolve . transformers . body . resolve . F ir Implicit Aware Body Resolve Transformer Ċ import Ġorg . jetbrains . kotlin . fir . resolve . transformers . body . resolve . F ir Tower DataContext Collector Ċ import Ġorg . jetbrains . kotlin . fir . resolve . transformers . body . resolve . Implicit Body Resolve Computation Session Ċ import Ġorg . jetbrains . kotlin . fir . resolve . transformers . body . resolve . create ReturnType Calculator For IDE Ċ import Ġorg . jetbrains . kotlin . fir . types . F ir Resolved Type Ref Ċ import Ġorg . jetbrains . kotlin . idea . fir . low . level . api . api . F ir Declaration Unt yped Design ation With File Ċ import Ġorg . jetbrains . kotlin . idea . fir . low . level . api . element . builder . F ir Ide Design ated Body Resolve Transformer For ReturnType Calculator Ċ import Ġorg . jetbrains . kotlin . idea . fir . low . level . api . util . ensure Target Phase Ċ Ċ internal Ġclass ĠF ir Design ated Implicit Types Transformer For IDE ( ĊĠĠĠ Ġprivate Ġval Ġdesign ation : ĠF ir Declaration Unt yped Design ation With File , ĊĠĠĠ Ġsession : ĠF ir Session , ĊĠĠĠ Ġscope Session : ĠScope Session , ĊĠĠĠ Ġto wer DataContext Collector : ĠF ir Tower DataContext Collector ? Ġ= Ġnull , ĊĠĠĠ Ġimplicit Body Resolve Computation Session : ĠImp licit Body Resolve Computation Session Ġ= ĠImp licit Body Resolve Computation Session (), Ċ ) Ġ: ĠF ir Lazy Transformer For IDE , ĠF ir Implicit Aware Body Resolve Transformer ( ĊĠĠĠ Ġsession , ĊĠĠĠ Ġimplicit Body Resolve Computation Session Ġ= Ġimplicit Body Resolve Computation Session , ĊĠĠĠ Ġphase Ġ= ĠF ir Resolve Phase . IMP LICIT _ TYPES _ BODY _ RESOL VE , ĊĠĠĠ Ġimplicit Type Only Ġ= Ġtrue , ĊĠĠĠ Ġscope Session Ġ= Ġscope Session , ĊĠĠĠ Ġfir Tower DataContext Collector Ġ= Ġto wer DataContext Collector , ĊĠĠĠ ĠreturnType Calculator Ġ= Ġcreate ReturnType Calculator For IDE ( ĊĠĠĠĠĠĠĠ Ġsession , ĊĠĠĠĠĠĠĠ Ġscope Session , ĊĠĠĠĠĠĠĠ Ġimplicit Body Resolve Computation Session , ĊĠĠĠĠĠĠĠ Ġ:: F ir Ide Design ated Body Resolve Transformer For ReturnType Calculator ĊĠĠĠ Ġ) Ċ ) Ġ{ ĊĠĠĠ Ġprivate Ġval Ġide Declaration Transformer Ġ= ĠIDE Declaration Transformer ( designation ) ĊĊĠĠĠ Ġ@ Suppress (" NAME _ SH ADO WING ") ĊĠĠĠ Ġoverride Ġfun Ġtransform Declaration Content ( declaration : ĠF ir Declaration , Ġdata : ĠResolution Mode ): ĠF ir Declaration Ġ= ĊĠĠĠĠĠĠĠ Ġide Declaration Transformer . transform Declaration Content ( this , Ġdeclaration , Ġdata ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsuper . transform Declaration Content ( declaration , Ġdata ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġneed Replace Phase ( fir Declaration : ĠF ir Declaration ): ĠBoolean Ġ= Ġide Declaration Transformer . need Replace Phase ĊĊĠĠĠ Ġoverride Ġfun Ġtransform Declaration () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( designation . declaration . resolve Phase Ġ>= ĠF ir Resolve Phase . IMP LICIT _ TYPES _ BODY _ RESOL VE ) Ġreturn ĊĠĠĠĠĠĠĠ Ġdesign ation . ensure Target Phase ( F ir Resolve Phase . CONTRACT S ) ĊĊĠĠĠĠĠĠĠ Ġwhen Ġ( val Ġdeclaration Ġ= Ġdesign ation . declaration ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠF ir Callable Declaration < *> Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// We Ġdon 't Ġneed Ġresolve Ġcallable Ġdeclaration Ġif Ġit Ġis Ġalready Ġresolved Ġ( for Ġex . Ġwith ĠTY PES ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( declaration . returnType Ref Ġis ĠF ir Resolved Type Ref ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdeclaration . replace Resolve Phase ( F ir Resolve Phase . IMP LICIT _ TYPES _ BODY _ RESOL VE ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠF ir Type Alias Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// Nothing Ġto Ġdo Ġwith Ġtype Ġalias Ġto Ġthis Ġphase ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdeclaration . replace Resolve Phase ( F ir Resolve Phase . IMP LICIT _ TYPES _ BODY _ RESOL VE ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġdesign ation . fir File . transform < F ir File , ĠResolution Mode >( this , ĠResolution Mode . Context In dependent ) ĊĠĠĠĠĠĠĠ Ġide Declaration Transformer . ensure Design ation Passed () ĊĊĠĠĠĠĠĠĠ Ġval Ġcallable Declaration Ġ= Ġdesign ation . declaration Ġas ? ĠF ir Callable Declaration < *> ĊĠĠĠĠĠĠĠ Ġcheck ( callable Declaration Ġ== Ġnull Ġ|| Ġcallable Declaration . returnType Ref Ġis ĠF ir Resolved Type Ref ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Callable Ġdeclaration Ġseems Ġto Ġbe Ġun resolved Ġafter Ġ${ F ir Resolve Phase . IMP LICIT _ TYPES _ BODY _ RESOL VE } Ġphase " ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġdesign ation . ensure Target Phase ( F ir Resolve Phase . IMP LICIT _ TYPES _ BODY _ RESOL VE ) ĊĠĠĠ Ġ} Ċ } Ċ