[LL API] Analyze code fragment in a separate 'FirSession'

Before, `KtCodeFragment`/`FirCodeFragment` was analyzed as a part of
its context `KtModule`. This has the following complications:

- In non-source sessions, diagnostic reporting is globally disabled.
  For code fragments, however, checking the code before passing it to
  the backend is essential.

- Special treatment for call ambiguities in libraries
  (`LLLibraryScopeAwareCallConflictResolverFactory`) becomes complicated
  as the conflict resolver has to be applied to a library module.

- `KtCodeFragment`s usually have a shorter lifetime than their own
  context. Caching may potentially be implemented differently for them.

^KT-61783 Fixed
This commit is contained in:
Yan Zhulanow
2023-09-04 22:16:33 +09:00
committed by Space Team
parent b32c083346
commit 715f7d1a35
10 changed files with 250 additions and 26 deletions
@@ -9,4 +9,4 @@ MODULE_FRAGMENT
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
CALL 'public final fun call (): kotlin.Unit declared in <root>.Foo' type=kotlin.Unit origin=null
$this: GET_OBJECT 'CLASS OBJECT name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Foo
$this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Foo
@@ -1 +1,2 @@
@Suppress("INVISIBLE_SETTER")
a = "bar"