Commit Graph

90681 Commits

Author SHA1 Message Date
Ilya Kirillov d1335d3f44 Docs: add basic FIR compiler documentation
Originally written by Dmitriy Novozhilov
2022-01-21 15:56:47 +01:00
Anastasia.Shadrina 87b0670bbb [Tests] Add CompileKotlinAgainstCustomBinaries test for CR 2022-01-21 17:22:00 +03:00
Anastasia.Shadrina a86b4d767e [FE] KT-50878 Prohibit using contextual declarations without -Xcontext-receivers 2022-01-21 17:21:59 +03:00
Ivan Gavrilovic c93594331b [Gradle] Move some of the DSL to the API module
DSL exposed in the build scripts in effectively
an API, so this change moves it to the kotlin-gradle-plugin-api
subproject.

^KT-50869 In Progress
2022-01-21 16:57:23 +03:00
Dmitriy Novozhilov bb4f996467 Advance bootstrap to 1.7.0-dev-911 2022-01-21 15:44:04 +03:00
nataliya.valtman 791762d7ea Update kotlin report properties
-add kotlin.build.report.output to add file/http/build_scan reports
-all reports verbose by default
-verbose reports includes compiler metrics
-fix "custom value exceed length limit"
2022-01-21 09:43:21 +00:00
Ilya Goncharov 72656b49f4 [Gradle, JS] Fix Native test and not consider artifact in path 2022-01-21 09:17:41 +00:00
Ilya Goncharov 443c0bf74f [Gradle, JS] Fix case with multiple artifacts in module 2022-01-21 09:17:41 +00:00
Dmitriy Novozhilov bea2bc3980 [Parcelize] Move FIR related parts of parcelize to separate module
This is needed to avoid bundling of FIR classes to IDE plugin for
  parcelize, because it can cause compatibility issues, because
  IDE plugin does not contain FIR compiler
2022-01-21 10:22:39 +03:00
Mikhail Glukhikh 756ff6cf43 Minor performance improvements in tryToCompleteWithBuilderInference 2022-01-20 23:46:40 +03:00
Mikhail Glukhikh 98cdc95cd0 FIR DFA: exit delegate expression only after accessor completion
This commit fixes DFA problem (see test) when we accidentally try
to merge incoming flows from member property (val ... by cached ...) and
the following function. While completing lambda of buildList { ... }
inside by cached we accidentally assume that delegate is already left
and add the lambda into exitsFromCompletedPostponedAnonymousFunction.
This commit fixes the problem by exiting delegate later, after completion.
2022-01-20 23:46:39 +03:00
Mikhail Glukhikh c324bbfc37 FIR: fold two last getOrderedAllTypeVariables calls into one (stage 7,8)
This commit saves us some performance and fixes test for KT-35684.
FIR-based constraint completer at this moment can't extract type
variables from already completed calls.
Folding allows us to extract ordered type variables before completion.
2022-01-20 23:46:38 +03:00
Mikhail Glukhikh 7f62d1bc5a FIR: move down inference session handling in PostponedArgumentsAnalyzer
After this commit the handling of inference session in similar for
FIR and FE 1.0
2022-01-20 23:46:37 +03:00
Mikhail Glukhikh bd6fef7841 FIR: don't add partially resolved call in builder inference mode 2022-01-20 23:46:37 +03:00
Mikhail Glukhikh e8be9d4861 FIR: support don't use builder inference if possible
In this commit we upgrade FIR builder inference logic from
the compiler version to 1.7. FIR-based compiler now works with
"don't use builder inference" flag always ON and supports switching
the flag "use builder inference only if needed". To do it,
ContraintSystemCompleter (FIR) and KotlinConstraintSystemCompleter (FE 1.0)
are made similar with extracting some common parts into
ConstraintSystemCompletionContext.

Test status: one BB test fails after this commit (KT-49285).
Also we have a crush in DFA logic in FIR bootstrap test and somehow
questionable behavior in FIR diagnostic test. However,
two BB tests were fixed, the 3rd case from KT-49925 were also fixed.

#KT-49925 Fixed
2022-01-20 23:46:36 +03:00
Mikhail Glukhikh d2bfb7153e Add test from KT-49925 (example 3, fails yet) 2022-01-20 23:46:35 +03:00
Ilya Kirillov ce1e4f252f FIR: make transformInplace to be thread safe if no transformation was done
^KT-50822 fixed
2022-01-20 23:28:08 +03:00
Ilya Kirillov 0eda3d6cd5 LL API: fix unresolved class supertype from importing scope 2022-01-20 23:26:29 +03:00
Ilya Kirillov 3b943706d8 Analysis API: fix call resolve inside plusAssign target
^KT-50864 fixed
2022-01-20 23:26:28 +03:00
Ilya Kirillov db1dedc9fe LL API: add source element kind rendering to the GetOrBuildFirTest 2022-01-20 23:26:28 +03:00
Nikolay Krasko 87bf6e010e Use relative paths in stdlib klib artifacts
Intentionally use doFirst section to trick gradle and not affect
inputs with absolute path usage.

Old behaviour can be returned by kotlin.build.use.absolute.paths.in.klib
in local.properties

Should be removed after KT-50876 fix.

^KTI-730 In Progress
2022-01-20 21:50:20 +03:00
Igor Yakovlev b22190ccc1 [WASM] Initialize constant fields by wasm-initializers 2022-01-20 19:18:46 +03:00
Alexander Udalov f40a0ca704 JVM IR: avoid unnecessary toIrBasedKotlinType in ExpressionCodegen
Result of calling `ExpressionCodegen.gen` was used only in two call
sites in the inliner. In all other call sites, we were doing unnecessary
work (and sometimes were even failing) by trying to construct a
KotlinType instance out from an IrType.

Note that even though the code from KT-50617 no longer fails to compile,
the underlying problem is still not solved, since the IrType for foo's
dispatch receiver is constructed incorrectly. The reason is that
SymbolTable links everything by IdSignature, which is identical for
classes with the same FQ name.

 #KT-50617 Fixed
2022-01-20 16:05:42 +01:00
Yahor Berdnikau 5f22bcd03b Migrated ExecutionStrategyIT tests to new DSL
^KT-45745 In Progress
2022-01-20 14:20:57 +01:00
Dmitry Petrov 12d8b189a9 JVM_IR KT-50856 fix generic signature for SAM proxy function 2022-01-20 10:41:55 +00:00
Dmitriy Novozhilov cd578e9d13 [FIR] Fix inference in presence of Unit expected type 2022-01-20 11:25:47 +03:00
Dmitriy Novozhilov 8624d97f29 [FIR] Extract adding of constraints from expected type to separate method 2022-01-20 11:25:47 +03:00
Dmitriy Novozhilov def799cc4e [FIR] Fix inference of postponed lambdas if containg call has explicit type arguments 2022-01-20 11:25:46 +03:00
Dmitriy Novozhilov fbab32c4dd [FIR] Remove redundant nullability from findFunctionalTypesInConstraints return type 2022-01-20 11:25:46 +03:00
Dmitriy Novozhilov 7d8a8d543f [FIR] Fix processing calls on unstable smartcasts with check not null call 2022-01-20 11:25:45 +03:00
Dmitriy Novozhilov 1a3841d66d [FIR] Properly enhance raw Class type in java annotations 2022-01-20 11:25:44 +03:00
Dmitriy Novozhilov 239a330ddd [FE 1.0] Add test for KT-50850 2022-01-20 11:25:41 +03:00
Xin Wang 56e5db9f0e JVM_IR KT-50074 generate tableswitch for literal string subject of when expression 2022-01-19 22:25:49 +03:00
Alexander Shabalin 69bb2587eb [K/N] Make GC scheduler less aggressive
^KT-48537

Merge-request: KT-MR-5319
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-01-19 19:11:15 +00:00
Alexander Udalov 3e7b1c027f IR: make IrConst.copyWithOffsets an extension function
Co-authored-by: mcpiroman <mcpiroman@gmail.com>
2022-01-19 17:50:36 +01:00
Alexander Udalov 785eb83822 IR: refactor IrMemberAccessExpression internals
The idea is to keep the subclasses as simple as possible, to simplify
transition to auto-generated IR.

Co-authored-by: mcpiroman <mcpiroman@gmail.com>
2022-01-19 17:50:36 +01:00
Alexander Udalov 6f6bdd8aec IR: change acceptChildren/transformChildren order in IrClass
Traverse properties of supertypes first, and then handle thisReceiver.
This will simplify transition to auto-generated IR.
2022-01-19 17:50:35 +01:00
Alexander Udalov 4ecc5e517a IR: move some accept/acceptChildren/transformChildren to base classes
This will be helpful for the transition to auto-generated IR.

Co-authored-by: mcpiroman <mcpiroman@gmail.com>
2022-01-19 17:50:35 +01:00
Alexander Udalov 886545262b IR: use mutable lists in IrStringConcatenation, IrTry, IrVararg
Make addArgument/addElement/putElement extension functions. This will
simplify transition to auto-generated IR.

Co-authored-by: mcpiroman <mcpiroman@gmail.com>
2022-01-19 17:50:35 +01:00
Alexander Udalov 9ee570ae54 IR: update copyright in ir.tree declarations and expressions
To simplify review of the upcoming IR tree generator.

Note that copyright is dated 2021, since that's in
license/COPYRIGHT_HEADER.txt which is used by generators.
2022-01-19 17:50:35 +01:00
Alexander Udalov f17fc67683 IR: split files containing multiple classes/functions
This change only moves code around, no behavior is changed.
Specifically, ir.tree sources containing several declarations are split
into several files: one file per class, and one file for all extension
functions per package (IrDeclarations.kt, IrExpressions.kt,
IrVisitors.kt, IrConstructorCallTypeArguments.kt).

This is useful because after introducing IR tree generator, we can
easily see how generated sources are different from those which were
written manually, since Git will recognize file moves. Also, it will
keep Git history for sources which consisted of one big class + a couple
of extension functions (e.g. IrElementVisitorVoid.kt).
2022-01-19 17:50:35 +01:00
Alexander Udalov e4b63d4a2b IR: minor, rename some files to keep git history 2022-01-19 17:50:35 +01:00
Alexander Udalov 6445a29893 IR: remove type parameter in visitConst
Co-authored-by: mcpiroman <mcpiroman@gmail.com>
2022-01-19 17:50:35 +01:00
Alexander Udalov 81106526b1 IR: remove IrConstantObject.putArgument, IrConstantArray.putElement
Change `valueArguments` and `elements` types to be mutable lists. This
will simplify IR tree generator.
2022-01-19 17:50:35 +01:00
Pavel Punegov 816acaadc3 [K/N][samples] Properly disable HMPP for ^KT-50547
Properties file inside subproject isn't read. Moved to root
Fixup to 8d0b511e95
2022-01-19 16:10:10 +00:00
Yahor Berdnikau b3fba1faad Fix empty Android layout directories are not ignored
Kotlin Android extensions plugin adds layout directories as input to
KotlinCompile task when experimental flag is enabled. This breaks
cache relocation.

^KT-48849 Fixed
2022-01-19 15:47:33 +01:00
Ilya Gorbunov efa09cbd80 Update dokka version for building stdlib docs 2022-01-19 17:24:53 +03:00
Alexander Likhachev 5199981d96 [Gradle] Check JVM targets only if mixed Java/Kotlin sources are present
#KT-48408 Verification Pending
2022-01-19 14:16:19 +00:00
Alexander Likhachev b0d7c97ad2 [Gradle] Adjust test for KT-48408 to not fail without Kotlin sources 2022-01-19 14:16:18 +00:00
Alexander Likhachev d9b279e675 Revert "[Gradle, JVM] Validate JVM targets even if compiler isn't called"
This reverts commit aa52a60f
2022-01-19 14:16:18 +00:00