Commit Graph

24 Commits

Author SHA1 Message Date
Alexander Udalov 3f034e8b67 Enable lightweight lambdas (aka invokedynamic) since 2.0
#KT-45375 Fixed
 #KT-58173 Open
2024-02-08 19:46:18 +00:00
Yan Zhulanow e001fa4e72 [Analysis API] Explicitly specify the context module in a directive 2024-01-30 11:41:26 +00:00
Yan Zhulanow 3cd04a9e9e [Analysis API] Migrate existing code fragment tests to the new API 2024-01-30 11:41:26 +00:00
Sergej Jaskiewicz ad9f7bf90e [IR] Don't use the GET_PROPERTY origin on IrGetField expressions.
This origin was set somewhat arbitrarily.
It actually only makes sense for `IrCall`s to property getters.
There were no places in lowerings that checked `IrGetField` expressions
for this origin value.

^KT-62500 Fixed
2024-01-16 09:26:27 +00:00
Yan Zhulanow 5179462632 [Analysis API] Support non-JVM platforms in code fragments
The 'evalJs' test is not available, as there is no proper support for
klib loading in non-standalone Analysis API yet.

^KT-64197 Fixed
2024-01-05 16:04:14 +00:00
Jinseong Jeon f5d2ce3022 AA: render containing file and JvmClassName 2023-12-21 15:34:34 +00:00
Yan Zhulanow 0944e8fc36 [Analysis API] Keep the collected 'FirTowerDataContext' mutable
'ContextCollector' is used for computing context of 'FirCodeFragment's.
Code fragments themselves might contain additional smart cast operations
that modify the context receiver stack.

^KT-63056 Fixed
2023-12-12 17:31:52 +00:00
Dmitriy Novozhilov 3dff232710 [FIR2IR] Generate IR for unbound symbols in allowNonCachedDeclarations mode
`allowNonCachedDeclarations` mode allows referring source declaration which
  does not belong to the set of sources passed to fir2ir (e.g. for debugger
  support). So if code refers to such declaration, fir2ir creates symbol
  for it but not the IR declaration itself
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov 8ccbbedbd5 [Test] Update debugger testdata because of KT-62521 2023-10-17 12:46:28 +00:00
Yan Zhulanow 715f7d1a35 [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
2023-09-22 12:20:05 +00:00
Yan Zhulanow 9ef58f2bdb [LL API] Collect syntax errors in 'KtFirCompilerFacility'
^KTIJ-27167 Fixed
2023-09-22 11:39:49 +00:00
Yan Zhulanow 40ecd4bc1e [fir2ir] Fix annotation conversion on partial module compilation
Backend requires annotation constructors to be fully resolved for the
'IrConst' default value lowering. However, in the IDE there is usually
no need in complete annotation class resolution.

^KTIJ-27061 Fixed
2023-09-18 19:48:08 +00:00
Yan Zhulanow 9514f8f873 [LL API] Fix analysis of functions inside code fragments
FirDeclarationsResolveTransformer.transformSimpleFunction() performs
proper local function analysis only if the parent is properly set.

^KTIJ-26608 Fixed
2023-09-12 13:08:49 +00:00
Yan Zhulanow 11096325c8 [LL API] Fix 'this' capturing inside property accessors
^KTIJ-26726 Fixed
2023-09-12 08:47:28 +00:00
Yan Zhulanow 5559a0754d [LL API] Handle smart casts correctly on 'FirCodeFragment' analysis 2023-09-04 15:47:56 +00:00
Yan Zhulanow b96c1a644f [LL API] Fix code fragment compilation in library sources (KT-61383)
In complex projects, there might be several library copies (with the
same or different versions). As there is no way to build a reliable
dependency graph between libraries, a project library depends on all
other libraries. As a result, there might be several declarations in the
classpath with the same name and signature.

Normally, K2 issues a 'resolution ambiguity' error on calls to such
libraries. It is acceptable for resolution, as resolution errors are
never shown in the library code. However, the backend, to which
'evaluate expression' needs to pass FIR afterwards, is not designed for
compiling ambiguous (and non-completed) calls.
2023-08-30 06:38:44 +00:00
Yan Zhulanow 4b80c2197f [Analysis API] Run code fragment compilation tests against libraries 2023-08-30 06:38:44 +00:00
Yan Zhulanow 705a97e9d4 [Analysis API] Fix test data for context receivers
Currently, the test files are only analyzed as source code, and present
errors do not affect code fragment analysis. In the following commits,
however, the test files will be compiled to test code fragment
analysis against library sources.
2023-08-30 06:38:43 +00:00
Alexey Merkulov 3d92d0d05f [LL API] Fix value capturing for multiple receivers
There were problem when 'this' bound symbol was used twice for a call

KT-61144
2023-08-14 15:22:43 +00:00
Alexey Merkulov 35eca56d32 [fir2ir] Fix field-receiver extracting for evaluator
KT-61144
2023-08-14 15:22:43 +00:00
Alexey Merkulov e4ae15b3f0 [FIR] Allow resolve to private members from debugger evaluator
KT-60714
2023-08-10 13:40:52 +00:00
Yan Zhulanow 5a67b0d7dc [LL API] Correct used IR symbols in code fragments
As 'FirCodeFragments' are converted to IR independently of its context,
in some cases duplicate (and not quite correct) symbols for local
classes and functions are created.

Until properly fixed in fir2ir, here we replace such duplicates with
original symbols.
2023-08-08 17:26:39 +00:00
Yan Zhulanow ee7e6b0fce [LL API] Ignore local functions in 'CodeFragmentDeclarationCollector'
In the old JVM backend, local functions were compiled as JVM classes,
so there were an instance to pass around. Today, they are compiled to
static functions in the containing class/facade, and calls to them
compile natively.
2023-08-08 17:26:38 +00:00
Yan Zhulanow e1db3c88cf [LL API] Support code fragment compilation 2023-08-07 16:22:01 +00:00