Commit Graph

96841 Commits

Author SHA1 Message Date
Vladimir Dolzhenko b4aa2aef00 Add ability to invalidate AbstractResolverForProject
#KTIJ-23785

Merge-request: KT-MR-7900
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2022-12-09 12:04:50 +00:00
Dmitriy Novozhilov 957987c16a [Test] Add testdata of AA tests to Test Helper plugin path 2022-12-09 12:02:09 +00:00
Dmitriy Novozhilov f8487ba545 [CLI] Filter out blank arguments from system environment 2022-12-09 12:02:09 +00:00
Dmitriy Novozhilov d898e256ca [FIR] Don't update explicit delegated constructor calls of classes with @JvmRecord
^KT-54573 Fixed
2022-12-09 12:02:08 +00:00
Dmitriy Novozhilov 880b278c40 [FIR] Deeply copy annotation type ref on COMPILER_REQUIRED_ANNOTATION_PHASE
The original idea was in resolving of annotation type ref using only
  importing scopes and accepting or discarding that resolution result
  depending on if this annotation is needed for compiler/plugins or not
But there is a problem that resolution of FirUserType with type resolver
  is not a pure operation: type resolver transforms qualifier parts which
  may contain type arguments, so if they were unresolved at the first
  resolve, they will stay unresolved forever. To prevent this we will
  deeply copy annotation type ref before first resolution

^KT-55286 Fixed
2022-12-09 12:02:08 +00:00
Dmitriy Novozhilov 2aad466d00 [FIR] Add test for KT-55286 2022-12-09 12:02:08 +00:00
Dmitriy Novozhilov a86bc425e5 [FIR2IR] Lookup for nested classes in scope in Fir2IrLazyClass
^KT-55269 Fixed
2022-12-09 12:02:07 +00:00
Dmitriy Novozhilov 866150a2e0 [FIR2IR] Add static functions to Fir2IrLazyClass.declarations
^KT-55269
2022-12-09 12:02:07 +00:00
Dmitriy Novozhilov 5d6cb2b691 [Test] Use IrPluginContext for searching declarations for DUMP_EXTERNAL_CLASS check 2022-12-09 12:02:07 +00:00
Dmitriy Novozhilov e7f6482857 [Test] Use DUMP_EXTERNAL_CLASS instead of invalid DUMP_DEPENDENCIES directive in ir text tests 2022-12-09 12:02:06 +00:00
Dmitriy Novozhilov 9946bfcdfd [FIR2IR] Properly handle error references in generation of receivers
^KT-53698 Fixed
2022-12-09 12:02:06 +00:00
Dmitriy Novozhilov f3da26946b [FIR] Change priority of K2_VISIBILITY_ERROR CandidateApplicability
In K1 analogue of `K2_VISIBILITY_ERROR` is `K1_RUNTIME_ERROR`, so
  candidates with `K2_VISIBILITY_ERROR` should win over innaplicable
  candidates with `INAPPLICABLE`, `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
  or `INAPPLICABLE_WRONG_RECEIVER` applicability

This is needed to allow resolution to invisible symbols (and later
  suppress error with `@Suppress("INVISIBLE_SYMBOL", "INVISIBLE_REFERENCE")`

^KT-55026 Fixed
^KT-55234
2022-12-09 12:02:05 +00:00
Dmitriy Novozhilov 6c6525ecde [FIR] Add test for KT-55026 2022-12-09 12:02:04 +00:00
Alexander Likhachev 0466fc536d [Gradle] Don't convert free compiler arguments to set, avoid args duplication
#KT-55363 Fixed
2022-12-09 10:59:14 +00:00
Alexander Likhachev a5810d88a5 [Gradle] Add an integration test for KT-55363 2022-12-09 10:59:14 +00:00
Pavel Mikhailovskii b31209a38a KT-51951 Add a test 2022-12-09 09:47:23 +00:00
Alexander Shabalin 01cabefea7 [K/N] Use configurations for interproject compdb deps ^KT-53776
Merge-request: KT-MR-7158
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-12-09 09:42:08 +00:00
Pavel Mikhailovskii 76997edebe KT-52373 Fix generation of synthetic functions with context receivers and default parameters 2022-12-09 09:39:26 +00:00
Sergey Bogolepov 4fa701f798 [K/N] Support caches and program outputs in dynamic driver
This commit mostly ports current phases "as-is", without any
moving them to an explicit I/O. It will be done later after static
driver removal.
2022-12-09 00:55:39 +00:00
Sergey Bogolepov bf89e27647 [K/N] Prepare dynamic driver for more output kinds
* Extract frontend and psi2ir into functions
* Prepare hacks for porting old phases to the dynamic driver
2022-12-09 00:55:38 +00:00
Troels Bjerre Lund bb1acf729b [K/N] Add custom allocator prototype ^KT-55364
Enable custom allocator with -Xallocator=custom.

If the gc is cms (default):
 * a patched version of the memory manager is used that does not build a
   list of allocated objects.
 * a patched version of the cms is used that defers to the allocator for
   sweeping.

Otherwise, a warning is printed, and the allocator is used using the
standard api.

Design doc:
https://docs.google.com/document/d/15xMp-nE-DWL8OrtOc8DoXB80AHUphFICEGjj5K0aNFc

Co-authored-by: Troels Lund <troels@google.com>

Merge-request: KOTLIN-MR-546
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2022-12-08 17:22:04 +00:00
Evgeniy.Zhelenskiy 40f38c8adb [IR] Eliminate redundant boxing/unboxing of MFVC after inlining
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-08 15:12:28 +00:00
Gleb Lukianets a3e396e7e4 [K/N] KT-53069: Guard against recursive generic type argument constraints during objc export
Merge-request: KT-MR-7872
Merged-by: Gleb Lukianets <Gleb.Lukianets@jetbrains.com>
2022-12-08 14:03:45 +00:00
Anton Lakotka 96e1ba045c [Gradle] Do not throw exceptions when getDependenciesTransformation...
is called. Some kotlin plugins (for example JS) re-use
DefaultKotlinSourceSet class for their source sets. However
DefaultKotlinSourceSet has an API that is connected to IDE import
particularly `getDependenciesTransformation`. Since Kotlin/JS doesn't
support metadata dependencies, and their transformations as well
we should lift strong requirement for compileDependenciesTransformation
to be set for each source set. Instead, just return empty list of
transformations.

^KT-55347 Verification Pending
2022-12-08 13:38:13 +00:00
Anton Lakotka 5347fc235b [Gradle, Test] GranularMetadataTransformation should be accessible in JS
Pure JS projects should still be able to import even thus calling
`getDependenciesTransformation` should not throw any runtime exceptions
and results should be empty. Since JS projects doesn't support metadata
dependencies transformations.

^KT-55347 In Progress
2022-12-08 13:38:13 +00:00
Egor Kulikov dbfe33c00d [FIR] Make default values for value parameters lazy in RawFirBuilder
Sixth step for ^KT-52615

Merge-request: KT-MR-7926
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-12-08 13:32:37 +00:00
Marco Pennekamp dbb02a9bfb [FIR] Fir2IrJsResultsConverter: Compute hasErrors of backend input
- This allows us to re-enable 3 tests.
2022-12-08 13:01:17 +00:00
Zalim Bashorov 49c3ba33f1 [Wasm] Add a basic end-to-end sourcemap generation in wasm backend
More constructions/instructions will be supported separately.
2022-12-08 12:44:26 +00:00
Leonid Startsev 1c4614e93b Handle situation where KSerializer is absent from immediate supertypes
of the class used in @UseSerializers: Use methods to receive
full list of supertypes.

K1 supertypes() call returned all supertypes, while
IrClass.supertypes and FirClassSymbol.resolvedSuperTypes return only immediate ones.

This lead to a difference in behavior between K1 and K2, and regression
after plugin backend was rewritten from descriptors to IR.

#KT-55340 Fixed
2022-12-08 12:15:16 +00:00
Leonid Startsev c011f0c374 Change throw AssertionError to error() that throws IllegalStateException
as ISE is more appropriate exception for validation.

Improve SerializerClassLowering.runPluginSafe so precise IrClass
where plugin have failed can be reported for non-fatal errors.

#KT-55296 Fixed
2022-12-08 12:15:16 +00:00
Pavel Punegov 7ee877f9aa [K/N][test] Improve simulator executor
Makes executor be able to find and download necessary runtimes and
create device with appropriate runtime available. Replaces device names
with identifiers


Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>

Merge-request: KT-MR-7919
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2022-12-08 11:11:00 +00:00
Yan Zhulanow c8e9cfde0b [FE] Read Java static field initializer lazily (KTIJ-23043) 2022-12-08 10:46:43 +00:00
Mikhail Mazurkevich dbddbab73c [jps] KT-55309 Inline storage initialization 2022-12-08 10:43:28 +00:00
Mikhail Mazurkevich dfead910b9 [jps] KT-55309 Remove obsolete NonCachingLazyStorage 2022-12-08 10:43:27 +00:00
Dmitriy Novozhilov 44fd9ddf85 [Test] Add test for KT-55338 2022-12-08 10:19:36 +00:00
pyos a3768b9185 FIR DFA: don't propagate reassignments of loop-scoped vars to outside 2022-12-08 10:19:36 +00:00
pyos 06b71f8300 FIR DFA: drop data flow edges from postponed lambdas in return values
This is a temporary hack to avoid compiler crashes in some code that
uses builder inference, conditional early returns from lambdas, and
expected types in a certain way. It is not correct - dropping data flow
edges never is - but it is much easier to implement for now than a
proper fix.
2022-12-08 10:19:36 +00:00
pyos f2347d1954 FIR DFA: use PersistentSet.Builder for exactType 2022-12-08 10:19:35 +00:00
pyos cc973f8c3f FIR DFA: merge LogicSystem and PersistentLogicSystem 2022-12-08 10:19:35 +00:00
pyos 9f4cfa2c50 FIR CFG: ignore exception edges when looking for return values
^KT-54668 Fixed
2022-12-08 10:19:34 +00:00
pyos 664a70ec13 FIR DFA: split flow for postponed lambdas from a single node
This removes the need for hacks around the order in which function
call arguments are visited, fixes called-in-place lambda arguments
for augmented assignment operators, and makes CFG dumps a bit prettier.
2022-12-08 10:19:34 +00:00
pyos 402ea98e02 FIR DFA: align FirLocalVariableAssignmentAnalyzer with the graph builder
I.e. maintain a set of seen lambdas where each marked as either "data
flow only" or "both data and control flow". The latter are truly
parallel with the function being analyzed, while the former have
technically already terminated, we just don't know the types inside them
because they may not have been analyzed yet.
2022-12-08 10:19:34 +00:00
pyos c231477375 FIR: don't call a graph builder method in finally
If an exception is thrown, trying to add more nodes to a graph that's
already missing entire subgraphs may not end well.
2022-12-08 10:19:33 +00:00
pyos 38c1ef30bc Minor: refactor FirPropertyInitializationAnalyzer
Still not sure how to implement visitUnionNode
2022-12-08 10:19:33 +00:00
pyos d66be3f82d FIR CFG: do not assume all arguments to inline funs are called in place
Only values for non-noinline, non-crossinline, functional type
parameters qualify.
2022-12-08 10:19:32 +00:00
pyos 39f88b9e87 FIR CFG: move the argument reordering hack to the expression transformer 2022-12-08 10:19:32 +00:00
pyos 9823473f63 Minor: remove a redundant transformArgumentList override 2022-12-08 10:19:32 +00:00
pyos c4c05f5248 FIR CFG: remove ordering from control flow through in-place lambdas
Old graph:

  arg -> lambda enter -> ... -> lambda exit -> lambda enter -> ... ->
   -> lambda exit -> call

New graph:

  arg -+-> lambda enter -> ... -> lambda exit -+-> call
       \-> lambda enter -> ... -> lambda exit -/
2022-12-08 10:19:31 +00:00
pyos 5dce772f0b FIR DFA: restructure handling of += to avoid losing data flow 2022-12-08 10:19:31 +00:00
pyos b2fe5831ed FIR DFA: use local function declaration nodes for non-argument lambdas 2022-12-08 10:19:30 +00:00