Compare commits

...

4506 Commits

Author SHA1 Message Date
Ilya Gorbunov
4a17228621 Infer required kotlin-test jvm capability based on used test framework
Except when:
- the Gradle version is less than 6.0, it doesn't read the metadata
published by a newer Gradle by default.
- the requested dependency version is less than 1.5, because it doesn't
have metadata published.

Update integration tests to use kotlin-test common dependency.

KT-40225
2021-02-01 16:50:05 +03:00
Ilya Gorbunov
cbeadba15d Disable metadata publishing for legacy common artifacts
When they are used explicitly in common source sets, they cannot be
resolved in platform ones after that since they only have
common kotlin-api variants in their metadata.

KT-40225
2021-02-01 16:50:05 +03:00
Ilya Gorbunov
573aac7252 Apply common configuration to custom publications in kotlin-test
To do that, extract parts of publishing setup into reusable functions.
This change makes signing and repository configuration applied to all
project publications, not just to the Main one.

Also:
- Get rid of dependencies from non-default variants in the root pom
- Add an empty javadoc jar

KT-40225
2021-02-01 16:50:05 +03:00
Ilya Gorbunov
a16aaa3824 Setup publications with MPP Gradle metadata for kotlin-test library
Move publication configuration from individual platform specific
kotlin-test- modules to the root module.

KT-40225
2021-02-01 16:50:05 +03:00
Vladimir Dolzhenko
913c298be8 Kotlin highlight passes are reworked
#KT-37702 Fixed
2021-02-01 13:18:38 +00:00
Vladimir Dolzhenko
558338f997 Lazy diagnostics API in frontend
Relates to #KT-37702
2021-02-01 13:18:37 +00:00
Pavel Kirpichenkov
8f675fe757 Split combined test into two to avoid flaky behaviour
Prevent simultaneous access to the library directory
2021-02-01 15:09:13 +03:00
eugenpolytechnic
9ad88a5a0d FIR: introduce parameter type is Throwable check 2021-02-01 15:07:21 +03:00
eugenpolytechnic
5c0231b727 FIR: introduce CatchParameterChecker 2021-02-01 15:07:13 +03:00
Alexander Udalov
d8549d6292 Build: fix inaccurate change to the logic of useIRForLibraries 2021-02-01 11:54:36 +01:00
Alexander Udalov
e9436da858 Change logic of applying JVM target from AGP options
Now that the default JVM target is 1.8, we have to add the JVM target
1.6 explicitly if the Android project is configured with source/target
1.6, and not do anything if it's configured with 1.8.

 #KT-31027
2021-02-01 11:54:05 +01:00
Alexander Udalov
adfa8c788c Light classes: use JVM target from the module
Using "JVM_1_8" always resulted in incorrect mapping of Kotlin
annotation targets to Java element types.

The change in AbstractKotlinRenderLogTest is needed because while
CliTraceHolder.module is technically a descriptor leak, it was never
detected by this test accidentally, because of the depth cutoff equal to
10, which started to not be enough after the minor refactoring of
replacing `Delegates.notNull` with `lateinit`.
2021-02-01 11:54:05 +01:00
Alexander Udalov
64e97225b8 Light classes: map annotation targets depending on JVM target
Since the default JVM target (`JvmTarget.DEFAULT`) is now 1.8, the
changed test started to fail. This change fixes it.
2021-02-01 11:54:04 +01:00
Alexander Udalov
d022bb0248 Switch default JVM target to 1.8
#KT-29405 Fixed
2021-02-01 11:54:04 +01:00
Ivan Gavrilovic
509ed64917 KT-43686: Make kapt Gradle task cacheable across machines
Use `@Classpath` for kotlin stdlib input property. This is to
allow cache hits when builds are running on different machines
and path to kotlin stdlib differs.

Test: BuildCacheRelocationIT
2021-02-01 13:28:20 +03:00
Dmitriy Novozhilov
771600077c [Test] Fail if there are changes in generated fir tree files in teamcity build 2021-02-01 10:18:37 +03:00
Dmitriy Novozhilov
297288e984 [Test] Don't generate new files in GeneratorsFileUtil in teamcity mode 2021-02-01 10:18:37 +03:00
Dmitriy Novozhilov
772ca2715c [Test] Don't change testdata in FirIdenticalChecker in teamcity mode 2021-02-01 10:18:37 +03:00
Alexander Gorshenev
6265ac8c19 Re-enabled disabled test 2021-01-30 17:41:54 +03:00
Alexander Gorshenev
16b3fedcd4 Created AbstractKlibBinaryCompatibilityTest and AbstractJsKlibBinaryCompatibilityTest
A common test runner for klib binary compatibility tests
and its js counterpart
2021-01-30 17:41:54 +03:00
Alexander Udalov
e7cf34a2a9 Workaround illegal access problem in daemon for JDK 17-ea
Otherwise Kotlin cannot be used in Gradle since
https://github.com/openjdk/jdk/commit/ed4c4ee7 where JDK internals
started to be encapsulated by default.

For some reason, using

    listOf("--add-opens", "java.base/java.util=ALL-UNNAMED")

doesn't help, so use the more general `--illegal-access=permit`.

 #KT-43704
2021-01-29 21:29:08 +01:00
Alexander Udalov
f08733eb75 CLI: suppress warning on JDK 9+ with illegal access to ResourceBundle
The underlying issue is tracked in IDEA-248785.

 #KT-43704 Fixed
2021-01-29 21:29:08 +01:00
Alexander Udalov
2ef4ca4e6e CLI: do not pass -noverify to java process starting from JDK 13
#KT-44232 Fixed
2021-01-29 21:28:25 +01:00
Alexander Udalov
2bbe3db041 Update copyrights in CLI scripts 2021-01-29 21:27:28 +01:00
Mikhael Bogdanov
9f9c8e3d77 Mute stream api test on Android 2021-01-29 18:22:16 +01:00
Dmitriy Novozhilov
21f022dec2 Add :kotlin-scripting-compiler.test to modules with disabled -Werror flag 2021-01-29 20:01:01 +03:00
Sergey Igushkin
021a63827d Add API version 1.5 to accepted values in MPP language settings 2021-01-29 19:49:45 +03:00
Mikhael Bogdanov
6a29097a8c Remove obsolete dependency for dx 2021-01-29 17:47:37 +01:00
Mikhael Bogdanov
be9ef8f3c8 Remove obsolete DxChecker 2021-01-29 17:47:37 +01:00
Steven Schäfer
482e217b5e JVM IR: Fix inline class mangling for calls to internal functions
...in a different module, e.g., using -Xfriend-paths.
2021-01-29 16:23:15 +01:00
Mikhail Glukhikh
6747084fe2 FIR TEST: perform more accurate check on file identity 2021-01-29 16:57:14 +03:00
Mikhail Glukhikh
338aad98eb FIR: run diagnostic "with stdlib" tests also in light tree mode 2021-01-29 16:55:34 +03:00
Mikhail Glukhikh
7d4eaefd36 FIR: report UNSAFE_CALL on dot when possible 2021-01-29 16:55:26 +03:00
Mikhail Glukhikh
0ee4f1f393 FIR: more exact nullability determination in potential UNSAFE_CALL check 2021-01-29 16:55:09 +03:00
Jinseong Jeon
e72ddbcbfe FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00
Mikhail Glukhikh
4b823eca21 Fix test data (FIR_IDENTICAL) 2021-01-29 16:54:17 +03:00
Mikhael Bogdanov
3e1fabd46c Set ANDROID_SDK_ROOT for android box tests 2021-01-29 14:30:24 +01:00
Dmitriy Novozhilov
4a50dc9074 Add workaround for problem with initialization of :tools:kotlinp 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
e8068b5576 Update testdata of maven plugin tests 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
0a47b1c32b Remove incorrectly added dependency on experimental coroutines 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
0769157a16 Revert "Revert "Build: enable -Werror in stdlib/core/compiler/plugins modules""
This reverts commit 1300ec3e
2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
7e3802bde3 Advance bootstrap to 1.5.0-dev-2205 2021-01-29 14:57:07 +03:00
Mikhael Bogdanov
c5baf3fdd2 Upgrade gradle plugin to 4.1. and build tools to 29.0.3 for android box tests 2021-01-29 11:57:51 +01:00
Mikhael Bogdanov
9459f8113f Set ANDROID_HOME/ANDROID_SDK_ROOT for android box tests
In some cases emulator execution on TC fails cause of problem with pathes
2021-01-29 11:57:51 +01:00
Ilya Goncharov
fd29fab971 [Gradle, JS] Update tool versions
- Node.js - 14.15.4
- Yarn - 1.22.10

^KT-44614 fixed
2021-01-29 13:57:17 +03:00
Victor Petukhov
9efac8f68b Propagate all annotations during creating simple functional types
^KT-44563 Fixed
2021-01-29 13:50:46 +03:00
Dmitry Petrov
5d7dc5fa39 JVM_IR indy-SAM conversions: minor updates
See: KT-44575 KT-44577

KT-44278 KT-26060 KT-42621
2021-01-29 12:59:48 +03:00
Dmitry Petrov
f34224ecee JVM_IR indy-SAM conversions: tests for function references equality
(SAM conversion using LambdaMetafactory is not used for function refs).

KT-44278 KT-26060 KT-42621
2021-01-29 12:59:48 +03:00
Dmitry Petrov
f0abd8bc68 JVM_IR indy-SAM conversions: prohibit in crossinline lambdas
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:47 +03:00
Dmitry Petrov
ad1d80d700 JVM_IR indy-SAM conversions: add more tests
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:47 +03:00
Dmitry Petrov
98b0c07b18 JVM_IR indy-SAM conversions: inline funs and lambdas
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:47 +03:00
Dmitry Petrov
4da2f3d9d4 JVM_IR indy-SAM conversions: use old scheme for suspend funs
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:46 +03:00
Dmitry Petrov
1f16b96796 JVM_IR indy-SAM conversions: inline classes
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:46 +03:00
Dmitry Petrov
f30e25aa52 JVM_IR indy-SAM conversions: more cases
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:45 +03:00
Dmitry Petrov
3140cca050 JVM_IR indy-SAM conversions, 1st passing tests
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:45 +03:00
Ilya Goncharov
c13949d322 [Gradle, JS] Move incremental test into non-ir js tests and add module name into 2js plugin
[Gradle, JS] Fix tests for incremental compilation of IR klib dir

[Gradle, JS] Add hack of outputFile into kotlin2js plugin

[Gradle, JS] Remove producing klib-dir

[Gradle, JS] Try to fix outputFileOrNull in JS compile

Because on clean run, file is not yet created, isFile check is incorrect
2021-01-29 12:22:54 +03:00
Denis.Zharkov
7e6abffb62 FIR: Fix incorrectly serialized type
See the test added: there's a non-denotable T!! type inside flexible type
that wasn't handled before.

ConeKotlinType::contains handles flexible types content and some other cases
Also, it has better asymptotics
2021-01-29 10:50:23 +03:00
Denis.Zharkov
1e0d9f4075 FIR2IR: Do not add implicit casts for types with different nullability
For smart casts, elvises, etc., there are no implicit casts in psi2fir
in changed test data
2021-01-29 10:50:22 +03:00
Denis.Zharkov
5c62ee4ba8 FIR2IR: Fix complex cases of smart cast expressions used as dispatch receiver
It might be not only <ExpressionWithSmartCast>(a).foo(), but also
id(<ExpressionWithSmartCast>(a)).foo() and many other cases
2021-01-29 10:50:22 +03:00
Denis.Zharkov
b3b1eb57ae FIR2IR: Simplify Fir2IrImplicitCastInserter::convertToImplicitCastExpression
Use dispatchReceiverType instead of looking into scopes
2021-01-29 10:50:22 +03:00
Denis.Zharkov
71596a08b3 FIR2IR: Simplify Fir2IrImplicitCastInserter 2021-01-29 10:50:22 +03:00
Denis.Zharkov
aab85121e2 Minor. Add clarification comment to MainFunctionDetector 2021-01-29 10:50:22 +03:00
Denis.Zharkov
b1b89e6f5f FIR2IR: Fix smart-cast approximation implicit receiver
Previously, it was always cast to the first type of smart cast variants list
independently of callee symbol that might be present in the member scope
of a different type
2021-01-29 10:50:22 +03:00
Denis.Zharkov
d9f45fdf9e FIR2IR: Fix incorrect fake override structure for delegated member in supertype
In C, fake override for `name` should have B::name as base symbol, not Named::name
2021-01-29 10:50:21 +03:00
Mikhael Bogdanov
844d2572e5 Don't run dx test in emulator 2021-01-29 08:48:30 +01:00
Mikhael Bogdanov
1c612376dd Disable some android box test 2021-01-28 18:30:48 +01:00
Mikhael Bogdanov
0ad24f5346 Enable Android box test 2021-01-28 18:01:21 +01:00
Mikhael Bogdanov
b16b1b3b78 Test for obsolete KT-26360
#KT-26360
2021-01-28 18:01:21 +01:00
Mikhael Bogdanov
bea29d0de5 Add test for KT-44074
#KT-44074
2021-01-28 18:01:21 +01:00
Ilya Goncharov
5fa9acc17a [JS IR] Add additional exported declarations inside dce loop
[JS IR] Remove useless filter in dce for more log information

^KT-44469 fixed
2021-01-28 18:56:34 +03:00
Ilya Goncharov
d88d1d048e [JS IR] Context to NameTables for stable names in additional exported declarations
[JS IR] BridgesConstruction with generic without cast

^KT-44469 fixed
2021-01-28 18:56:21 +03:00
Ilya Goncharov
f186047101 [JS IR] Add additional exported declarations with exported stub to dce
^KT-44469 fixed
2021-01-28 18:56:01 +03:00
Ilya Goncharov
6e98b81f3a [JS IR] Use recursive isExported for stable name detection
^KT-44469 fixed
2021-01-28 18:55:48 +03:00
Ilya Goncharov
977781fa49 [JS IR] Add tests with export all file and export nested class
[JS IR] Skip dce driven for nested classes export

^KT-44469 fixed
2021-01-28 18:55:33 +03:00
Ilya Kirillov
1b68f35f7c FIR: create new ConeTypeCheckerContext on every supertypes calculation
It can be recursively used while calculating supertypes via IDE lazy resolve,
which is forbidden
2021-01-28 13:52:04 +01:00
Mikhail Glukhikh
1c80c5610d FIR: fix serialization of accessor with source-level annotations 2021-01-28 13:21:16 +03:00
Dmitriy Novozhilov
72b07c727b fixup! Add runtime dependency on experimental coroutines to :kotlin-scripting-compiler-impl 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
4389cc7787 Update testdata of maven plugin tests 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
8b892a46c9 Update testdata of maven plugin test 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
f740e4141c Temporary force building all libraries with old backend 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
71d8b842fd Add runtime dependency on experimental coroutines to :kotlin-scripting-compiler-impl
This is needed to keep compatibility with old gradle versions which
  are steel using kotlin 1.2 with experimental coroutines
2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
17230397e6 [Test] Update or drop some IDE tests about experimental coroutines 2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
bc3b791cd8 [TMP] Remove :kotlin-coroutines-experimental-compat module 2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
1300ec3e45 Revert "Build: enable -Werror in stdlib/core/compiler/plugins modules"
This reverts commit 3be62dfc
2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
f3364ec602 [TD] Update testdata according to KT-44546 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
299272fa6d [Test] Update diagnostics testdata according to allowed suspend fun interfaces 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
a253b9508e Mute some ultra light classes tests according to KT-44472 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
c0bc492029 Mute some script tests according to KT-44471 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
95aa8dc85a Fix detecting of non-physical files in ClassFileFactory 2021-01-28 13:19:32 +03:00
Dmitriy Novozhilov
3b97835b74 Disable -Werror for :compiler:cli module
This is needed because we should compile cli with target version
  (which is deprecated now) for compatibility with gradle
2021-01-28 13:19:32 +03:00
Dmitriy Novozhilov
2c3031f981 [Test] Mute IC with circular dependencies with JVM IR backend 2021-01-28 13:19:32 +03:00
Victor Petukhov
ba44ad1aa3 Approximate anonymous return types for private inline functions to explicit supertype or Any (KT-33917) 2021-01-28 13:19:32 +03:00
Victor Petukhov
670f029bdf Allow passing non-spread arrays into a vararg parameter after sam properly, through propagating vararg element type to a sam adapter from the original parameter descriptor 2021-01-28 13:19:31 +03:00
Victor Petukhov
af3eaf5d71 Add explicit disabling ProhibitVarargAsArrayAfterSamArgument feature in tests as it's enabled by default in 1.5 2021-01-28 13:19:31 +03:00
Victor Petukhov
e39bbcd937 Unmute test which checks the evaluation order of value arguments with varargs.
The corresponding feature (UseCorrectExecutionOrderForVarargArguments) is enabled by default in 1.5.
2021-01-28 13:19:31 +03:00
Dmitriy Novozhilov
4f8b12c96f [Test] Fix various tests according to switching to kotlin 1.5 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
64100eec07 [Test] Add workaround for KT-44359 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
ffc585ad5c [Debugger] Fix compiler option for disabling IR backend in tests 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
cd93b2f39b Use old backend in script compilation context 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
ee1aff1012 [Test] Update different testdata according to changes in sealed classes 2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
81fd8b5940 [IR] Fix undeterministic order in signature clash reporting 2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
6a2796b067 [Test] Fix source maps in testdata according to KT-37704 2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
a6600cef47 [Test] Remove some outdated tests from LocalInspectionTestGenerated
Those tests are referring to outdated language features which are
  meaningless for language version 1.5
2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
a9ef8bb32f [IDE] Update SuperClassNotInitialized to relaxed restrictions on sealed classes 2021-01-28 13:19:28 +03:00
Dmitriy Novozhilov
16e0c0b820 [Test] Update testdata of quickfix tests related to sealed classes 2021-01-28 13:19:28 +03:00
Dmitriy Novozhilov
7632c11745 Enforce using old backend in JvmCliReplShellExtension 2021-01-28 13:19:28 +03:00
Dmitriy Novozhilov
c6039d76d3 Enforce using old backend in JvmAbiAnalysisHandlerExtension 2021-01-28 13:19:27 +03:00
Alexander Udalov
f350e9dacb Fix rendering of metadata of multifile facades in classFilesComparison.kt
Multifile facades (class files with header kind MULTIFILE_CLASS) have
the list of their parts in the d1 field (KotlinClassHeader.data), not
some byte-encoded protobuf message which this code was trying to
deserialize previously.
2021-01-28 13:19:27 +03:00
Alexander Udalov
1deb317e0d Update and regenerate incremental compilation tests for 1.5
Set TargetBackend.JVM_IR for these tests by default; remove the
generated IR-based test and add a new old-backend-based test. This fixes
the issue where some (3) of these tests were not properly ignored
because of incorrect target backend used in the test generator.

Also update test data for some tests which use local functions, which
are not generated to separate anonymous classes in JVM IR.
2021-01-28 13:19:27 +03:00
Alexander Udalov
4dff7e648f Minor, restore abiStabilityUnstableWithOldBackend CLI test
Add -Xuse-old-backend to make it pass with LV=1.5 where JVM IR is
enabled by default.
2021-01-28 13:19:26 +03:00
Alexander Udalov
d87d0cceae JVM IR: report all sources as outputs for .kotlin_module file
This fixes some tests for LV=1.5 in KotlinJpsBuildTest,
KotlinJpsBuildTestIncremental, IncrementalJvmJpsTestGenerated,
IncrementalCacheVersionChangedTestGenerated.

 #KT-42069 Fixed
2021-01-28 13:19:26 +03:00
Dmitriy Novozhilov
f3393eae1b [Test] Update testdata of CompileKotlinAgainstCustomBinariesTest 2021-01-28 13:19:26 +03:00
Dmitriy Novozhilov
9b80a552e9 [Test] Update testdata of spec tests 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
73e6d42224 [Test] Update CLI tests according to new default language version 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
5122e748c1 Add workaround for KT-44316 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
facc52fe49 Introduce ApiVersion.KOTLIN_1_5 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
f14bd87ecc [Test] Update testdata of diagnostic tests during to change language to 1.5
Mostly this commit contains changes of descriptor dump of sealed classes
  tests according to changed visibility of sealed class constructor
2021-01-28 13:19:24 +03:00
Dmitriy Novozhilov
d7cfd9c188 Switch latest stable version to 1.5 2021-01-28 13:19:24 +03:00
Dmitriy Novozhilov
5098eb84af Switch IS_PRE_RELEASE flag to true
#KT-44284 Fixed
2021-01-28 13:19:24 +03:00
Kristoffer Andersen
836261ba6e [Test] Ignore test infrastucture sources in debugging tests
This solves no immediate deficiency, but is a to-do that arose as part
of an ongoing effort to port the old, slightly too restrictive
checkLocalVariableTable tests to the more "functional" debugger
infrastructure.

This just shaves a little bit of overhead off the test expectations
and couples them less tightly to the specifics of the test
infrastructure.
2021-01-28 08:09:42 +01:00
Abduqodiri Qurbonzoda
46b7a774b5 Commonize CharCategory and related functions #KT-39177 #KT-43216 #KT-39906 #KT-30652 2021-01-28 01:41:24 +03:00
Ilya Kirillov
9b429fb535 FIR IDE: update testdata 2021-01-27 21:27:00 +01:00
Ilya Kirillov
1d167e4bc5 FIR: enable inline classes support in kotlin.compiler.fir.tree module 2021-01-27 21:26:59 +01:00
Ilya Kirillov
c53d6ed5d2 FIR: remove SymbolProviderCache as it is unused now 2021-01-27 21:26:59 +01:00
Ilya Kirillov
9f5b46cc76 FIR: use MutableMap in JavaSymbolProvider.parentClassTypeParameterStackCache as temp solution
parentClassTypeParameterStackCache will be soon removed
as will SymbolProviderCache
2021-01-27 21:26:59 +01:00
Ilya Kirillov
6a83b8b5a4 FIR: migrate FirDependenciesSymbolProviderImpl to FirCachesFactory 2021-01-27 21:26:59 +01:00
Ilya Kirillov
6543429b9a FIR: use FirCachesFactory for package parts cache in KotlinDeserializedJvmSymbolsProvider 2021-01-27 21:26:59 +01:00
Ilya Kirillov
32ae395e05 FIR: use FirCachesFactory for package type alias in KotlinDeserializedJvmSymbolsProvider 2021-01-27 21:26:58 +01:00
Ilya Kirillov
b270d66f68 FIR: use FirCachesFactory for
class cache in KotlinDeserializedJvmSymbolsProvider
2021-01-27 21:26:58 +01:00
Ilya Kirillov
3cee5e848a FIR: encapsulate annotation loading in KotlinDeserializedJvmSymbolsProvider.knownClassNamesInPackage into class 2021-01-27 21:26:58 +01:00
Ilya Kirillov
169134655a FIR: encapsulate KotlinDeserializedJvmSymbolsProvider.knownClassNamesInPackage into class 2021-01-27 21:26:58 +01:00
Ilya Kirillov
7284acc9f9 FIR IDE: use FirCaches in JavaSymbolProvider 2021-01-27 21:26:58 +01:00
Ilya Kirillov
1fef5859e3 FIR IDE: implement thread safe fir caches for IDE 2021-01-27 21:26:58 +01:00
Ilya Kirillov
191a948ffe FIR: introduce caches factory 2021-01-27 21:26:57 +01:00
Ilya Kirillov
2f12b8f87f FIR: refactoring, move class Java class building to separate fun 2021-01-27 21:15:28 +01:00
Mikhail Glukhikh
93436c1341 FIR: optimize / simplify member checkers 2021-01-27 19:46:06 +03:00
Jinseong Jeon
97241599bf FIR checker: add support diagnostic: EXPECTED_PRIVATE_DECLARATION 2021-01-27 19:46:06 +03:00
Jinseong Jeon
57c8dd86a0 FIR checker: introduce top-level property checkers
Also, refactor property initializer checking so that those
newly added property checkers as well as member property checker
can share the same logic
2021-01-27 19:46:06 +03:00
Jinseong Jeon
f9378a3ab7 FIR checker: add diagnostic EXPECTED_DECLARATION_WITH_BODY 2021-01-27 19:46:06 +03:00
Jinseong Jeon
9341ca3004 FIR checker: introduce top-level function checker 2021-01-27 19:46:05 +03:00
Mikhail Glukhikh
df68f319bc FIR LT: simplify defaultValue() search 2021-01-27 19:46:05 +03:00
Jinseong Jeon
8b4f2b269c FIR checker: introduce PARAMETER_* positioning strategies
and use them to add support diagnostics:
ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE
USELESS_VARARG_ON_PARAMETER
2021-01-27 19:46:05 +03:00
Mikhail Glukhikh
33b7c68a21 Add FIR_IDENTICAL to kt44440.kt test 2021-01-27 19:45:27 +03:00
Victor Petukhov
977ac7cbe7 Propagate nullness flexibility into the result type from type variables in other constraints during result type finding, to prevent variable fixation to less flexible type
^KT-44540 Fixed
2021-01-27 17:23:15 +03:00
Mikhail Glukhikh
ce1f9882df FIR2IR: Fix mapping for intersection overrides of deserialized functions 2021-01-27 15:42:04 +03:00
Svyatoslav Kuzmich
4bde884844 [JS IR] Use non-persistent IR for non-dce-driven mode
Eliminate overhead of persistency that we don't use in this mode.
2021-01-27 14:58:33 +03:00
Svyatoslav Kuzmich
02615ec569 [JS IR] Fix: Use proper parameter in ExportedDefaultParameterStub 2021-01-27 14:57:42 +03:00
Roman Golyshev
75ed167566 FIR IDE: Use FirModuleResolveState instead of TowerDataContextProvider
This way we will have a single place to get information about scopes,
so in the future it would be easier to refactor it
2021-01-27 08:02:53 +00:00
Roman Golyshev
dd91ebf1ea FIR IDE: Collect TowerDataContext only for block-level expressions
This makes finding right context easier later in situations like this:

```
fun test() {
  foo.bar.bazz()
}
```

Context is written for `bazz()` element, but we might want to find it
from `foo.bar.bazz()` element
2021-01-27 08:02:52 +00:00
Roman Golyshev
b51b8b59b1 FIR IDE: Collect scopes in FirDesignatedImplicitTypesTransformerForIDE
We need this to capture scopes for properties
with initializers (like `val a = 10`)
2021-01-27 08:02:52 +00:00
Roman Golyshev
445edf8e28 FIR IDE: Mark FirTowerDataContextCollector as ThreadSafeMutableState
Also, use HashMap instead of LinkedHashMap
in `FirTowerDataContextCollector`
2021-01-27 08:02:51 +00:00
Roman Golyshev
11564d7950 FIR: Collect all scopes in FirModuleResolveStateImpl
We need to collect the scopes to later use them in reference shortening

Probably we will need to optimize this behaviour later, since it seems
inefficient
2021-01-27 08:02:50 +00:00
Roman Artemev
8bc7866f01 [KLIB] Fix klib IO when accessing parent file 2021-01-27 09:48:57 +03:00
Roman Artemev
6118d1cf23 [Commonizer] Fix commonizer build 2021-01-26 19:23:25 +03:00
Roman Artemev
b0adcffed9 [JS IR] Fix transitive dependency resolve 2021-01-26 19:23:25 +03:00
Roman Artemev
75016bf54d [Gradle, JS] Fix bridge between Gradle and Js IR CLI 2021-01-26 19:23:25 +03:00
Roman Artemev
350ff8033d [IC KLIB] Replace JS IR build log with KLIB build log for klib compialtion
- fix test data
2021-01-26 19:23:25 +03:00
Roman Artemev
5c25ef62e2 [JVM IR] Fix jvm test runner 2021-01-26 19:23:25 +03:00
Roman Artemev
b4ed7110dd [IC TEST] Fix IC multi module tests for gradle 2021-01-26 19:23:24 +03:00
Roman Artemev
04777d2ff2 [IC TEST] Generate legacy js multi module IC tests 2021-01-26 19:23:24 +03:00
Roman Artemev
898c0470dc [IC TEST] Implement legacy js multi module gradle-like test infra 2021-01-26 19:23:24 +03:00
Roman Artemev
43022a292d [IC TEST] Abstract multi module test runner from klib 2021-01-26 19:23:24 +03:00
Roman Artemev
5b1c70a430 [KLIB IC] Generate multi module klib IC tests 2021-01-26 19:23:24 +03:00
Roman Artemev
10d8e95df7 [IC TEST] Support multi module IC tests for klibs
- implement required infrastructure
 - pass changed class path dependencies
2021-01-26 19:23:24 +03:00
Roman Artemev
9aeda12b99 [KLIB IC] Produce .klib file instead of directory in test
- disable sourcemaps
 - clean up comment
2021-01-26 19:23:24 +03:00
Roman Artemev
37c7f60ae7 [KLIB] Fix issues between directory and .klib modes
- use .klib extension explicitly
 - fix issue with `module.klib.klib` names
2021-01-26 19:23:23 +03:00
Roman Artemev
939da9dbc8 [KLIB] Take into account *.klib rebuild similar to *.jar
Fix multi-module incremental compilation. Fix allows to trigger klib
rebuild when dependency changed.
2021-01-26 19:23:23 +03:00
Roman Artemev
daf1da1c70 [KLIB IC] Fix klib IC test data
Since neither inline function nor super classes affect klib there is no
need for extra passes so compiler doesn't report any dirty files.
Do not check that.
2021-01-26 19:23:23 +03:00
Roman Artemev
380225e0cb [KLIB IC] Support special klib-build.log in IC test infrastructure 2021-01-26 19:23:23 +03:00
Roman Artemev
96ba3b873e [IC] Add in-module tests for incremental compilation
Two tests to check recompilation when parameter with default value was
added or removed without changing use-site.
2021-01-26 19:23:23 +03:00
Roman Artemev
697d4675a2 [KLIB] Improve klib debugging implementing KotlinLibrary.toString() 2021-01-26 19:23:23 +03:00
Roman Artemev
2daf0cc11c [JS IR] Support additional repositories in CLI (cli part) 2021-01-26 19:23:22 +03:00
Roman Artemev
cd9e341fa9 [JS IR] Support additional repositories in CLI (compiler part) 2021-01-26 19:23:22 +03:00
Simon Ogorodnik
e22711d17f [FIR] Reuse empty scopes 2021-01-26 18:33:57 +03:00
Simon Ogorodnik
67267518f0 [FIR] Optimize tower group comparisons
Fix incorrect used bits calculation

bits debug

Disable tower group debugging

Extend comment

Proper to binary string
2021-01-26 18:33:57 +03:00
Simon Ogorodnik
4530cdefe5 [FIR] Implement proper equals/hashCode for TowerGroupKind.WithDepth 2021-01-26 18:33:57 +03:00
Alexander Anisimov
a4dd47daab Update ReadMe.md 2021-01-26 17:29:15 +03:00
Vladimir Dolzhenko
8019dbe06c Do not leak LowMemoryWatcher on plugin unload
#KT-44543 Fixed
2021-01-26 13:55:47 +00:00
Mikhail Glukhikh
76c2288e21 IrInterpreter: interpret IrGetField properly 2021-01-26 16:19:14 +03:00
Mikhail Glukhikh
b311e95487 FIR2IR: don't generate IR getter for const library properties 2021-01-26 16:10:09 +03:00
Hung Nguyen
e2521718dd Kapt: Add flag to keep KDoc comments in stubs
Currently, KaptGenerateStubsTask may not generate KDoc comments
correctly. See KT-43593 for more details.

This commit provides a Kapt flag called
`kapt.keep.kdoc.comments.in.stubs`
to control whether KDoc comments will be included in the generated
stubs.

This flag is currently enabled by default to keep the existing behavior
and avoid breaking existing users.

Users who don't need KDoc comments in stubs but are hitting KT-43593 can
disable the flag.

Whether this flag will be disabled by default later is to be determined.

Bug: https://youtrack.jetbrains.com/issue/KT-43593
     (Note that this commit only provides a workaround, it doesn't
     actually fix the bug.)
Test: (Ir)ClassFileToSourceStubConverterTestGenerated#testCommentsRemoved
2021-01-26 15:28:52 +03:00
sebastian.sellmair
dcda47b502 Ensure that Decompiler and IDE agree on rendered function types with parameterized annotations
findDecompiledDeclaration.kt: Use same DescriptorRenderer options as Decompiler

DescriptorRendererImpl.kt: not enforce different AnnotationArgumentsRenderingPolicy for function type annotations

This will fix KTIJ-563 where rendered Descriptors are used as Keys
for GOTO navigation into decompiled sources.

^KTIJ-563 fixed
2021-01-26 12:24:53 +00:00
Sergey Shanshin
122d04b9fa Returned support for generic serializers in @UseSerializers (#4055)
Fixes Kotlin/kotlinx.serialization#1305
2021-01-26 14:57:40 +03:00
Mikhail Glukhikh
1a4b327210 FIR2IR: fix smart casts in case field is accessed 2021-01-26 12:27:09 +03:00
Mikhail Glukhikh
1c9064836e FIR2IR: fix intersection type smart cast when synthetic property accessed 2021-01-26 12:26:50 +03:00
Alexander Gorshenev
504bdfc283 testData for binary compatibility tests on klib library evolution 2021-01-26 03:42:15 +03:00
Sergey Igushkin
3704b2a5af Fix testJvmKtAppDependsOnMppTestRuntime after 3b0f4f31 2021-01-25 23:59:28 +03:00
Bingran
d4965b1e6e Avoid resolving deprecated configurations in tests (#3970)
* Avoid resolving deprecated configurations in tests

This PR enables more integration tests run with warning-mode=fail by
updating "resolveAllConfigurations" task in a way where we don't resolve
deprecated configurations and instead check dependencies on alternative
configurations.

* Add custom resolvable configuration for testing
2021-01-25 23:00:12 +03:00
Sergey Igushkin
3b0f4f3164 Set canBeConsumed = false on the deprecated configurations like compile
This leads to clearer error messages in Gradle variant-aware dependency
resolution failures. Gradle has deprecated those configurations since
long ago, and we didn't see much use of them as variant-aware dependency
resolution entities either.

So this commits sets `canBeConsumed` to false on these configuratons:
* compile (+ testCompile, fooCompile in MPP)
* runtime (+ testRuntime, fooRuntime, ...)
* compileOnly (+ testCompileOnly, fooCompileOnly, ...)

This change replaces the PR #3995
2021-01-25 22:51:42 +03:00
Steven Schäfer
3e820ff3b1 JVM: Take inline class mangling state into account for default methods 2021-01-25 18:12:01 +01:00
Svyatoslav Kuzmich
f85263ca7f [JS IR] Add fast path to JsCodeOutliningLowering 2021-01-25 19:18:44 +03:00
Svyatoslav Kuzmich
cb3b1f8ae2 [JS IR] Fix referencing Kotin variables in inline JS code
Fixed by outlining JS code that uses Kotlin variables making usages of
these locals explicit and preventing bugs due to one-sided variable renaming.

This prevents using Kotlin variables as lvalue in JS code.
2021-01-25 19:18:44 +03:00
Dmitry Petrov
708e6914bd JVM JVM_IR hide sealed class constructors 2021-01-25 17:29:38 +03:00
Dmitriy Novozhilov
ca3bb02897 [TD] Update spec testdata after f06a5321 2021-01-25 17:16:54 +03:00
Dmitriy Novozhilov
f61a318c9d [Test] Migrate AbstractBytecodeTextTest to new test infrastructure 2021-01-25 17:11:21 +03:00
Dmitriy Novozhilov
e928448e00 [Test] Fix default jps [JSP] Fast FIR tests run configuration 2021-01-25 17:11:21 +03:00
Dmitriy Novozhilov
663d5026d8 [Test] Migrate FIR diagnostic spec tests to new infrastructure
This commit includes a lot of minor changes in testdata: new infrastructure
  requires that each test file in one testdata file in one module must
  have unique name, but a lot of existing spec tests didn't satisfy
  this requirement
2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
0b45139b34 [Test] Fix OutOfMemoryError during extracting meta info from test
Previously CodeMetaInfoParser saved MatchResults for each meta info in
  text (and for each meta info it was different string with text because
  of extracting parsed part from original text), so it led to O(n^2)
  memory complexity (where n is a size of original text).
  Such complexity caused OOME in case of big testdata (~1k meta infos
  for text of 4k lines)
2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
fd8795de99 [Test] Fix FirIdenticalChecker and update some FIR_IDENTICAL testdata 2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
98c22f9e59 [TD] Add forgotten bytecode dump 2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
5c0cfa87ba [Test] Support some jvm codegen specific configuration directives 2021-01-25 17:08:31 +03:00
Dmitriy Novozhilov
7d4adaba21 [Test] Add ability to simply declaring mapping between directives and configuration keys 2021-01-25 17:08:31 +03:00
Dmitriy Novozhilov
5490689fea [Test] Add ability to disable specific handler if there was an error from previous one 2021-01-25 17:08:31 +03:00
Dmitriy Novozhilov
42f9442728 [Test] Handle any Throwable from test instead of AssertionError 2021-01-25 17:08:31 +03:00
Victor Petukhov
c111c33950 Fix failing tests after 8bd78064be 2021-01-25 16:24:43 +03:00
scaventz
1654dfb3bf Upgrade Apache Ant dependency to 1.10.7 2021-01-25 04:28:32 -08:00
Ilya Goncharov
aa1e23d9b0 [JS IR] Use origins for bridge with and without stable names
^KT-44415 fixed
2021-01-25 15:16:47 +03:00
Ilya Goncharov
57fdabdace [JS IR] Add BRIDGE origin as ignore for stabitility of names
^KT-44415 fixed
2021-01-25 15:16:35 +03:00
Ilya Goncharov
a89fe90043 [JS IR] Add test on exportable overriden method
^KT-44415 fixed
2021-01-25 15:16:22 +03:00
Victor Petukhov
f06a5321a6 Approximate definitely not-null types for type parameter's types if they are already not-null (has not-null upper bounds)
^KT-44440 Fixed
2021-01-25 14:17:58 +03:00
Simon Ogorodnik
f2c1608c2b Update testData 2021-01-25 13:53:45 +03:00
Denis.Zharkov
9548caf6ea FIR2IR: Use TEST ClassBuilderFactory in for tests
It helps with bytecode printing when tests fail
2021-01-25 12:29:32 +03:00
Denis.Zharkov
8c30adc301 FIR2IR: Unwrap intersection overrides for intersection types 2021-01-25 12:29:31 +03:00
Denis.Zharkov
3a3d2ee3e9 FIR2IR: Fix mapping for intersection overrides of deserialized properties 2021-01-25 12:29:31 +03:00
Victor Petukhov
fdf0934ade Don't generate txt dump for buildFlexibleEnhancement.kt diagnostic test 2021-01-25 12:16:13 +03:00
Victor Petukhov
8bd78064be Do substitution of a type enhancement, not only lower and upper bounds
^KT-44439 Fixed
2021-01-25 12:14:34 +03:00
Victor Petukhov
83c93aca2e Build type enhancement properly, by taking into account both bounds of the original flexible type
^KT-44420 Fixed
2021-01-25 11:36:49 +03:00
Nikolay Krasko
293f2f9950 Build: Replace Bintray with Space for kotlin-dependencies repository (KTI-466) 2021-01-24 15:04:41 +03:00
Mikhail Glukhikh
eed0f50c5d Code cleanup: ConeAttributes 2021-01-23 10:56:43 +03:00
Mikhail Glukhikh
94e613dd01 FIR: support custom annotation-based type attributes 2021-01-23 10:56:42 +03:00
Mikhail Glukhikh
4cd6266bce FIR: fix suspend type serialization 2021-01-23 10:56:40 +03:00
Mikhail Glukhikh
afe335e504 FIR: serialize ExtensionFunctionType attribute 2021-01-23 10:56:37 +03:00
Mikhail Glukhikh
9e5c9efadf FIR2IR: don't generate IrGetObject for anonymous objects 2021-01-23 10:56:36 +03:00
Mikhail Glukhikh
06ee768c6a FIR: in case of smart cast, use original type for FirThisRcvrExpression
Before this commit, we used type after smart cast both for original
FirThisReceiverExpression and for wrapping FirExpressionWithSmartCast.
However, this makes FIR2IR implicit cast generator work incorrectly
(it decides not to insert implicit cast because original type is the same).
After this commit, expressions have different types and implicit cast
generator works properly.
2021-01-23 10:56:34 +03:00
Mikhail Glukhikh
4fd4f504d0 FIR: make componentX functions operator 2021-01-22 18:11:57 +03:00
Mikhail Glukhikh
7934853c8e Set ABI stability to JVM modules which are built with FIR 2021-01-22 18:11:57 +03:00
pyos
4a76ea6ecb JVM: regenerate objects if they have been regenerated in parent contexts
This is a hack to work around the fact that type mappings should not be
inherited by inlining contexts for lambdas called from anonymous
objects. As the lambda can call the inline function again, this could
produce a reference to the original object, which is remapped to a new
type in the parent context. Unfortunately, there are many redundant
`MethodRemapper`s between the lambda and the class file, so simply
editing `TypeRemapper` does not work. Hence, this hack. For now.

(Issue found by compiling IntelliJ IDEA BTW.)
2021-01-22 13:39:20 +01:00
Mads Ager
ef36b81c67 [JVM_IR] Reduce the amount of super suffixes on accesibility bridges.
The super suffix was used for any static field/method that needed
an accessor. We should only use it when that field or method is
inherited.
2021-01-22 13:20:25 +01:00
Mikhail Zarechenskiy
a33877a9b9 Fix add import quick fix for unresolved conventional invoke operator
After adding extension invoke on DeepRecursiveFunction in 1.4,
 the compiler start reporting another error and now it doesn't write
 info about callable descriptor. Therefore it's needed to use another
 source of info for expression type

 ^KT-40926 Fixed
2021-01-22 13:57:47 +03:00
Mikhail Zarechenskiy
d2ce73853d Report more specific diagnostic for variable + invoke calls
Do not report same set of diagnostics for variable call if actual
 error was happened with a function candidate. Here the candidate is
 invoke function on DeepRecursiveFunction

 ^KT-40991 Fixed
 ^KT-41491 Fixed
 ^KT-40926 In Progress
2021-01-22 13:57:47 +03:00
Dmitriy Novozhilov
c423750962 [TD] Fix incorrect module structure directives in test data file 2021-01-22 13:51:34 +03:00
Dmitriy Novozhilov
0d058c7c8c [Test] Allow parse FILE and MODULE directives with other strings between them in old tests 2021-01-22 13:51:33 +03:00
Dmitriy Novozhilov
b9e9620ab5 [TD] Unmute passing Fir2Ir text test 2021-01-22 13:51:32 +03:00
Dmitriy Novozhilov
842ed624a7 [TD] Remove some outdated dumps in FIR_IDENTICAL tests 2021-01-22 13:51:31 +03:00
Dmitriy Novozhilov
77115cea92 [TD] Union ir dumps of different test files 2021-01-22 13:51:30 +03:00
Dmitriy Novozhilov
4752924b13 [TD] Update FQN's in testdata of IR text tests 2021-01-22 13:51:29 +03:00
Dmitriy Novozhilov
8286a160bd [TD] Update order of directives 2021-01-22 13:51:27 +03:00
Dmitriy Novozhilov
bdcb8aecab [Test] Migrate AbstractFir2IrTextTest to new infrastructure 2021-01-22 13:51:26 +03:00
Dmitriy Novozhilov
aba029237d [Test] Add handler for comparing pretty kt ir dumps 2021-01-22 13:51:25 +03:00
Dmitriy Novozhilov
87ffbd8206 [IR] Collect all dependencies of module recursively 2021-01-22 13:51:24 +03:00
Dmitriy Novozhilov
aaa3fa5845 [Test] Migrate IrTextTestGenerated to new infrastructure 2021-01-22 13:51:23 +03:00
Dmitriy Novozhilov
5ae5f660f6 [Test] Add ability to explicitly declare default binary kind for test 2021-01-22 13:51:22 +03:00
Dmitriy Novozhilov
a2ae618185 [Test] Introduce IGNORE_ERRORS diagnostic to suppressing backend errors 2021-01-22 13:51:21 +03:00
Dmitriy Novozhilov
acb6d2e196 [Test] Allow facades to return null which indicates that facade can't complete it's job
This is needed for cases when test pipeline assumes that some part of
  pipeline may be unavailable because of errors on previous stage.

For example, this may occur in some test which check something on IR
  but contains backend facade for compiling binary dependencies. In
  this case testdata with frontend errors is allowed if test has only
  one module which should not be compiled
2021-01-22 13:51:20 +03:00
Dmitriy Novozhilov
6a7cd0c811 [Test] Add ability to specify applicability of diagnostic to module or file 2021-01-22 13:51:19 +03:00
Dmitriy Novozhilov
28cff22cd0 [Test] Add ability to specify directive for test file
Rules of directives resolving:
- If no `MODULE` or `FILE` was declared in test then all directives
  belongs to module
- If `FILE` is declared, then all directives after it will belong to
  file until next `FILE` or `MODULE` directive will be declared
- All directives between `MODULE` and `FILE` directives belongs to module
- All directives before first `MODULE` are global and belongs to each
  declared module
2021-01-22 13:51:17 +03:00
Alexander Udalov
e17153fab9 Minor, improve Ant test on includeRuntime
Also check that we _do_ include runtime if includeRuntime is true.
2021-01-21 18:29:19 +01:00
scaventz
a13eb4c8e6 Ant task: do not include runtime by default if destination is a jar 2021-01-21 18:29:19 +01:00
Denis.Zharkov
b0b7f39c75 FIR: Do not use return statement for type of a block expression
Type of a block is a kind of irrelevant for lambdas: their type is much
more complicated and defined via FirDataFlowAnalyzer#returnExpressionsOfAnonymousFunction
at at FirCallCompleter.LambdaAnalyzerImpl#analyzeAndGetLambdaReturnArguments
2021-01-21 18:53:03 +03:00
Denis.Zharkov
4dc2653736 FIR: Do not complete finally parts of try-finally
It's been processed via Body transformer explicitly
2021-01-21 18:53:03 +03:00
Denis.Zharkov
7df4f67f7c FIR: Minor. Drop unused parameter 2021-01-21 18:53:03 +03:00
Denis.Zharkov
9493e68584 FIR: Do not run completion for lambda's explicit return too early
See the test case
Completion for synthetic call: x ?: return@myRun materialize()
makes `materialize()` while it's obviously too early for that
2021-01-21 18:53:03 +03:00
Denis.Zharkov
5afebb4e78 FIR: Transform synthetic calls children even without incomplete candidate
It might be necessary for cases like
run @l1{
   run {
      if (...) return@l1 1
   }
}

"if" is a synthetic call, but without candidate since there's just one branch
But return@l1 1 is incomplete because it's resolved in dependent context
and "1" is hang incomplete integer literal
2021-01-21 18:53:03 +03:00
Denis.Zharkov
5f0d00a83f FIR: Use proper tower data contexts for postponed callable references
E.g., it should contain local scopes of containing lambdas
2021-01-21 18:53:03 +03:00
Denis.Zharkov
ad30c6c380 FIR: Fix callable references resolution when they're being returned from lambdas 2021-01-21 18:53:03 +03:00
Denis.Zharkov
0e368cc237 FIR: Analyze return statements for implicit lambda with independent context 2021-01-21 18:53:02 +03:00
Denis.Zharkov
5e83e10a72 FIR: Add callable references nodes to CFG
Otherwise, they are not being considered as return expressions from lambdas
2021-01-21 18:53:02 +03:00
Alexander Dudinsky
6dc0440cd0 Remove commented code in previous commit 2021-01-21 18:47:48 +03:00
Alexander Dudinsky
71e74497b5 Use addTestJdk&removeTestJdk methods instead addJdk&removeJdk 2021-01-21 18:38:06 +03:00
Mikhail Glukhikh
20843b6894 Remove error suppression in KotlinChangeSignatureDialog 2021-01-21 18:32:34 +03:00
Pavel Kirpichenkov
628d6a9c30 Don't store logger in instance field 2021-01-21 16:53:09 +03:00
Pavel Kirpichenkov
5003738d29 Fix: use idea caches correctly
Instead of using value from cache the first created value
was being saved to field and not invalidated later.
2021-01-21 16:53:09 +03:00
Sergey Igushkin
87c6b6bffc Revert "Set canBeConsumed = false on the deprecated configurations like compile"
This reverts commit dfacccf8
2021-01-21 16:39:00 +03:00
Jinseong Jeon
2e660ef62a Raw FIR: use lambda parameter type if available 2021-01-21 16:06:23 +03:00
Jinseong Jeon
fa0b933bc8 FIR checker: add diagnostics for missing/ambiguous component calls 2021-01-21 16:06:10 +03:00
Jinseong Jeon
83b9c29495 FIR checker: relocate sealed class ctor call checker 2021-01-21 16:06:10 +03:00
Jinseong Jeon
5f0eb8a401 FIR checker: minor cleanups 2021-01-21 16:06:10 +03:00
Jinseong Jeon
be29b6d64d FIR checker: use aliased checker when possible (part 2) 2021-01-21 16:06:10 +03:00
Jinseong Jeon
de592f4f67 FIR checker: introduce FunctionChecker alias
and use it to add support diagnostic FUNCTION_DECLARATION_WITH_NO_NAME
2021-01-21 16:06:09 +03:00
Mikhail Glukhikh
40bec30393 FIR: implement LT positioning in diagnostic tests, fix LT strategies 2021-01-21 16:06:09 +03:00
Jinseong Jeon
f1d8a6e5d1 FIR checker: introduce DECLARATION_SIGNATURE_OR_DEFAULT positioning strategy
and fix CONFLICTING_OVERLOADS to use it
2021-01-21 16:06:09 +03:00
Igor Yakovlev
2e4daee1d4 [FIR] Fix invalid diagnostic fir node sites and improved invalid type parameters count diagnostic report 2021-01-21 15:20:30 +03:00
Simon Ogorodnik
b7d3469819 [FIR] Remove transform/accept from FirResolvedTypeRef.delegateTypeRef 2021-01-21 15:20:30 +03:00
Igor Yakovlev
243f85a4d6 [FIR IDE] Add base support for FIR incomplete types resolve 2021-01-21 15:20:30 +03:00
Ilmir Usmanov
704366e531 JVM: Mark suspend lambda receiver as used if callable reference
accesses it.
 #KT-44131 Fixed
2021-01-21 12:47:59 +01:00
Mikhael Bogdanov
de00f72fa3 Generate linenumber for inline call site in case of implicit iterator/hasNext/next calls in for loop
Otherwise -1 is generated in smap
2021-01-21 12:04:09 +01:00
Sergey Igushkin
dfacccf84f Set canBeConsumed = false on the deprecated configurations like compile
This leads to cleaner error messages in Gradle variant-aware dependency
resolution failures. Gradle has deprecated those configurations since
long ago, and we didn't see much use of them as variant-aware dependency
resolution entities either.

So this commits sets `canBeConsumed` to false on these configuratons:
* compile (+ testCompile, fooCompile in MPP)
* runtime (+ testRuntime, fooRuntime, ...)
* compileOnly (+ testCompileOnly, fooCompileOnly, ...)
* default (+ fooDefault in MPP)

This change replaces the PR #3995
2021-01-21 11:00:21 +00:00
Sergey Igushkin
6e913e16ad Add integration tests for Kapt + Android Gradle plugin 7.0 2021-01-21 11:00:21 +00:00
Sergey Igushkin
341b87fad0 Use implementation instead of compile in GradleIT, fix versions 2021-01-21 11:00:20 +00:00
Sergey Igushkin
17b71555e0 KT-43944: Don't access Android test source sets' API configurations
When dependencies are added to our corresponding configurations,
report errors, as there's no proper way to add those dependencies.

Issue #KT-43944 Fixed
2021-01-21 11:00:19 +00:00
Andrei Klunnyi
77ffc318f2 KT-44250 [Sealed interfaces]: completion fails for 'when' with sealed 2021-01-21 10:53:36 +00:00
Dmitriy Novozhilov
14108011ee [FIR] Fix inferring arguments of bare types in different situations
- argument type is flexible
- supertype has flexible type argument
- type of expression is more specific than bare type
2021-01-21 12:02:01 +03:00
Jinseong Jeon
b99f1a1512 FIR checker: error messages for function diagnostics
Also, update error inputs to conform to old FE's

These should have been part of commit 39df3e2b0a
2021-01-21 09:57:55 +03:00
Jinseong Jeon
021395ce39 FIR checker: error message for destructuring declaration diagnostic
Also, update error inputs to conform to old FE's

This should have been part of commit 03cb0c3cd1
2021-01-21 09:57:55 +03:00
Jinseong Jeon
35093e0958 FIR checker: error messages for properties/accessors diagnostics
Also, update error inputs to conform to old FE's

These should have been part of commit 5167d69b7c
2021-01-21 09:57:55 +03:00
Ilmir Usmanov
952576e98f JVM_IR: Do not unbox Result parameter if it not only one inline class
parameter, since in this case, the compiler generates a bridge, where
the result is unboxed.
2021-01-20 18:30:00 +01:00
Ilmir Usmanov
d48f92775b JVM_IR: Do not unbox Result parameter in invoke if there is a bridge
since the bridge unboxes it.

 #KT-44141 Fixed
2021-01-20 18:29:58 +01:00
Ilya Goncharov
0ddb603eaa [JS IR] Fix of test with method in abstract class calling extension on super type 2021-01-20 20:01:42 +03:00
Steven Schäfer
9c4f8f7e54 JVM IR: Fix signature mapping for inline classes using new mangling
When resolving inline class methods in binary dependencies we look for
methods matching both the new and the old mangling scheme. On the IR
backend the method signature has to be computed for the inline class
replacement, since the logic for signature mangling is not contained in
the method signature mapping, unlike in the old backend.
2021-01-20 17:43:41 +01:00
Mikhael Bogdanov
91717cdcdd Perform inline checks in IR tests 2021-01-20 15:23:09 +01:00
Mikhael Bogdanov
216b775095 Remove obsolete code 2021-01-20 15:23:09 +01:00
Mikhael Bogdanov
147d60523d Generate inline function arguments with parameters types
#KT-44429 Fixed
2021-01-20 15:23:08 +01:00
Ilya Goncharov
50ab9ed054 [JS IR] Add test on interface with default method calling extension method on super-interface
^KT-42176 fixed
2021-01-20 14:26:38 +03:00
Pavel Kirpichenkov
5c28762c02 Fix check for local classes in approximating string table
Take local/anonymous classes and their inner classes into account.
Simplify approximation: use first available super classifier instead
of first super class. This approximation should only happen for
private declarations that were not previously approximated by frontend.
So basically the only requirement for the approximated types is to be
denotable. Note that this only works if the types are not used later.
JVM uses a different string table implementatin as it needs exact
types of private members for reflection.

^KT-20996 Fixed
2021-01-20 11:05:53 +03:00
Pavel Kirpichenkov
b66f5c8180 Drop type aliases for JS and KLIB string tables
They used to use the same approximation logic anyway
^KT-20996
2021-01-20 11:05:53 +03:00
Pavel Kirpichenkov
2f3f75b512 Fix local anonymous class name error in K2MetadataCompiler
Extract the logic of approximating to denotable class supertype
from JS/KLIB and use it in metadata compiler.

^KT-20996 In Progress
2021-01-20 11:05:53 +03:00
Pavel Kirpichenkov
b82a44fa63 Add test for KT-20996 2021-01-20 11:05:53 +03:00
Ilmir Usmanov
cce9469e6a JVM_IR: Do not unbox Result parameter in Result methods
#KT-44140 Fixed
2021-01-20 06:27:15 +01:00
Sergey Shanshin
10d9259df5 Returned support for nullable types by not null serializers
Fixes Kotlin/kotlinx.serialization#1265
2021-01-19 20:44:47 +03:00
Ilmir Usmanov
b476f1cc3e Minor. Change test to use the feature instead of suppressing error 2021-01-19 16:03:33 +01:00
Ilmir Usmanov
d1ee45b518 Add language feature for suspend functions in fun interfaces
Since in 1.5 JVM_IR is enabled by default and supports suspend functions
in fun interfaces, it is safe to enable the feature by default as well.
2021-01-19 16:03:31 +01:00
Yaroslav Chernyshev
6aa6f82c47 Fix MultiplatformModelImportingContextImpl#isOrphanSourceSet predicate 2021-01-19 17:28:15 +03:00
Svyatoslav Kuzmich
cf228bebc3 Use static year range in copyright of generated FIR and tests
Dynamically calculating a year is problematic, especially in cases like
FIR where generation happens in every build. When you are working on a
last year's commit, each build creates a bunch of uncommited
 changes of updating the year in copyrights.
2021-01-19 17:17:31 +03:00
Svyatoslav Kuzmich
ba8223218f [Wasm] Add inline property accessors optimization 2021-01-19 17:08:58 +03:00
Svyatoslav Kuzmich
2aa3c197a3 [Wasm] Use non-persistent IR to speed up tests 2021-01-19 17:08:05 +03:00
Ilya Kirillov
11a3126c8c FIR: copy class supertypes list on iterating while calculating supertypes
This list is backed by mutable list and during iterating on it
we can resolve supertypes of that class via IDE light classes
as IJ Java resolve may resolve a lot of stuff by fir light classes
This causes ConcurrentModificationException
2021-01-19 14:34:57 +01:00
Vyacheslav Gerasimov
a0ad85e20d Build: Disable caching of test tasks
Until `KTI-464 Test tasks with failed tests are cached` is resolved
2021-01-19 14:19:05 +03:00
Sergey Bogolepov
284d42fd2b Use camelCase for cacheKind control property
Because it is more intuitive for end-users.
2021-01-19 17:31:45 +07:00
pyos
29f95c7df2 FIR: improve inference of implicit type arguments in casts
Type parameters do not necessarily match one-to-one, or preserve order.
2021-01-18 18:01:03 +03:00
sebastian.sellmair
acdc1f532b Rewrite CommonizerTask params to fix ^KT-42098 2021-01-18 14:57:18 +00:00
Shagen Ogandzhanian
23332bac13 More precise message for "this test can be unmuted" 2021-01-18 12:51:23 +01:00
Vladimir Dolzhenko
6331a135c8 Add LightClassUtil.getLightClassMethodsByName to avoid resolving all lightClassMethods and filtration later on 2021-01-18 11:13:16 +00:00
Ilmir Usmanov
167bfcf6ea Minor. Remove accidentally added bunch file 2021-01-18 10:14:11 +01:00
Sebastian Sellmair
bf5feb1b4a Remove KotlinMetadataTarget's KotlinTargetComponent in favour of KotlinSoftwareComponent.kt
^KT-44322 fixed
2021-01-18 08:49:30 +00:00
Mikhail Glukhikh
9a5791ad6d FIR: use correct context for enum entry resolve
Now the same resolve context is used for enum entries and
for constructors.
2021-01-18 08:34:46 +03:00
Mikhail Glukhikh
f85fc47383 FIR: introduce separate companion object resolve context
Before this commit, during the resolve of companion objects we used
the same context than for any nested class. However, during companion
object resolve we should not have companion object receiver itself
accessible in any case (in particular, it should not be accessible
in constructor). So in this commit we introduced separate context
for this purpose.
2021-01-18 08:32:06 +03:00
Mikhail Glukhikh
f282c3e547 Cleanup: FirTowerResolveTask 2021-01-18 08:28:49 +03:00
Mikhail Glukhikh
9f06c1a500 FIR cleanup: runResolverForDelegatingConstructor 2021-01-18 08:28:37 +03:00
Mikhail Glukhikh
6cee4e968e [FIR] Don't call componentX for anonymous destructuring entry 2021-01-18 08:28:15 +03:00
Mikhail Glukhikh
795bd26eaf FIR bootstrap: don't use -Werror in useFIR mode 2021-01-18 08:28:05 +03:00
Mikhail Glukhikh
3787018e40 [FIR] Fix parameter index storage in contract serializer 2021-01-18 08:28:01 +03:00
Mikhail Glukhikh
12caf5d743 Fix test BE JvmBoxRunner to be able to see FIR BB tests exceptions 2021-01-18 08:27:51 +03:00
Dmitry Petrov
0c463d3260 KT-44378 don't generate no-arg constructor for sealed classes 2021-01-15 22:31:01 +03:00
Dmitriy Dolovov
ee93efc19d [Commonizer] Avoid leaking non-commonized types as arguments in short-circuited TAs 2021-01-15 22:01:56 +03:00
Ilya Kirillov
8fa848bed3 FIR IDE: fix testdata after rebase 2021-01-15 17:23:12 +01:00
Ilya Kirillov
459c919072 FIR IDE: introduce JAVA_SYNTHETIC_PROPERTY symbol origin 2021-01-15 17:23:12 +01:00
Ilya Kirillov
a5e6c1d82b FIR IDE: implement new getTopLevelFunction(/property)Symbols in FirModuleWithDependenciesSymbolProvider 2021-01-15 17:23:11 +01:00
Ilya Kirillov
450ab33f16 FIR IDE: do not highlight by-name argument as parameter 2021-01-15 17:23:11 +01:00
Ilya Kirillov
16cd2f08fe FIR: preserve delegatedTypeRef when transforming FirFunctionTypeRef 2021-01-15 17:23:11 +01:00
Ilya Kirillov
b405cbb1ff FIR IDE: consider synthetic functional interfaces to have LIBRARY origin 2021-01-15 17:23:10 +01:00
Ilya Kirillov
981f932033 FIR IDE: ignore synthetic references in reference resolve 2021-01-15 17:23:10 +01:00
Ilya Kirillov
087840122a FIR: mark FirBuiltinSymbolProvider with ThreadSafeMutableState
It has mutable cache in BuiltInsPackageFragment
2021-01-15 17:23:09 +01:00
Ilya Kirillov
56bd6a30b3 FIR IDE: introduce delegated symbol origin 2021-01-15 17:23:09 +01:00
Ilya Kirillov
2a9779cd89 FIR IDE: resolve reference to intersection override member to overridden members 2021-01-15 17:23:09 +01:00
Ilya Kirillov
95eb701f75 FIR: introduce symbols for intersection override 2021-01-15 17:23:08 +01:00
Ilya Kirillov
2ef8f58d90 FIR IDE: add KDoc for KtSymbolOrogin 2021-01-15 17:23:08 +01:00
Ilya Kirillov
e060778528 FIR IDE: implement assignment statement references 2021-01-15 17:23:07 +01:00
Ilya Kirillov
14d2b1be49 FIR IDE: resolve by-name-parameter call 2021-01-15 17:23:07 +01:00
Ilya Kirillov
47894c6cc9 FIR IDE: invalidate LibraryModificationTracker in memory leak test 2021-01-15 17:23:06 +01:00
Ilya Kirillov
87e6dbf435 FIR IDE: generate heap dump on memory leak in memory leak test 2021-01-15 17:23:06 +01:00
Ilya Kirillov
f454ec8e4a FIR IDE: introduce methods for working with annotations 2021-01-15 17:23:05 +01:00
Ilya Kirillov
191a1ee242 FIR: add fake source fir element to it parameter 2021-01-15 17:23:05 +01:00
Ilya Kirillov
132fc9e68b FIR IDE: invalidate caches between tests 2021-01-15 17:23:04 +01:00
Ilya Kirillov
861c9b8e45 FIR IDE: unmute passing tests
fix unmute passing
2021-01-15 17:23:04 +01:00
Ilya Kirillov
c97c4fa99c FIR IDE: fix finding fir in container which have conflicting duplicate by name 2021-01-15 17:23:03 +01:00
Ilya Kirillov
601d5cbff8 FIR IDE: fix duplicating diagnostics collection 2021-01-15 17:23:03 +01:00
Ilya Kirillov
008260451c FIR: make FirNestedClassifierScopeWithSubstitution to be name aware 2021-01-15 17:23:03 +01:00
Ilya Kirillov
c2866152bf FIR IDE: fix not initialized containingClassAttr for copied declaration 2021-01-15 17:23:02 +01:00
Ilya Kirillov
a7903c64f1 FIR IDE: do not consider function literal as fqName-having declaration 2021-01-15 17:23:02 +01:00
Ilya Kirillov
1fb33207b8 FIR IDE: add meaningful error message when opening non-source file 2021-01-15 17:23:01 +01:00
Ilya Kirillov
1901436c96 FIR IDE: add more info to error messages 2021-01-15 17:23:01 +01:00
Ilya Kirillov
c131983188 FIR IDE: implement FirIdeProvider.getClassNamesInPackage
#KT-41048 fixed
2021-01-15 17:23:00 +01:00
Ilya Kirillov
a52674f181 FIR: use more meaningful error messages 2021-01-15 17:23:00 +01:00
Ilya Kirillov
4d07eb27bb FIR IDE: add incremental analysis test for function in companion object 2021-01-15 17:23:00 +01:00
Ilya Kirillov
e63d084cdc FIR IDE: allow getting light class name from EDT 2021-01-15 17:22:59 +01:00
Ilya Kirillov
d53af8170b FIR IDE: cache module libraries 2021-01-15 17:22:59 +01:00
Ilya Kirillov
8c113f02d5 FIR IDE: consider top level file change as out of block modification 2021-01-15 17:22:58 +01:00
Ilya Kirillov
d3dd6e3b96 FIR IDE: delegate light classes is valid to corresponding symbol validity check 2021-01-15 17:22:58 +01:00
Ilya Kirillov
a95f38569f FIR IDE: fix FirModuleWithDependenciesSymbolProvider recursive calls 2021-01-15 17:22:58 +01:00
Nikolay Krasko
5838357e61 Extract long project wizard tests to separate TC configuration (KTI-422) 2021-01-15 16:55:41 +03:00
Dmitry Petrov
2f30b0994a Minor: mute test in WASM 2021-01-15 15:31:41 +03:00
Jinseong Jeon
6b5ee6c9f9 FIR checker: warn redundant open in interface members properly 2021-01-15 14:38:37 +03:00
Jinseong Jeon
2e8b5f2380 FIR checker: make member property checker robust to conflict modifiers 2021-01-15 14:38:36 +03:00
Jinseong Jeon
39df3e2b0a FIR checker: introduce member function checker 2021-01-15 14:38:35 +03:00
Jinseong Jeon
5594af0d70 FIR checker: utilize modifier retrievals 2021-01-15 12:46:22 +03:00
Jinseong Jeon
3af820eaf4 FIR: utilize lookups of certain properties of classes/functions 2021-01-15 12:46:20 +03:00
Jinseong Jeon
ec68ac36db FIR checker: use the aliased checker when possible 2021-01-15 12:46:17 +03:00
Jinseong Jeon
03cb0c3cd1 FIR checker: introduce PropertyChecker alias
and use it to add diagnostic
ININITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION
2021-01-15 12:45:25 +03:00
Jinseong Jeon
db65c787e5 FIR checker component generator: handle type parameters in alias arguments 2021-01-15 12:45:25 +03:00
Ilya Goncharov
f3dfb38163 [Gradle, JS] Exclude transitive dependencies of semver4j
^KT-44204 fixed
2021-01-15 11:54:31 +03:00
Dmitriy Novozhilov
e742af5444 [Test] Run fir diagnostics tests with light tree in sequential mode
In parallel mode many tests are failing so it's temporary workaround
2021-01-15 11:16:28 +03:00
Dmitriy Novozhilov
2f1e4862e5 [Test] Enable builtin parallel tests execution form JUnit5 in :compiler:tests-common-new 2021-01-15 11:16:26 +03:00
Dmitry Savvinov
78b2eb994b Deduplicate logic of computing orphan source sets in MPP Gradle Import
Set of compiled source sets is already available in
MultiplatformModelImportingContext via
'sourceSetsToParticipatedCompilations.keys', no need to recompute it

^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
1d0a696a62 Simplify building of source-sets during MPP Import
Build dependsOn closure straight away by using KotlinSourceSetProto
instead of building first KotlinSourceSetImpls with incorrect
dependsOn-names, and then discarding it

^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
9e58e3c3fd Remove unused KotlinSourceSetImpl.defaultIsTestModule; simplify logic of test modules detection
^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
58b2064295 Introduce MultiplatformModelImportingContext
Essentially it is responsible for returning various information about
the model being imported, such as:

- flags and properties, which configure the process of import
- "bulk" requests which might be needed multiple times during import,
but which are more convenient to be computed once, like various indices
(source sets by name, compilations by source-sets, etc.)

^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
f87aa4612b Minor: return map straight away 2021-01-15 11:12:45 +03:00
Dmitry Savvinov
cf2bd75a73 Minor: reformat 2021-01-15 11:12:45 +03:00
Dmitry Savvinov
0aef3680c1 Remove useless function
Looks like it has been broken by 40633768bc
where 'KotlinCompilation.dependencies' switched its type from
KotlinDependency (which is alias to
org.jetbrains.plugins.gradle.model.ExternalDependency) to
KotlinDependencyId (which is alias to Long), leading to safe-cast in the
'reportUnresolvedDependencies' to be always evaluated to 'null'

Rationale for removing it completely instead of fixing:
No one has noticed that this function has been broken + I haven't
managed to find any user-visible behaviour it adds (tried fixing it and
checking project similar to one from
NewMultiplatformProjectImportingTest.testUnresolved, no difference for
me).
2021-01-15 11:12:45 +03:00
Dmitry Savvinov
824efe8498 Remove useless condition
Note that in previous line we already check for !isHmppEnabled and for
sourceSet.name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME, and if it
holds, then we continue to the next loop iteration. So, this conditional
here is essentually equal to 'false'
2021-01-15 11:12:45 +03:00
Dmitry Savvinov
ecd96e14c9 Use all participated compilations for source-sets platform detection even in non-HMPP 2021-01-15 11:12:45 +03:00
Dmitry Savvinov
09286504b7 Add a bunch of tests on corner-cases in Gradle MPP Import
For most of those the behaviour isn't set in stone, though at the moment
of making that commit we're more or less sure that it's reasonable.

Behaviour in some cases might be more strictly enforces (as much as you
can enforce something in esoteric cases with misconfigured project
sturcture). Those are marked with comments with '!'.
2021-01-15 11:12:45 +03:00
Dmitry Savvinov
69261ca1e6 Add tests on precise platforms importing
Note the behaviour in 'precisePlatformsWithUnrelatedModuleHmpp': it is
incorrect, as set of platforms still contains unrelated platforms.

This is because in the current solution, some source-sets
(commonMain/commonTest) always receive COMMON platform and then it gets
coerced to set of targets actually seen in the project.This helps if
projects uses as much targets as current module (like in
precisePlatformsHmpp), but fails if it uses more targets than the
current module (like in precisePlatformsWithUnrelatedModuleHmppp)

The upcoming commits will fix that issue
2021-01-15 11:12:45 +03:00
Mads Ager
250cc1dc92 [JVM] Never treat arguments to methods as locals that can be removed.
Fixes KT-44347
2021-01-15 10:33:11 +03:00
Sergey Bogolepov
ada51509c4 Test caches for linux_x64 on Linux host. 2021-01-15 13:41:15 +07:00
Sergey Bogolepov
ed18fcdf28 Use target-specific cache control in tests 2021-01-15 13:41:15 +07:00
Sergey Bogolepov
2dabfbc613 Bump Native version.
The new one has `cacheableTargets` property
in konan.properties that is now required
for native caches support in Gradle.
2021-01-15 13:41:15 +07:00
Sergey Bogolepov
092020577c More precise native cache control.
Introduce `kotlin.native.cacheKind.$targetName`
that allows to control cache kind on per target basis.
2021-01-15 13:41:14 +07:00
Nikolay Krasko
d017e1c2ce Add protection for master branch in VCS settings 2021-01-14 21:24:49 +03:00
Nikolay Krasko
a0d42b5da6 Build: Download ktor from maven central (KTI-445)
#KTI-445 Fixed
2021-01-14 21:24:48 +03:00
Nikolay Krasko
0a1e4fd7d7 Download ktor from maven central in wizard project 2021-01-14 21:24:47 +03:00
Margarita Bobova
ae67bb4565 Add changelog for 1.4.30-M1 2021-01-14 21:19:09 +03:00
Kevin Bierhoff
c1360c5a7a Uast: resolve reified callees from classpath (#4013, KT-41279) 2021-01-14 20:29:03 +03:00
Pavel Kirpichenkov
c0dd731818 Load JVM built-ins in IDE from module dependencies
Fix built-ins for JVM platform and make them consistent
with module's dependency on standard library. Changes
don't affect non-JVM platforms.

Previously all built-ins in IDE were loaded from classloader
and were based on the same pre-serialized .kotlin_builtins files.
This approach is generally not correct as built-in declarations
differ for different platforms, but it had been working for a while
without immediately observalble effects (see KT-33233 for more info).
After changes in standard library JvmBuiltins started producing
false errors (see KT-39728).

To fix this, JVM built-ins in IDE now utilize the same technique as
applied in CLI: using dependency on standard library as a module
for built-ins instead of artificial module that considers only
.kotlin_builtins.

Change summary:
- Provide JvmBuiltins with kind FROM_DEPENDENCIES
  for all modules with stdlib dependency in IDE
- Add JvmBuiltinsPackageFragmentProvider to JVM-ish module resolvers
  (JVM and Composite with JVM platform) to support their use as
  built-ins module
- Create KotlinBuiltInsMetadataIndex file index for tracking libraries
  containing .kotlin_builtins to support JvmBuiltinsPackageFragmentProvider
- Create KotlinStdlibIndex file index for tracking kotlin-stdlib(-common),
  which looks for "Kotlin-Runtime-Component" manifest attribute
- Add caching service to track LibraryInfo for kotlin-stdlib(-common)
- Put LibraryInfo for kotlin-stdlib(-common) alongside SDKs
  due to the need to resolve that modules in BuiltInsCache
- Update BuiltInsCache to separate JvmBuiltins by module's dependency
  on stdlib and JDK
- Make platform of KotlinSDK common instead of JVM
- Set built-ins module lazily in IDE

^KT-33233 Verification Pending
2021-01-14 17:28:15 +03:00
Dmitry Savvinov
1479c7a270 Minor: load FALLBACK built-ins in JvmPlatformAnalyzerServices
It doesn't matter because this built-ins instance will be used only to
get names of default imports, so nothing can be resolved to those
built-ins => no diagnostics will be reported
2021-01-14 17:28:15 +03:00
Pavel Kirpichenkov
ba4cc4e075 Minor: cleanup 2021-01-14 17:28:14 +03:00
Pavel Kirpichenkov
b9d5c1bc39 Move KotlinSdk to idea-analysis module 2021-01-14 17:28:14 +03:00
Pavel Kirpichenkov
2df4d26b37 Built-ins in IDE: update tests
KT-33233
2021-01-14 17:28:14 +03:00
Dmitry Savvinov
d6c27608ac Minor: remove effectively unused test runner 2021-01-14 17:28:14 +03:00
Vyacheslav Karpukhin
71c71d8619 AndroidDependencyResolver: compatibility with AGP 7 2021-01-14 14:02:28 +01:00
Stanislav Erokhin
c1722350b6 Add constructors to KtScope
- KtClassLikeSymbol.primaryConstructor was removed
- Constructors were removed from getCallableMembers because
constructors has no name (or special name `<init>`) and previous
implementation was incorrect
- KtScope.getAllSymbols returns constructors as before. Before it was
like this because of the incorrect implementation of getCallableMembers
- getConstructors has sence only for class scope,
for the rest cases it is empty
2021-01-14 12:12:28 +01:00
Stanislav Erokhin
c5229291be Add dispatchReceiver and extensionReceiver to relevant KtSymbols 2021-01-14 12:12:27 +01:00
Stanislav Erokhin
96b6efd401 Add type parameters to the KtConstructorSymbol
Yes, for kotlin classes there are not allowed. But unfortunately
they are for java classes
2021-01-14 12:12:27 +01:00
Stanislav Erokhin
732a997479 Use Variance instead of custom class in KtTypeArgumentWithVariance 2021-01-14 12:12:27 +01:00
Stanislav Erokhin
f6bf2f6b7b Add variance and isReified into KtTypeParameterSymbol 2021-01-14 12:12:27 +01:00
Stanislav Erokhin
c17eee0085 Add data/inline/fun/isExternal flags to KtClassLikeSymbol 2021-01-14 12:12:26 +01:00
Stanislav Erokhin
7e4ba1a062 Remove unused Unknown modality from KtSymbolWithModality. 2021-01-14 12:12:26 +01:00
Stanislav Erokhin
e1e096b4ea Add PRIVATE_TO_THIS visibility to KtSymbolWithVisibility
This visibility is used for some cases where it isn't allowed to access
to private members of the object from other instances of the same object
because of the type parameter variance.

For almost all clients this visibility is the same as PRIVATE
2021-01-14 12:12:26 +01:00
Stanislav Erokhin
d50a5e7517 Add ConstantValueKind to KtSimpleConstantValue 2021-01-14 12:12:25 +01:00
Stanislav Erokhin
d24331955e Rename FirConstKind to ConstantValueKind and move it to compiler.common 2021-01-14 12:12:25 +01:00
Andrei Klunnyi
eed27906e3 KT-44043 [Sealed interfaces]: tests
So far, quick-fix tests infrastructure neither supports the check
for multiple files (several .before/.after pairs) nor multi module
structure. Provided tests are quite limited yet allow to make sure that
the fix in question appears in expected context and get activated.

^KT-44043 fixed
2021-01-14 10:25:34 +00:00
Andrei Klunnyi
43cc022613 KT-44043 [Sealed interfaces]: quickfix for nested -> to another file 2021-01-14 10:25:33 +00:00
Andrei Klunnyi
da98fc4b07 KT-44043 [Sealed interfaces]: quickfix for nested -> to upper level 2021-01-14 10:25:33 +00:00
Andrei Klunnyi
521bebee0f KT-44043 [Sealed interfaces]: quickfix for top level abstractions 2021-01-14 10:25:32 +00:00
Alexander Udalov
a6b51da308 Fix compilation in the case of JDK_16 pointing to JDK 1.8 2021-01-13 21:47:23 +01:00
Alexander Udalov
3be62dfc89 Build: enable -Werror in stdlib/core/compiler/plugins modules
Exclude modules where there are still warnings in an explicitly declared
variable `tasksWithWarnings`.

Also remove "-progressive" from compiler arguments in modules which are
built with non-latest language version, as the warning about that leads
to an error with -Werror.
2021-01-13 19:34:24 +01:00
Alexander Udalov
cc90ff78fd Build: output build time for tasks with --info
To minimize the amount of output during project build, to make it more
comfortable to work with the project in the terminal.
2021-01-13 19:34:24 +01:00
Alexander Udalov
07ce991b3f Build: minor, remove extra newlines in log 2021-01-13 19:34:24 +01:00
Alexander Udalov
2a7a297399 Suppress "runtime JAR files version mismatch" warnings in some plugins 2021-01-13 19:34:24 +01:00
Alexander Udalov
0d8f909bda Use ObsoleteTestInfrastructure instead of Deprecated in black box tests 2021-01-13 19:34:24 +01:00
Alexander Udalov
221f44da5f Fix warnings in stdlib/compiler/plugins/test code 2021-01-13 19:18:20 +01:00
Alexander Udalov
b3d85e656e Fix warnings after update to 202 platform
#KT-44069 Fixed
2021-01-13 19:17:22 +01:00
Alexander Udalov
ee7691f1ad Fix IntArrayList deprecation warning in JvmDependenciesIndexImpl
Copy relevant parts of deprecated IntelliJ's IntArrayList to a new util
class. Also fix some minor IDE inspections.
2021-01-13 19:17:21 +01:00
Alexander Udalov
8ae19f5cd7 Fix deprecated Interner/StringInterner usages after update to 202 2021-01-13 19:17:21 +01:00
Alexander Udalov
f8c2f4a8d0 Fix incorrect code in AbstractJspecifyAnnotationsTest
There was a warning on line 78
(`diagnosticsToJspecifyMarksMap[diagnostic.name]`) which unconvered that
the map wasn't used in the same way in both call sites.
2021-01-13 19:17:21 +01:00
Alexander Udalov
d101f1b3a6 Minor, fix compiler warnings in kotlin-serialization-compiler 2021-01-13 19:17:21 +01:00
Alexander Udalov
e0363788f4 Remove some remaining tests on old coroutines 2021-01-13 19:16:31 +01:00
Mikhail Glukhikh
7953974f3d [FIR] Make WRONG_IMPLIES_CONDITION warning instead of error 2021-01-13 18:14:26 +03:00
Simon Ogorodnik
7c8a67b20b Make useFir build property set -Xuse-fir flag 2021-01-13 18:14:21 +03:00
sebastian.sellmair
bfbb6afee5 Add sourcesJar from metadata target to root multiplatform publication
^KT-44298 fixed
2021-01-13 15:07:35 +00:00
Ivan Gavrilovic
dfdd107fc0 Update KAPT stubs for tests
Update expected outputs so they match
the new sorting rules.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
3b2986f069 Apply consistent sorting for elements from the same position
There could be multiple elements originating from the same
position in the source file, so make sure to use name+desc to
sort those.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
ad8517c19a Add tests from the reverted commit
To ensure deterministic build outputs.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
ecc0eee3cf KT-44130: Sort fields and methods in generated stubs
Use the position in the source file if possible, and
only if the members are coming from other source files,
use their name and descriptor. This is necessary in order
to ensure deterministic output in clean and incremental
runs, while preserving the order of members in the sources.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
a320152a03 Revert "Sort class members to ensure deterministic builds"
This reverts commit 4bf63a9539.
2021-01-13 22:49:09 +09:00
Bingran
77f8c1e58f Improve cacheability test coverage on kotlin compile, kapt tasks
This PR makes sure we have following cases covered for :compileKotlin,
:kaptKotlin, :kaptGenerateStubsKotlin tasks.

1. incremental change + input relocated
2. incremental change + input not relocated
2021-01-13 12:17:14 +03:00
Ivan Gavrilovic
1c8a25c106 KT-44020: Rename KAPT configuration used as task property
This is so AGP does not try to apply AndroidX substitution
to dependencies found in the annotation processor classpath.
AGP does this by checking if the configuration name starts
with "kapt".

Test: Kapt3Android42IT
2021-01-13 16:25:57 +09:00
Zalim Bashorov
47c4197098 [JS old] Revert fix made for KT-44221 in ab753625
And mute the test for old BE.

#KT-44221 Open
2021-01-13 01:22:17 +03:00
Alexander Udalov
0d6c5dd2bc Fix incorrect generation of Ant task tests, restore tests 2021-01-12 22:18:32 +01:00
Dmitriy Novozhilov
0e62cd9998 Regenerate tests 2021-01-12 18:35:41 +03:00
Dmitriy Novozhilov
e3066a166e [Test] Migrate AbstractFirBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:40 +03:00
Dmitriy Novozhilov
af5a635f85 [Test] Ignore error diagnostics from FIR in some BB tests 2021-01-12 18:35:39 +03:00
Dmitriy Novozhilov
2eeed1281c [Test] Mute failing FIR BB tests related to MPP 2021-01-12 18:35:37 +03:00
Dmitriy Novozhilov
5329a6ce8e [Test] Properly dispose class loader for running BB tests 2021-01-12 18:35:36 +03:00
Dmitriy Novozhilov
e6fd74f368 [Test] Add ability to remove default directives in test configuration 2021-01-12 18:35:35 +03:00
Dmitriy Novozhilov
e3c7bd5f85 [Test] Migrate AbstractIrBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:34 +03:00
Dmitriy Novozhilov
f1a2e66ba4 [Test] Setup proper jvm target for kotlinClassImplementsJavaInterface test 2021-01-12 18:35:33 +03:00
Dmitriy Novozhilov
93ce37319a [Test] Drop BlackBoxCodegenTestGenerated from :compiler:tests-different:jdk 2021-01-12 18:35:32 +03:00
Dmitriy Novozhilov
85c87f7df9 [Test] Migrate AbstractBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:30 +03:00
Dmitriy Novozhilov
f01122d8dc [Test] Fix module names according to MPP module conventions in test data 2021-01-12 18:35:29 +03:00
Dmitriy Novozhilov
0608c50e27 [Test] Properly configure dependencies for common modules in ModuleStructureExtractor 2021-01-12 18:35:28 +03:00
Dmitriy Novozhilov
285ccf7583 [Test] Don't generate JVM BB tests for expect-actual linker
This feature is supported only on JS backend so those tests on JVM
  are meaningless. Also those tests had passed on jvm because of
  old codegen tests didn't use `MODULE` directive and analyze all
  files in tests in single module
2021-01-12 18:35:27 +03:00
Dmitriy Novozhilov
3a41f1e435 [Test] Filter out support module with coroutine helpers from module deps
In old tests coroutine helpers was added as separate module named `support`
  instead of additional files for current module.
So to safe compatibility with old testdata we need to filter this dependency
2021-01-12 18:35:26 +03:00
Dmitriy Novozhilov
065255adbe [Test] Support friend modules in new test infrastructure 2021-01-12 18:35:24 +03:00
Dmitriy Novozhilov
7e92fb8eb9 [Test] Remove redundant empty IGNORE_BACKEND directive 2021-01-12 18:35:23 +03:00
Dmitriy Novozhilov
726184eda9 [Test] Add @JvmMultifileClass to coroutine helpers files
This is needed to keep compatibility with old format, when all those
  helpers were generated dynamically on test run in one file, so
  you can reference helpers methods from java code just importing
  `helpers.CoroutineUtilKt`
2021-01-12 18:35:22 +03:00
Dmitriy Novozhilov
9fd2800594 [Test] Support KOTLIN_CONFIGURATION_FLAGS directive in new tests 2021-01-12 18:35:20 +03:00
Dmitriy Novozhilov
e0cd830a0e [Test] Drop codegen tests for experimental coroutines
Experimental coroutines was deprecated in Kotlin 1.3,
  so since Kotlin 1.5 we don't support (and don't test) them
2021-01-12 18:35:18 +03:00
Dmitriy Novozhilov
d547ce7c42 [Test] Save TargetBackend instead of BackendKind in TestModule 2021-01-12 18:35:17 +03:00
Dmitriy Novozhilov
3c2079c926 [Test] Compute target backend in test generator automatically using reflection 2021-01-12 18:35:16 +03:00
Dmitriy Novozhilov
9378d1ff31 [Test] Add nullability annotations on InTextDirectivesUtils methods 2021-01-12 18:35:15 +03:00
fjjohnchen
49f2ac3545 KT-43818:NPM Dependencies already resolved and installed in Android Studio resolve 2021-01-12 17:24:05 +03:00
Dmitriy Novozhilov
5382e68180 [Test] Properly delete temporary directories after test run 2021-01-12 16:51:33 +03:00
Dmitriy Novozhilov
ce44a2a7e4 [Test] Inject info about test (class and method names, tags) to TestServices 2021-01-12 16:51:32 +03:00
Dmitriy Novozhilov
84eb74e194 [Test] Fix bug with FirCfgDumpHandler which didn't start at all
Flag `alreadyDumped` is needed due to the fact that CFG dumper is not
  prepared to multimodule tests yet, so in such test this handler
  dumps only first module to .dot file.
I forgot to switch it to `true` when it was introduced, so this checker
  actually, didn't handle anything at all
2021-01-12 16:51:31 +03:00
Dmitriy Novozhilov
13f6b37ae7 [Test] Drop duplicating Constructor typealias 2021-01-12 16:51:29 +03:00
Dmitriy Novozhilov
af94bcebea [IDE] Propagate KotlinFacetSettings version and completely drop isReleaseCoroutines flag
Also this commit removes number of tests related to support
  experimental coroutines
2021-01-12 16:47:55 +03:00
Dmitriy Novozhilov
e991c9d476 [CLI] Drop CommonCompilerArguments.coroutinesState 2021-01-12 16:47:54 +03:00
Dmitriy Novozhilov
df3b12e13b [FE] Drop coroutinesState from build configurations plugins 2021-01-12 16:47:51 +03:00
Dmitriy Novozhilov
7f4a925b85 [FE] Drop isReleaseCoroutines flag from LanguageSettingsProvider 2021-01-12 16:47:50 +03:00
Dmitriy Novozhilov
a8b65bc673 [IDE] Drop coroutines KotlinFacetSettings.coroutineSupport 2021-01-12 16:47:48 +03:00
Dmitriy Novozhilov
69e1d60b08 [IDE] Drop coroutines combo box from compiler configuration tab 2021-01-12 16:47:47 +03:00
Alexander Udalov
0fef890d1a Minor refactoring in CompileEnvironmentUtil 2021-01-12 14:45:06 +01:00
scaventz
4374438ff1 Kotlinc: Exclude module-info.class from resulting jar when "-include-runtime" is specified 2021-01-12 14:45:06 +01:00
Alexander Udalov
742fef9042 Rewrite generator for OperationsMapGenerated
Do not generate operations as lambdas; instead use `when` over
strings/enums, which is generated to tableswitch in the bytecode.

This reduces the proguarded compiler jar size by ~0.57%.

 #KT-23565 Fixed
2021-01-12 14:38:41 +01:00
Ilya Goncharov
df75cddcb8 [Gradle, JS] Add possibility to set jvmArgs for dce process
^KT-44104 fixed
2021-01-12 15:54:28 +03:00
Svyatoslav Kuzmich
ab753625fe [JS Legacy] Fix returning Char from suspend functions (KT-44221)
Mark translated expression with a proper type, like we do with
non-suspending calls, to coerce it later.
2021-01-12 15:42:31 +03:00
Svyatoslav Kuzmich
2d88ff6fb2 [JS IR] Fix unsgined integer default arguemtns (KT-44180)
Const lowering didn't exprect null constants with unsigned number
types and crashed with NPE. This commit fixes that.
2021-01-12 15:42:31 +03:00
scaventz
0110b4e4b4 Ant: Add support for fork-mode
#KT-44293
2021-01-12 13:03:27 +01:00
Kris Hall
ee952db1a2 Added samples for String.replace() function 2021-01-12 14:59:43 +03:00
Iaroslav Postovalov
77180a5b13 [JVM IR] Make file classes with all private members package-private 2021-01-12 12:47:59 +01:00
Mikhail Zarechenskiy
032c64669c Show pre-released 1.5 version in configuration preferences
^KT-44116 Fixed
2021-01-12 14:15:30 +03:00
Jinseong Jeon
d53354057a FIR: build functional type for SAM with receiver properly 2021-01-12 10:33:55 +03:00
pyos
f618763250 FIR: implement -Xfriend-paths 2021-01-12 10:33:45 +03:00
Ilya Chernikov
bd708da82c Do not check script discovery file extension
it is optional (so far), so this check was incorrect.
#KT-44117 fixed
2021-01-11 19:50:22 +01:00
Denis.Zharkov
0e3aaceb16 Fix ultra light structure for @JvmRecord classes 2021-01-11 20:51:40 +03:00
Kristoffer Andersen
43b61a618d [IR+Tests] Improve Local Function Debugging Experience
This change improves the debugging experience around local functions
on the IR backend. The changes include moving old
checkLocalVariablesTable (cLVT) tests to the new stepping/local variable
infrastructure in order to refine the tests and further define the
behavior of the two JVM backends, and their differences.

The primary ported test case is cLVT/localFun.kt that documents the
discrepancy in implementation strategy for local functions on the two
backends. The old backend implements local functions as lambdas
assigned to a local variable while the IR backend lifts them out as
static funtions on the surrounding class. The discrepancies and their
consequences are documented in bytecodeListing, idea-stepping,
localVariableTable and debugStepping tests.

The only _code change_ is disabling the captured variable name
mangling for captured variables on the IR backend. Captured variables
are passed as arguments to the static function, so in the debugger,
they really just are local variables. For them to show properly in the
debugger and be detectable by evaluate expression, they simply need no
mangling.

Finally, this change cleans 3 redundant cLVT tests, copyFunction.kt
and destructuringInlineLambda.kt and destructuringInFor.kt, that are
all covered in the new suite. The stepping behavior needs to be made
precise around for loops, but that is an entirely seperate issue.
2021-01-11 18:21:23 +01:00
Alexander Udalov
c2d7b69e5f Remove bytecode text test kt15806.kt
It's not correct to expect that the backend generates the `when` in this
test as tableswitch because there are only two branches. JVM IR has a
cutoff in the when optimization and generates `when`s with fewer than 3
branches as if-else chains, which is probably better. Note that there's
also a corresponding box test in when/enumOptimization/, so the backend
behavior is still tested.
2021-01-11 17:27:03 +01:00
Alexander Udalov
92f3b759c0 Fix codegen test data for genericTypeWithNothing.kt
#KT-18367 Fixed

Co-authored-by: Zalim Bashorov <zalim.bashorov@jetbrains.com>
2021-01-11 17:20:55 +01:00
Mikhail Glukhikh
0c0dbd6245 [FIR] Perform more accurate pre-check of candidate receiver type 2021-01-11 17:57:04 +03:00
Mikhail Glukhikh
4e4293b609 [FIR] Introduce separate getTopLevelFunction/PropertySymbols 2021-01-11 17:52:51 +03:00
Mikhail Glukhikh
fd99f2b2cf FirDefaultStarImportingScope: improve measurements 2021-01-11 17:52:05 +03:00
Mikhail Glukhikh
33037fd885 FirAbstractImportingScope: minor simplification 2021-01-11 17:52:00 +03:00
Mikhail Glukhikh
3f5e515bd6 Fix broken ABI in DiagnosticFactory #KT-44145 Fixed 2021-01-11 17:43:35 +03:00
Dmitry Petrov
b02a9846d0 IR KT-44233 support flexible nullability in IrTypeSystemContext
^KT-44233 Fixed Target versions 1.5-M1
2021-01-11 17:33:50 +03:00
Jinseong Jeon
093f62caac FIR2IR: check non-parameter Unit type for adapted callable references 2021-01-11 16:23:00 +03:00
Mikhail Galanin
4d3ec301c0 Misprint: "val or val" instead of "val or var" 2021-01-11 14:07:34 +01:00
Alexander Udalov
12078666c2 Add warning if both -Xuse-ir and -Xuse-old-backend are passed 2021-01-11 12:57:03 +01:00
Alexander Udalov
cb3191769d Enable JVM IR by default if language version is >= 1.5
#KT-44021 Fixed
2021-01-11 12:47:54 +01:00
Alexander Udalov
22d0e5eb65 Rename -Xno-use-ir -> -Xuse-old-backend, add Gradle option
As soon as JVM IR is enabled by default (in language version 1.5), use
the CLI argument `-Xuse-old-backend` or Gradle option `useOldBackend` to
switch to the old JVM backend.
2021-01-11 12:47:54 +01:00
Alexander Udalov
b8fb1ce83c Fix Java 9 module tests for many JDKs
Module 'oracle.desktop' is not guaranteed to be present in JDK. Also,
its usage in these tests doesn't check anything new that isn't already
checked by usages of jdk.net and jdk.httpserver.
2021-01-11 12:39:03 +01:00
Alexander Udalov
b8d7b39e2c Extract Java 9 module test about irrelevant jars in JDK home
Skip it on JDKs where ant-javafx.jar is not present.
2021-01-11 12:39:03 +01:00
Alexander Udalov
9fd250b2b1 Exclude libraries/stdlib/wasm/build in CodeConformanceTest
Similarly to libraries/stdlib/js-ir/build, there are some copyrights
produced during the build, which should not be checked in this test.
2021-01-11 12:27:26 +01:00
Dmitriy Novozhilov
1e67702128 [Test] Introduce opt in @ObsoleteTestInfrastructure for migrating tests to new infrastructure 2021-01-11 14:19:10 +03:00
Mads Ager
dfc86feecd [IR] Extend test coverage for smart cast handling. 2021-01-11 12:01:48 +03:00
Mads Ager
6fc0de39c2 [PSI2IR] Propagate smart cast information for variable loads.
This gives us more precise type information and can enable backend
optimizations. This was motivated by when expressions not compiled
to table switches in the JVM_IR backend.

Fixed KT-36845.
2021-01-11 12:01:47 +03:00
Steven Schäfer
98a9e142e8 JVM IR: Fix visibility of protected/private functions with reified types 2021-01-08 16:35:31 +01:00
Steven Schäfer
dad10e94aa JVM IR: Mangle names of $$forInline functions 2021-01-08 16:30:18 +01:00
Jinseong Jeon
7cc06489dd IR: move enum value array initialization out of <clinit>
#KT-44192 Fixed
2021-01-07 23:00:37 +01:00
Jinseong Jeon
f8f08e8134 IR: add a test about maximum number of constants in an enum class 2021-01-07 23:00:37 +01:00
Ilya Chernikov
0a8858fbfe [minor] document -compiler-path option for kotlin runner 2021-01-07 10:37:23 +01:00
Ilya Chernikov
979144157f Implement -howtorun option for kotlin runner
Implement -no-stdlib argument support in kotlin runner

#KT-43534 fixed
2021-01-07 10:37:22 +01:00
Ilya Chernikov
edc730f70b Implement -no-stdlib argument support in kotlin runner
#KT-43294 fixed
2021-01-07 10:37:22 +01:00
Ilya Chernikov
d2ecc1e361 Implement -X arguments passing from kotlin runner to compiler 2021-01-07 10:37:22 +01:00
Ilya Chernikov
9a7d1948a7 Implement support for -Xdefault-script-extension cli option 2021-01-07 10:37:22 +01:00
Ilya Chernikov
534342a566 [minor] use new kotlin.io.path API in tests 2021-01-07 10:37:21 +01:00
Ilya Chernikov
1bd6cc823c Fix provided properties access generation
The presense of accessors in the descriptor led to the wrong code
generation in some cases.
#KT-43176 fixed
2021-01-07 10:37:20 +01:00
Ilya Chernikov
ffdcda8914 [build] Fix JDK detection on Mac OS X 11 (Big Sur)
#KTI-443 fixed
2021-01-07 10:37:19 +01:00
Kristoffer Andersen
77836f1aa9 [Test] Port checkVariableTable suspend lambda tests
Reveals discrepancy in LVT presence on lambda implementations on the
old and new backend.

The generated code in the constructors of Suspend Lambda objects is
identical, but the IR backend generates an LVT with the constructor
parameters.

The user has to be very insistent to see this ("for step into" +
disabling "Show only kotlin variables"), but it is an observable
difference.
2021-01-06 22:33:37 +01:00
Alexander Udalov
82abc80215 Move old changelogs to docs/changelogs/ 2021-01-06 21:53:12 +01:00
Nelson Osacky
db3bebb531 Add Revved up by Gradle Enterprise badge to Readme 2021-01-06 20:37:45 +03:00
Alexander Udalov
41c4693ebf Build: remove obsolete -Xir-binary-with-stable-abi
It's no longer needed after eef06cded3 and 3e3ffee2a0.
2021-01-04 18:10:43 +01:00
Alexander Udalov
ee2ae0c471 JVM IR: remove obsolete -Xir-check-local-names
This flag was added a long time ago, at the time when we weren't sure if
we were going to keep the naming of local and anonymous classes
completely equal to the naming in the old backend. Now that we've
decided that we won't keep it equal and there are a lot of differences
already, it's not useful anymore.
2021-01-04 12:13:13 +01:00
Alexander Udalov
acd29481bd Regenerate sources of builtins and stdlib 2021-01-03 22:31:06 +01:00
Alexander Udalov
ed9a0e514d Regenerate tests and fir-tree 2021-01-03 14:53:41 +01:00
Shagen Ogandzhanian
96de9144de [JS IR] Generate stub for exported functions with default params
see https://youtrack.jetbrains.com/issue/KT-43407
2020-12-31 20:21:21 +01:00
Alexander Udalov
bf3f6594d5 IR: do not lose $default function annotations when generating calls
Losing an annotation like `JvmName` resulted in the incorrect bytecode
generated in the JVM IR backend.

 #KT-44160 Fixed
2020-12-31 18:36:24 +01:00
Alexander Udalov
ac325f6111 IR: add toString for IrBased descriptors
To help in diagnosing issues like KT-44160.
2020-12-31 18:36:24 +01:00
Ilya Gorbunov
3c37bbaf64 Duration: normalize to avoid negative zeroes (KT-44168)
The current comparison method of inline classes makes
durations of positive and negative zeroes non-equal.
To avoid that, normalize the duration value upon construction
preventing negative zero being stored.
2020-12-31 19:44:39 +03:00
Ilya Gorbunov
ae6f10df3b Duration: reject NaN duration values (KT-44168) 2020-12-31 19:44:10 +03:00
Ilya Gorbunov
1d40ed39d0 KotlinVersion: Advance snapshot version 1.4.255 -> 1.5.255
KTI-421
2020-12-31 19:20:29 +03:00
Nikolay Krasko
133e39b783 Advance snapshot version 1.4.255 -> 1.5.255 (KTI-421)
#KTI-421 Fixed
2020-12-31 15:49:06 +03:00
Abduqodiri Qurbonzoda
662787b12b Straighten Char-to-code and Char-to-digit conversions out #KT-23451 2020-12-31 12:07:41 +03:00
Ilya Gorbunov
79e426270c Rename Random.Default serialization surrogate object (KT-25571) 2020-12-31 06:57:17 +03:00
Iaroslav Postovalov
00506a75d3 Make Random implementations serializable (KT-25571)
Make Random.Default, XorWowRandom, and wrapper classes for JDK Random implement Serializable interface.

Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2020-12-31 04:10:28 +03:00
Svyatoslav Kuzmich
38967f208e [Wasm] Remove unused WasmI1 type 2020-12-30 19:29:11 +03:00
Svyatoslav Kuzmich
22239e2733 [Wasm] Remove unused super class field in type info 2020-12-30 19:29:11 +03:00
Svyatoslav Kuzmich
785c947782 [Wasm] Improve class type checks
Use wasm ref.test instad of manual type info linked list traversal
2020-12-30 19:29:10 +03:00
Svyatoslav Kuzmich
b6ad1584c9 [Wasm] Improve interface method dispatch
- Use typed Wasm tables for each interface method to avoid runtime
  function type check

- Use linear search by implemented interface rather than by individual
  virtual function signature
2020-12-30 19:29:10 +03:00
Shagen Ogandzhanian
e7dc199ad7 Init enum entries whenever we access companion object or accessing valueOf
Fixes https://youtrack.jetbrains.com/issue/KT-43987
Fixes https://youtrack.jetbrains.com/issue/KT-43989
2020-12-30 14:54:34 +01:00
Dmitry Petrov
7fa04afda2 JVM_IR KT-32115 fix $$delegatedProperties initialization in enum 2020-12-30 15:56:18 +03:00
Dmitriy Novozhilov
3e3ffee2a0 Advance bootstrap to 1.5.0-dev-1141 2020-12-30 11:37:37 +03:00
Dmitry Petrov
81e00ca371 JVM box tests for KT-30402 2020-12-30 10:57:46 +03:00
Abduqodiri Qurbonzoda
1314adb6f7 Locale-agnostic case conversions by default #KT-43023 2020-12-30 10:08:25 +03:00
Ilmir Usmanov
80289e4a3f IC Mangling: Generate inline class literal instead of underlying type
literal in annotations.
 #KT-30280 Fixed
2020-12-30 03:31:08 +01:00
Shagen Ogandzhanian
55a5695fc0 [JS] Forbid export of interfaces
With the only exception of external interfaces.

See https://youtrack.jetbrains.com/issue/KT-44099
2020-12-29 20:43:57 +01:00
Mikhail Glukhikh
a6534c4653 [FIR] Fix completion of synthetic call arguments 2020-12-29 17:48:15 +03:00
Denis.Zharkov
b7a382f097 Revert "Fix ISE when inferring type of a property that delegates to itself"
This reverts commit 1a03d5c93e.

The reason is that original change seems to be breaking (see KT-44137).

^KT-44137 Relates
^KT-37796 Open
2020-12-29 17:41:12 +03:00
Roman Artemev
826985450e Add test for KT-42036 2020-12-29 16:27:31 +03:00
Victor Petukhov
30a5eee481 Don't approximate abbreviation during substitution it as it can't be projected at top-level
^KT-42036 Fixed
2020-12-29 16:08:38 +03:00
Dmitriy Novozhilov
009add2b41 [Test] Report difference in test data file in a first place 2020-12-29 16:06:48 +03:00
Dmitriy Novozhilov
0af1c81d62 Revert "Probably fix issue with creating module descriptor for SDK twice"
This reverts commit 92adccde

Actually this commit didn't fix anything so it can be reverted
2020-12-29 14:16:48 +03:00
Ilya Kirillov
6230a7861a Wizard: do not print plugin repositories in build files if all of them are default ones
Also, use space dev repo for kotlin dev plugins
2020-12-29 11:50:36 +01:00
Mikhail Glukhikh
74077bf6d2 [FIR] Don't attempt to process interface constructors 2020-12-29 12:18:03 +03:00
Yunir Salimzyanov
6a6e2a1c77 Set custom timeout for flaky muted tests synchronization requests
Cause: Teamcity requests processes for average 80 seconds
2020-12-29 12:16:40 +03:00
Victor Petukhov
27dd9484ba Add missed type arguments for a star projection into the enhanced type arguments list 2020-12-29 11:31:16 +03:00
Zalim Bashorov
531ba4bb48 [IR] Narrow usage scope of ObsoleteDescriptorBasedAPI in CheckIrElementVisitor 2020-12-28 18:53:55 +03:00
Zalim Bashorov
02849edc22 [IR] Make descriptor parameter optional for IrFileSymbolImpl and IrExternalPackageFragmentSymbolImpl
Remove DescriptorlessIrFileSymbol and use IrFileSymbolImpl instead.
2020-12-28 18:53:54 +03:00
Zalim Bashorov
14254ceb0b [IR] Remove no longer needed usages of ObsoleteDescriptorBasedAPI 2020-12-28 18:53:54 +03:00
Zalim Bashorov
0372dae3ce [JS scripting] Remove usages of descriptor based APIs and proper support for callable references 2020-12-28 18:53:53 +03:00
Zalim Bashorov
9ac7c3d8bc [Wasm] Remove usage of descriptor based API usage from WasmSharedVariablesManager 2020-12-28 18:53:53 +03:00
Zalim Bashorov
c569ec1bad [IR] Add dumpKotlinLike for IrType and IrTypeArgument 2020-12-28 18:53:52 +03:00
Alexander Udalov
77a9d14f93 Capitalize/decapitalize only ASCII characters across project
Use {de,}capitalizeAsciiOnly and to{Lower,Upper}CaseAsciiOnly where
possible, and stdlib's functions with Locale.US everywhere else.

Otherwise, if the default system locale is Turkish, the capital latin
letter "I" is transformed in toLowerCase to "ı" (see
66bc142f92/libraries/stdlib/jvm/test/text/StringJVMTest.kt (L119)),
which for example breaks the codegen for `intArrayOf` in
KT-25400/KT-43405.

Similarly, lower case latin letter "i" is transformed to "İ".

 #KT-13631 Fixed
 #KT-25400 Fixed
 #KT-43405 Fixed
2020-12-28 16:10:30 +01:00
Dmitry Petrov
5d4b0b19d4 JVM_IR KT-13213 split string constants into parts of acceptable length 2020-12-28 16:50:29 +03:00
Andrei Klunnyi
3f287d344e KT-43941 [Sealed interfaces]: subclass intention
Restriction for sealed inheritors was relaxed. Instead of being nested
class members now they can be the members of the same module and
package.
2020-12-28 13:45:58 +00:00
Andrei Klunnyi
1cac8b0d61 KT-43941 [Sealed interfaces]: preliminary, J2K 2020-12-28 13:45:57 +00:00
Andrei Klunnyi
86792131cd KT-43941 [Sealed interfaces]: preliminary, code cleanup 2020-12-28 13:45:57 +00:00
Denis.Zharkov
acbf382d04 FIR: Add test on ambiguous vararg
Fix is in the two previous commits
2020-12-28 13:19:23 +03:00
Jinseong Jeon
8c7b23a8dd FIR Java/JVM: avoid plain "Array" comparison 2020-12-28 12:45:51 +03:00
Jinseong Jeon
383de7a9c5 FIR Java: Fix Java override ambiguity with vararg value type
#KT-44066 Fixed
2020-12-28 12:45:51 +03:00
Mikhail Glukhikh
d663f204e5 FIR Java: make method annotations lazy 2020-12-28 12:06:51 +03:00
Mikhail Glukhikh
c8c34ebf17 FIR Java: make constructor annotations lazy 2020-12-28 12:06:45 +03:00
Mikhail Glukhikh
56df95b8e7 FIR Java: make field annotations lazy 2020-12-28 12:06:39 +03:00
Nikolay Krasko
33892f3ddf Make checker tests independent of plugin version (KTI-433) 2020-12-25 22:36:49 +03:00
Nikolay Krasko
f72cec7904 Minor: remove unused methods 2020-12-25 22:36:48 +03:00
Victor Petukhov
37473ad640 Substitute lambda's receiver type during completion including the builder inference stub variables substitution
^KT-42175 Fixed
2020-12-25 21:33:37 +03:00
Svyatoslav Kuzmich
672859d447 [Wasm] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Svyatoslav Kuzmich
0945c110bf [JS IR] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Victor Petukhov
07b6f0d871 Fix failing tests 2020-12-25 14:29:11 +03:00
Mikhail Glukhikh
0d40fde713 FIR synthetics: make setter subtype check more precise #KT-43347 Fixed 2020-12-25 14:07:28 +03:00
Mikhail Glukhikh
8c8f81330a FIR Java: make value parameter annotations lazy 2020-12-25 14:07:16 +03:00
Mikhail Glukhikh
1239a8629e FIR Java: make type annotations lazy 2020-12-25 14:06:34 +03:00
Mikhail Glukhikh
776c4ba6ca Add test for KT-25489 (to reproduce, turn UL classes OFF) 2020-12-25 14:06:16 +03:00
Yunir Salimzyanov
532124d9a1 Increase timeout for flaky muted tests synchronization requests 2020-12-25 12:28:37 +03:00
Yunir Salimzyanov
f2ecf7f666 Mute MultiModuleHighlightingTest via csv-file 2020-12-25 12:28:36 +03:00
Victor Petukhov
7ed6aae46e Fix tests after rebasing 2020-12-25 11:53:21 +03:00
Victor Petukhov
50a388aec1 Mute wasm tests around builder inference and callable references 2020-12-25 11:53:21 +03:00
Victor Petukhov
0dde5ddd7e Fail calls constraints of which contain uninferred type parameter
^KT-44055 Fixed

It's possible only if there is a callable reference among subcalls which go though the old type inference (and the error for uninferred type parameter wasn't reported)
2020-12-25 11:53:16 +03:00
Victor Petukhov
9afc13f002 Unwrap block expressions to report errors on them about not enough type information
^KT-44055 Fixed
2020-12-25 11:53:15 +03:00
Victor Petukhov
4c56962678 Report errors on callable references which contains postponed type variables in the receiver type 2020-12-25 11:53:15 +03:00
Victor Petukhov
86edc5ca3a Reuse information from already recorder descriptor for some callable references and don't rewrite at slice 2020-12-25 11:53:15 +03:00
Victor Petukhov
1926434b18 Report error about uninferred type parameter for some special call' subcalls 2020-12-25 11:53:14 +03:00
Victor Petukhov
0b472f858b Don't create DONT_CARE type for CR and lambdas within builder inference calls
It leads to leak such type to the back-end. Calls within a builder call should be updated without marking CR and lambdas with DONT_CARE type.

^KT-43845 Fixed
^KT-43956 Fixed
^KT-42622 Fixed
2020-12-25 11:53:14 +03:00
Victor Petukhov
b4d8adeeb4 Don't clean type info for containment operator if the resolution was unsuccessful, but all diagnostics were about only input types and non-strict only input types check was enabled 2020-12-25 11:53:09 +03:00
Victor Petukhov
954c9cecca Compute type for callable references and lambdas inside not null assertion if couldn't get already recorded type 2020-12-25 11:52:59 +03:00
Victor Petukhov
39e579db91 Move tests for builder inference into the corresponding directory 2020-12-25 11:25:39 +03:00
Dmitry Petrov
9b148325fe Minor: regenerate tests 2020-12-25 09:41:06 +03:00
Dmitry Petrov
9715ae88fe Minor: regenerate tests 2020-12-25 09:15:47 +03:00
Zalim Bashorov
03594baa07 [IR] Improve dumpKotlinLike
* Generate a comment for modules.
* Fix printing supertypes for classes.
* Don't fail while printing constructor call if data's parent isn't IrClass
2020-12-24 20:03:24 +03:00
Zalim Bashorov
f7b0f55532 [JS IR test] Add an ability to setup phases to dump after and phases to validate after in box tests using system properties 2020-12-24 20:03:24 +03:00
Zalim Bashorov
ee60a1a431 [IR] Add an ability to change dump strategy using a system property 2020-12-24 20:03:23 +03:00
Zalim Bashorov
274b09cf36 [JS IR] Support generating JS expression from IrComposite
Except the case when it's empty.
2020-12-24 20:03:23 +03:00
Zalim Bashorov
72593e3d30 [JS IR] Revert jsClass_js-ir.kt to not break compatibility with older compiler versions 2020-12-24 20:03:23 +03:00
Zalim Bashorov
d7e3f826bb [JS IR] Generate jsClass function inside the compiler instead of relying on declaration inside stdlib
We want to make its type parameter reified to do it we have to make it inline and non-external.
But we don't want to inline it in call sites and want prevent using it anywhere except places generated by the compiler.
In user code, including stdlib, we should use `K::class.js` instead.
Separately we have to intrinsify `K::class.js` to reduce overhead.
2020-12-24 20:03:23 +03:00
Zalim Bashorov
df6635085b [JS IR] Replace calls with invalid type arguments for type parameters with call to errorCode function from runtime. 2020-12-24 20:03:22 +03:00
Zalim Bashorov
ff77155b5a [JS IR] A type argument of the jsClass intrinsic must be a class (IrClass) 2020-12-24 20:03:22 +03:00
Zalim Bashorov
c1f6a72ae1 [JS IR] Remove inline properties with reified parameters
RemoveInlineFunctionsWithReifiedTypeParametersLowering -> RemoveInlineDeclarationsWithReifiedTypeParametersLowering
2020-12-24 20:03:22 +03:00
Zalim Bashorov
da8dacb495 [JS IR] run RemoveInlineFunctionsWithReifiedTypeParametersLowering earlier
It's required to avoid extracting local classes declarations and leaking some references to inline function internals.
2020-12-24 20:03:21 +03:00
Zalim Bashorov
bc9828f3f3 [JS IR] Generate a key using hashedMangle for all IR declarations in mapToKey
It is required to avoid "key" clashes and failing with ISE.
2020-12-24 20:03:21 +03:00
Zalim Bashorov
7c5ea414b7 [JS IR] Use mappedNames in NameTable only for REPL
And throw exception for unsupported types in mapToKey
2020-12-24 20:03:21 +03:00
Andrei Klunnyi
faa24e3230 KT-44043 Sealed interfaces: 201/203 compatibility fix 2020-12-24 17:50:47 +01:00
Dmitry Petrov
a1574bf50a JVM box tests for KT-30548 2020-12-24 19:35:36 +03:00
Dmitriy Novozhilov
daa6255ab7 Update testdata of PsiCheckerSealedTest after 07b980fe 2020-12-24 17:53:08 +03:00
Roman Golyshev
f00e5b1992 FIR: Check relativeClassName of found class in JavaSymbolProvider
`ClassId` denotes how class is nested; however, you can find
`foo/bar/Outer.Nested` class by `ClassId(foo/bar/Outer/Nested)`. This
will lead to inconsistencies when working with class symbol later

This is also important to `FirQualifierResolverImpl::resolveSymbol`
which detects correct `ClassId` by traversing all symbol qualifiers

We check only `relativeClassName`, because we want to be able to find
classes without package specified

Also, fix test data of resolve tests that have been passing because of
check absence
2020-12-24 14:25:48 +00:00
Ilya Goncharov
2ce51a4c11 [Gradle, JS] Fix tests with decamelizing names
^KT-43237 fixed
2020-12-24 16:35:29 +03:00
Ilya Goncharov
0bd4de65e1 [Gradle, JS] Fix upper case names in js files, decamelize instead
^KT-43237 fixed
2020-12-24 16:35:29 +03:00
Ilmir Usmanov
9c67d8f89e IC Mangling: Correctly mangle functions with generic return type
if the type's parent is inline class.
 #KT-43050 Fixed
 #KT-26130 Fixed
 #KT-32384 Fixed
2020-12-24 14:29:48 +01:00
Andrei Klunnyi
f8cca288ab KT-44075 Sealed interfaces: New Kotlin Class/File menu update
^KT-44075 Fixed
2020-12-24 13:07:52 +00:00
Dmitriy Dolovov
740b8a9aec [Commonizer] Fix computing outer class type arguments 2020-12-24 15:55:36 +03:00
Dmitriy Novozhilov
8bd4e67341 [Test] Drop obsolete FIR tests 2020-12-24 14:58:06 +03:00
Dmitriy Novozhilov
660c438ebe [Test] Migrate tests of foreign annotations to new infrastructure
This commit includes:
- test runners for foreign annotation tests
- minor changes testdata related to changed directives syntax
- dropping tests with javac integration: old javac tests actually ran
    compiler without javac because of bug in configuration, so some
    nullability annotations features are not supported in javac mode.
    It's fine to drop it since javac mode is not fully supported
    by compiler
2020-12-24 14:58:05 +03:00
Dmitriy Novozhilov
ef3d966d53 [Test] Fix dependencies in task [JPS] Generate All Tests 2020-12-24 14:58:04 +03:00
Dmitriy Novozhilov
8689fc43cd [Test] Move java generation utils to :compiler:tests-compiler-utils module 2020-12-24 14:58:02 +03:00
Dmitriy Novozhilov
cb7b1652e7 [Test] Extract MockLibraryUtil to :compiler:tests-compiler-utils
Also provide MockLibraryUtilExt with bridges to MockLibraryUtil
  with JUnit4Assertions
2020-12-24 14:58:01 +03:00
Dmitriy Novozhilov
eadec08937 [Test] Reformat MockLibraryUtil according to code style 2020-12-24 14:57:59 +03:00
Dmitriy Novozhilov
e287742842 [Test] Add ability to provide additional analysis flags in EnvironmentConfigurator 2020-12-24 14:57:58 +03:00
Dmitriy Novozhilov
c4691de72d [Test] Deprecate AbstractDiagnosticsTest in old test infrastructure 2020-12-24 14:57:57 +03:00
Dmitriy Novozhilov
a9f913a97f [Test] Migrate AbstractDiagnosticsWithJdk15Test to new infrastructure 2020-12-24 14:57:56 +03:00
Dmitriy Novozhilov
02fb11a2cd [Test] Fix double reading of module directives 2020-12-24 14:57:55 +03:00
Dmitriy Novozhilov
0e3ed3fee6 [Test] Remove duplicating code from ClassicFrontend2IrConverter 2020-12-24 14:57:53 +03:00
Denis.Zharkov
1a03d5c93e Fix ISE when inferring type of a property that delegates to itself
^KT-37796 Fixed
2020-12-24 14:06:20 +03:00
Denis.Zharkov
cbb8459e4e Fix AE: No receiver found on incomplete code with $-signs
^KT-24158 Fixed
2020-12-24 14:06:20 +03:00
Denis.Zharkov
77d4a46a6b Fix light classes exception occurring on obfuscated Kotlin libraries
^KT-29454 Fixed
2020-12-24 14:06:20 +03:00
Denis.Zharkov
7b9f6c1560 Fix exceptions caused by cyclic dependency between ModuleDescriptor and JvmBuiltIns
^KT-39105 Fixed
^KT-42001 Fixed

See also EA-216604 and EA-211562
2020-12-24 14:06:20 +03:00
Denis.Zharkov
5a8dc00a0d Rename JvmBuiltInsSettings -> JvmBuiltInsCustomizer 2020-12-24 14:06:19 +03:00
Dmitriy Novozhilov
70ae756083 Revert "[Test] Save TargetBackend instead of BackendKind in TestModule"
This reverts commit 29d923d5
2020-12-24 13:57:02 +03:00
Dmitriy Novozhilov
07b980fea0 [FE] Fix error message of SEALED_INHERITOR_IN_DIFFERENT_PACKAGE diagnostic 2020-12-24 13:47:45 +03:00
Dmitriy Novozhilov
29d923d50d [Test] Save TargetBackend instead of BackendKind in TestModule 2020-12-24 13:44:05 +03:00
Dmitriy Novozhilov
70c4bdf32e [FE] Detect recursion when typealias referenced as annotation in its RHS
#KT-14612 Fixed
2020-12-24 13:44:04 +03:00
Dmitry Petrov
d3349197ba Minor: regenerate tests 2020-12-23 21:50:12 +03:00
Dmitry Petrov
4e261cc358 JVM_IR KT-24258 fix NPE message for delegated properties 2020-12-23 21:50:10 +03:00
Dmitry Petrov
ad8bed078f JVM box tests for KT-24193 2020-12-23 21:50:09 +03:00
Dmitry Petrov
a8d848ccbd JVM box tests for KT-23974 2020-12-23 21:50:08 +03:00
Dmitry Petrov
3f7a776fb8 JVM box tests for KT-21092 2020-12-23 21:50:07 +03:00
Dmitry Petrov
0841a6b0ea irText tests for KT-19306 2020-12-23 21:50:06 +03:00
Dmitry Petrov
9f908cdf7c JVM box tests for KT-16752 2020-12-23 21:50:05 +03:00
Ilmir Usmanov
8bfcef415e Do not generate variables for non-generated fields
Use attributes instead of classes.
 #KT-43048 Fixed
2020-12-23 19:45:15 +01:00
Iaroslav Postovalov
8a7bc2ef6f Rename continuation fields according the convention and count them in IR 2020-12-23 19:45:13 +01:00
Iaroslav Postovalov
cd2b05eb00 Discard misc.xml changes 2020-12-23 19:45:11 +01:00
Iaroslav Postovalov
165ba85337 Remove useless OptIn annotation 2020-12-23 19:45:09 +01:00
Iaroslav Postovalov
b13822bb2d Remove unrelated change 2020-12-23 19:45:07 +01:00
Iaroslav Postovalov
6f34f00c61 Do not generate the field for unused parameters in suspend lambdas 2020-12-23 19:45:04 +01:00
Ilmir Usmanov
f49cf2d5ca IC Mangling: correctly mangle inline default functions
#KT-43682 Fixed
2020-12-23 18:13:09 +01:00
Ilya Kirillov
7c9cf45a3f FIR IDE: fix testdata 2020-12-23 17:16:32 +01:00
Ilya Kirillov
b2b364eca6 FIR IDE: resolve fir file to BODY_RESOLVE when it requested by getOrBuildFir 2020-12-23 17:16:30 +01:00
Ilya Kirillov
fa42f9302e FIR IDE: unmute passing test 2020-12-23 17:16:29 +01:00
Ilya Kirillov
ce77903898 FIR IDE: add deadlock checking for read/write resolve locks 2020-12-23 17:16:28 +01:00
Ilya Kirillov
0ec152e457 FIR IDE: fix deadlock in override check
We should not call withFir nestedly as resolving in read action causing deadlocks
2020-12-23 17:16:26 +01:00
Ilya Kirillov
8a17a16ee2 FIR IDE: consider modification in invalid PSI as OOBM 2020-12-23 17:16:25 +01:00
Ilya Kirillov
d06a5fb413 FIR IDE: disable some script stuff in FIR plugin as causes exceptions 2020-12-23 17:16:23 +01:00
Ilya Kirillov
70b1edb81d FIR IDE: allow using some light classes stuff from EDT :(
IJ Platform can call light classes methods from EDT from random places
2020-12-23 17:16:22 +01:00
Ilya Kirillov
306b46b8f2 FIR IDE: consider FirErrorReferenceWithCandidate as reference with error 2020-12-23 17:16:21 +01:00
Ilya Kirillov
9a86d2e10c FIR IDE: do not mark declaration with some lazy resolve phase if only some children are resolved to that phase
Otherwise, we will not be able to resolve parent one
2020-12-23 17:16:19 +01:00
Ilya Kirillov
1e2536402d FIR: render constructor resolve phase in FirRenderer when renderDeclarationResolvePhase is requested 2020-12-23 17:16:18 +01:00
Ilya Kirillov
85c65e20b3 FIR: add meaningful error message when type ref is unresolved 2020-12-23 17:16:17 +01:00
Ilya Kirillov
6ad396f417 FIR: use transformer creator from existing return type calculator when creating a new one 2020-12-23 17:16:16 +01:00
Ilya Kirillov
68f6e734be FIR IDE: add test case for resolving call as value argument 2020-12-23 17:16:14 +01:00
Ilya Kirillov
af5aa5fa66 FIR IDE: add more info to the call resolve error message 2020-12-23 17:16:13 +01:00
Ilya Kirillov
c5788290f3 FIR IDE: refactor: move designation & transformer creation in lazy resolve to separate functions 2020-12-23 17:16:12 +01:00
Ilya Kirillov
c61b0d1f31 FIR IDE: fix designation collection for lazy resolve 2020-12-23 17:16:11 +01:00
Roman Golyshev
3aef1154c8 FIR IDE: Get rid of FirTransformerProvider class
Instead, create `ScopeSession` by hand and pass it as a parameter when
it is crucial for the performance
2020-12-23 17:16:09 +01:00
Ilya Kirillov
d3cab96ca0 FIR IDE: consider declaration to be lazy resolvable if it has fqName 2020-12-23 17:16:07 +01:00
Ilya Kirillov
8e592bdff0 FIR IDE: invalidate analysis session cache on out of block 2020-12-23 17:16:02 +01:00
Ilya Kirillov
9c26edbaaa FIR IDE: split ValidityToken.isValid into isValid & isAccessible 2020-12-23 17:16:01 +01:00
Ilya Kirillov
a2befd4635 FIR IDE: add missing ClsJavaStubByVirtualFileCache service 2020-12-23 17:16:00 +01:00
Ilya Kirillov
eead868cd2 FIR IDE: use correct out of block modification tracker 2020-12-23 17:15:58 +01:00
Ilya Kirillov
0862928bf7 FIR IDE: move KotlinOutOfBlockModificationTrackerFactory to frontend independent module 2020-12-23 17:15:57 +01:00
Ilya Kirillov
a30d9e0ed3 FIR: add fake source fir element to it parameter symbol 2020-12-23 17:15:56 +01:00
Ilya Kirillov
af0e8b28d5 FIR IDE: add missing statistic extension points 2020-12-23 17:15:55 +01:00
Georgy Bronnikov
b35d4134a7 Psi2IR: workaround for IR-based descriptors
Since KotlinTypes involving IR-Based descriptors are distinct from KotlinTypes
involving original descriptors of the same declarations, subtyping check
breaks in InsertImplicitCasts.
2020-12-23 18:50:53 +03:00
Georgy Bronnikov
99c874ba8a IR: use NullDescriptorRemapper in DeepCopySymbolRemapper 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
c5961da780 IR: remove WrappedDescriptors altogether 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
e9f45e23f2 IR: NullDescriptorsRemapper 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
3683cd0f7b IR: fix IrBasedTypeAliasDescriptor 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
076272f7ca FIR2IR: avoid descriptors computing hashCode
When synthesizing the hashCode function for data classes, descriptors
were used, in partcular, memberScope for primitive classes.
IrBasedDescriptors have no member scope, so we compute the hashCode
function based on IR structures.
2020-12-23 18:50:52 +03:00
Georgy Bronnikov
b07dccb8d7 Fir2IR: remove wrapped descriptors 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
b05400154d IR: remove IrSymbolDeclaration 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
d714adacae IR: removing WrappedDescriptors from symbols 2020-12-23 18:50:51 +03:00
Georgy Bronnikov
989d4350b1 IR: make descriptor optional in IrSymbol 2020-12-23 18:50:51 +03:00
Jinseong Jeon
aaa3f2e2c1 FIR2IR: correct IR origin for substitution overrides
#KT-44054 Fixed
2020-12-23 16:13:05 +03:00
Jinseong Jeon
34dbbdce07 FIR2IR: use lookupTag or class to getLocalClass, not classId
Before this commit, we sometimes tried to fetch anonymous object by id,
getting sometimes a wrong result because it's singleton.
Now we use lookupTag or FIR class itself instead.

#KT-44050 Fixed
2020-12-23 16:12:58 +03:00
Alexander Dudinsky
94315bc4dc Remove mapping to kotlin-ultimate from vsc.xml 2020-12-23 15:04:38 +03:00
Dmitry Petrov
632f5af442 Minor: kt21014.kt - add JVM_TARGET 1.8 2020-12-23 11:25:36 +03:00
Alexander Dudinsky
10a5727260 Merge together MultiplatformHighlighting and MultiplatformAnalysis tests
Basically, the former uses an old quickly-scrapped infrastructure,
which were not applicable for HMPP, so  the latter tests were written.

So, both check for one and the same thing (highlighting in MPP projects),
but MultiplatformAnalysisTest is more modern,
and has a lot of inconvenient stuff in MultiplatformHighlighting fixed
^KT-43116 Fixed
2020-12-23 10:47:18 +03:00
Jinseong Jeon
73576c80e4 FIR2IR: calculate IR parent for Java field ahead
so as to cache type parameters from the parent if the field's return
type is one of type parameters.

#KT-44032 Fixed
2020-12-23 09:10:52 +03:00
Vyacheslav Gerasimov
89577543a2 Build: Disable plugin marker publication for sonatype 2020-12-23 02:58:14 +03:00
Mikhail Glukhikh
107a825c5f Make FileDescriptorForVisibilityCheck subtype of PackageFragmentDescriptor
#KT-20548 Fixed
2020-12-23 00:11:08 +03:00
Dmitry Petrov
3ae8521f12 Minor: drop kt21014.kt (SIGSEGV on HotSpot 6.0_45-b06) 2020-12-22 19:56:54 +03:00
Dmitry Petrov
f647233189 Minor: drop empty bunch file 2020-12-22 16:10:50 +03:00
Dmitry Petrov
796d821776 JVM_IR box tests for JDK9 2020-12-22 16:09:48 +03:00
Dmitry Petrov
c9d330207b JVM_IR no nullability annotations on SAM wrapper constructor parameters 2020-12-22 16:09:46 +03:00
Dmitry Petrov
4780c73e40 Ignore anonymous inner classes in LightAnalysisMode tests 2020-12-22 16:09:45 +03:00
Dmitry Petrov
0dff583070 JVM KT-36984 SAM wrappers are anonymous inner classes 2020-12-22 16:09:45 +03:00
Dmitry Petrov
57dd9fc87a JVM_IR KT-36984 SAM wrappers are anonymous inner classes 2020-12-22 16:09:45 +03:00
Dmitry Petrov
443cd0fc2c Tests for issues fixed in JVM_IR 2020-12-22 16:07:06 +03:00
Denis.Zharkov
5e5b236ef8 Extract record related parts into smaller bunch files for 201 2020-12-22 14:58:05 +03:00
Jinseong Jeon
e05d26b9b0 FIR2IR: cache type parameters in delegated property
#KT-44030 Fixed
2020-12-22 12:05:31 +03:00
Jinseong Jeon
78fa8814c4 FIR: unwrap f/overrides when determining mutability of property reference
#KT-44010 Fixed
2020-12-22 12:04:56 +03:00
Nikolay Krasko
0918e73dff Move wasm tests to JS tests configuration (KTI-419) 2020-12-21 19:59:13 +03:00
Dmitriy Novozhilov
554fa358e8 [FIR] Fix calculating offsets of light tree source elements for local declarations 2020-12-21 18:34:58 +03:00
Dmitriy Novozhilov
298e27bdac [Test] Migrate AbstractExtendedFirDiagnosticsTest to new infrastructure 2020-12-21 18:34:57 +03:00
Dmitriy Novozhilov
a276d05917 [Test] Generate FIR tests with new infrastructure in :analysis-tests module 2020-12-21 18:34:56 +03:00
Dmitriy Novozhilov
537e4f0bb4 [Test] Move existing fir tests on old infrastructure to :legacy-fir-tests module 2020-12-21 18:34:55 +03:00
Dmitriy Novozhilov
1f258c28fc [Test] Extract main compiler test generator to separate project
This is needed because now we have different tests modules with different
  test frameworks (JUnit3 and JUnit5) which has no dependencies between
  each other. So for keeping all test generation config in one place
  we need module which may rely on all independent test modules
2020-12-21 18:34:54 +03:00
Jinseong Jeon
d753d21dee FIR2IR: don't add SAM conversion for explicit subtype cases 2020-12-21 18:01:27 +03:00
Jinseong Jeon
7df289746c FIR: fix invoke lookup for SAM resolution 2020-12-21 18:01:26 +03:00
Jinseong Jeon
3bca6ae893 FIR: allow lower bound of flexible type when finding contributed invoke 2020-12-21 18:01:25 +03:00
Jinseong Jeon
4a24f0fab3 FIR2IR: use FirSamResolverImpl to get function type for possible SAM type 2020-12-21 18:01:23 +03:00
Jinseong Jeon
d5a6991b2d FIR: extend SAM conversion to subtype of functional type 2020-12-21 18:01:22 +03:00
Mikhail Glukhikh
c6a40b2322 Optimize/simplify FirJvmTypeMapper.defaultType 2020-12-21 17:35:51 +03:00
Mikhail Glukhikh
3ab5b57594 Optimize/simplify FirJvmTypeMapper.representativeUpperBound 2020-12-21 17:35:51 +03:00
Mikhail Glukhikh
42b590d07c Optimize/simplify FirSealedClassConstructorCallChecker 2020-12-21 17:35:51 +03:00
Mikhail Glukhikh
c94c71cc50 Optimize/simplify ConeClassLikeLookupTag.getNestedClassifierScope 2020-12-21 17:35:50 +03:00
Mikhail Glukhikh
7add186616 Optimize/simplify FirClass<*>.findNonInterfaceSupertype 2020-12-21 17:35:50 +03:00
Andrei Klunnyi
3e8016ed25 KTIJ-717 [Java side inspection]: "implementation of Kotlin sealed" 2020-12-21 11:44:16 +01:00
Ilya Chernikov
65cf941b9b Remove assertion about dispatch receiver in scripts
#KT-42530 fixed
2020-12-21 09:43:44 +01:00
Ilya Chernikov
0671fd9aaa Support destructuring declarations in scratch files
#KT-25038 fixed
2020-12-21 09:43:44 +01:00
Ilya Chernikov
9ee17cd610 Do not throw assertion on recursion in typealias declaration,
return empty list of descriptors instead, allowing for proper error
reporting later.
#KT-18344 fixed
2020-12-21 09:43:43 +01:00
Ilya Chernikov
02c617468f Add support for a callback on recursion for memoized functions 2020-12-21 09:43:43 +01:00
Alexander Udalov
eef06cded3 JVM IR: output stable ABI binaries by default
#KT-43592 Fixed
2020-12-20 23:14:54 +01:00
Alexander Udalov
e0593ff70f Minor, extract CompilerConfiguration.messageCollector to extension property 2020-12-20 23:14:49 +01:00
Alexander Udalov
691b20a685 JVM IR, FIR: set IR configuration key to true if FIR is enabled 2020-12-20 23:14:41 +01:00
Alexander Udalov
06805ffbaa Change CLI flags for controlling diagnostics for ABI of FIR and JVM IR
- Use a more generic `-Xallow-unstable-dependencies` instead of
  `-Xallow-jvm-ir-dependencies`
- Change `-Xir-binary-with-stable-abi` to `-Xabi-stability=stable`, with
  an additional option to specify `unstable` after a subsequent commit
  where JVM IR becomes stable by default

 #KT-43592
2020-12-20 23:14:32 +01:00
Alexander Udalov
3f517d7e8d Add new metadata flag for class files compiled with FIR
Report a separate error when class files compiled with FIR are in
dependencies, in addition to the one for class files compiled with FE
1.0 + JVM IR.

 #KT-43592
2020-12-20 23:14:30 +01:00
Alexander Udalov
cbd90c3af5 Refactor boolean IR ABI stability flag to enum
Introduce an enum DeserializedContainerAbiStability with two values.
This is needed in order to support another reason for ABI instability in
a subsequent commit, namely "unstable because compiled by FIR".

 #KT-43592
2020-12-20 23:14:12 +01:00
Alexander Udalov
b7d32a8754 Minor, invert analysis flag that allows unstable dependencies 2020-12-20 23:13:50 +01:00
Alexander Udalov
7d37030095 JVM IR, FIR: add JvmBackendExtension instead of MetadataSerializerFactory
This might be a better place for future behavior that should be
abstracted between FE 1.0 and FIR, in JVM IR.
2020-12-20 23:13:48 +01:00
Leonid Startsev
a5ddb1fdf1 Update error about unsupported inline classes
Remove unused declarations
2020-12-19 20:34:45 +03:00
Leonid Startsev
272273baed Support serializable inline classes in IR plugin
as well as standard unsigned types.
2020-12-19 20:34:45 +03:00
Leonid Startsev
631a72d14a Support old serialization runtime versions
(where exception signatures weren't changed)

after f671c27f27
2020-12-19 20:34:11 +03:00
Leonid Startsev
f671c27f27 Adapt serialization exceptions constructor calls in legacy JS
to signature change

(see https://github.com/Kotlin/kotlinx.serialization/pull/1054
and commit eea4ff33a0)
2020-12-19 19:18:15 +03:00
Leonid Startsev
18e7a1485c Additional fix for Compose:
directly search for fields in IR class w/o using the symbol table.
Because Compose copies whole IR, fields got referenced incorrectly.
In the end, bytecode generator thinks that this is a field from other
class and creates a synthetic setter, which is prohibited in Java 9+
(Update to non-static final field ... attempted from a different method than <init>)
2020-12-19 19:18:14 +03:00
Ilmir Usmanov
f922ebbfc3 Value classes: Add JvmInlineValueClasses language feature 2020-12-18 17:53:58 +01:00
Victor Petukhov
48d9812d9e Review fixes around type enhancement and loading type use annotations 2020-12-18 19:32:05 +03:00
Victor Petukhov
9a52863fbd Report warnings about type mismatches based on freshly supported nullability annotations deeply 2020-12-18 19:32:05 +03:00
Victor Petukhov
d6017420de Mark freshly supported annotations to use that mark for reporting corresponding warnings 2020-12-18 19:32:05 +03:00
Victor Petukhov
9693ea19fb Add tests for type enhancement uncluding with compiled java 2020-12-18 19:32:05 +03:00
Victor Petukhov
71ca18e937 Support diagnostic tests with Kotlin against compiled Java 2020-12-18 19:32:05 +03:00
Victor Petukhov
6f8f531d87 Put type enhancement improvements under the compiler flag 2020-12-18 19:32:05 +03:00
Victor Petukhov
857cc92326 Support preference of TYPE_USE annotations to enhance over others like METHOD, FIELD and VALUE_PARAMETER to avoid double applying them in case of arrays: @NotNull Integer [] (both to the array element and to the entire array)
^KT-24392 Fixed
2020-12-18 19:32:04 +03:00
Victor Petukhov
69f31afecc Exclude tests for loading type use annotations and type enhancement based on them to pass using javac and psi class files reading 2020-12-18 19:32:04 +03:00
Victor Petukhov
f389654fea Support type enhancement for super classes' types 2020-12-18 19:32:04 +03:00
Victor Petukhov
276498793f Support enhancement of type parameter's bound for all nullability annotations 2020-12-18 19:32:04 +03:00
Victor Petukhov
c91301d04c Support type use annotations on fields 2020-12-18 19:32:04 +03:00
Victor Petukhov
b0debbe4c9 Add forced mark "isDeprecated" as false for missing types among javac types 2020-12-18 19:32:04 +03:00
Victor Petukhov
8777d28228 Use new jetbrains annotations with type use target for "load java 8" tests 2020-12-18 19:32:04 +03:00
Victor Petukhov
6f64e2c036 Avoid a cycle of analysing of type parameters via checking that it's a type parameter first 2020-12-18 19:32:04 +03:00
Victor Petukhov
a89329e077 Support reading from class files of the type use annotations on type parameters and type arguments
^KT-11454 Fixed
2020-12-18 19:32:03 +03:00
Victor Petukhov
0833719a79 Support annotations on array types
^KT-24392 Fixed
^KT-18768 Fixed
2020-12-18 19:32:03 +03:00
Victor Petukhov
f0ab8bc332 Clean up some code in compiler.resolution.common.jvm 2020-12-18 19:32:03 +03:00
Igor Yakovlev
63aa809280 [FIR IDE] Add fir type annotations test 2020-12-18 14:28:27 +03:00
Igor Yakovlev
c4b708b5dc [FIR IDE] Fixed test data for types 2020-12-18 14:28:27 +03:00
Igor Yakovlev
9e89cfae08 [FIR IDE] Fixed invalid leaks test 2020-12-18 14:28:27 +03:00
Igor Yakovlev
fb94470741 [FIR IDE] Fix resolve value parameter symbol 2020-12-18 14:28:26 +03:00
Igor Yakovlev
8891a337e2 [FIR IDE] Implement type annotations for fir symbols 2020-12-18 14:28:26 +03:00
Igor Yakovlev
9670f67912 [FIR IDE] Make annotations and extension receiver lazy 2020-12-18 14:28:26 +03:00
Jinseong Jeon
9c2d06cf70 FIR: strengthen resolution success check for augmented array set call
This commit removes some false ambiguities &
fixes compilation of tree-generator module with FIR
2020-12-18 14:24:24 +03:00
Simon Ogorodnik
9bf2dfaa02 KT-40200: Fix main function detector in lazy resolve overload resolver 2020-12-18 14:19:56 +03:00
Dmitriy Novozhilov
92adccde47 Probably fix issue with creating module descriptor for SDK twice
During creation and initialization of module descriptor for sdk
  in IdeaResolverForProject.BuiltInsCache.getOrCreateIfNeeded
  AbstractResolverForProject asks for sdk dependency for module
  descriptor for this sdk, so sometimes this module descriptor was
  created twice

#KT-42001 Fixed
EA-211562
2020-12-18 13:40:14 +03:00
Dmitriy Novozhilov
6296f6dc33 [FE] Don't throw assertion in OverrideResolver if directOverridden is empty
Those descriptors may be empty in case user made a mistake and tried to
  delegate implementation of abstract class instead of interface (and
  we don't add functions from abstract class to overriden descriptors
  of fake overrides in case of delegation by)

#KT-40510 Fixed
2020-12-18 13:40:14 +03:00
Jinseong Jeon
dea01125d6 FIR deserializer: keep SourceElement for more precise Fir2IrLazyClass's source 2020-12-18 12:17:23 +03:00
Jinseong Jeon
fe0c25693d FIR2IR: do not convert @ExtensionFunctionType twice 2020-12-18 12:17:21 +03:00
Jinseong Jeon
4608431682 FIR2IR: correct base symbols of fake overrides for delegated member
#KT-43984 Fixed
2020-12-18 11:21:02 +03:00
Jinseong Jeon
44c6ec2c44 FIR checker: make unused checker handle invoke properly
#KT-43688 Fixed
2020-12-18 09:46:39 +03:00
Mikhail Glukhikh
d907c48d9c Allow KtEnumEntry...RefExpression.referencedElement be nullable
This commit fixes KNPE provoked by RemoveExplicitTypeArgumentsIntention
#KT-29735 Fixed
2020-12-18 09:27:18 +03:00
Shagen Ogandzhanian
4f96f9d6a1 [JS IR] Initialize enum fields before accessing them in companion object
see https://youtrack.jetbrains.com/issue/KT-43901
2020-12-18 01:54:59 +01:00
Andrei Klunnyi
3eb0745b58 KTIJ-650 [Code completion]: "sealed interface" is for 1.5+ only 2020-12-17 18:28:04 +00:00
Andrei Klunnyi
27ebb6c946 KTIJ-650 [Code completion]: test framework fix
This commit fixes test infrastructure issue.
Usage of "COMPILER_ARGUMENTS" test-data-instruction resulted in side
effect. Test cases following the one that used it got broken
LanguageVersionSetting - LanguageFeature.MultiPlatformProjects escaped,
languageVersion could be wrong.

Why it happened

KotlinProjectDescriptorWithFacet defines default values
of (language-version, isMultiplatform) settings for the test-case.
The values themselves are stored in KotlinFacetSettings and passed there
only once. After every test-case (if it uses "COMPILER_ARGUMENTS")
infrastructure calls
KotlinLightCodeInsightFixtureTestCaseKt#rollbackCompilerOptions which
resets mentioned values (among others) in KotlinFacetSettings.
Instances of KotlinProjectDescriptorWithFacet are reused hence facet
settings remained reset.
2020-12-17 18:28:03 +00:00
Andrei Klunnyi
efc7ab5023 KTIJ-664 [SealedClassInheritorsProvider]: test fixes 2020-12-17 19:01:49 +01:00
Nikolay Krasko
88a0fe7ec1 Make a longer description for Kotlin Android plugin
Try to overcome `Plugin description must not be generic, please
elaborate.` from the Gradle plugin portal.
2020-12-17 14:30:05 +03:00
Ilya Gorbunov
43c04dfd08 [Wasm] Publish stdlib: remove separate project 2020-12-17 14:13:51 +03:00
Igor Chevdar
be688356c9 [IR] Fixed bug with thread unsafety
There is no need in a singleton here
2020-12-17 14:03:52 +05:00
Igor Chevdar
03693e3d5a [klib] Optimized away some Files.exists() 2020-12-17 13:57:16 +05:00
Dmitriy Novozhilov
f597343d82 [TEST] Fix testdata 2020-12-17 00:33:17 +03:00
Dmitriy Novozhilov
8974d31bb8 [TEST] Fix problem with line separator on windows 2020-12-17 00:33:10 +03:00
Vladimir Dolzhenko
f2fa36f9cb Split modules scan based if facedSettings can affect api/lang level of module
^KTIJ-249 Fixed

Original commit: d280fb1fe466ef7b6ef7559067032033bedefd6e
2020-12-16 21:00:24 +01:00
Dmitriy Novozhilov
e7c4121e67 [TEST] Add muting tests with .fail file for js box tests 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
416f17e5ec [TEST] Drop remaining tests of experimental coroutines 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
019cb1485e [TEST] Extract language feature regex pattern to :test-infrastructure-utils 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
4ed2651c1f [CMI] Rename platforms to attributes in some forgotten places 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
e1802fde29 [TD] Update test data after previous commit 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
49d9b85950 [TEST] Migrate AbstractFirDiagnosticsWithLightTreeTest to new test runners
Also this commit adds AbstractTwoAttributesMetaInfoProcessor which can
  be used for reporting diagnostics with two attributes (OI/NI, PSI/Light tree)
2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
7e9deb7602 [FIR] Fix NPE in light tree source utils 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
b048296dca [FIR] Fix calculating offsets for light tree source elements 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
acbc468fdd [FIR] Add light tree mode to FirAnalyzerFacade 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
2aa1cb7451 [TEST] Migrate AbstractDiagnosticsNativeTest to new test runners 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
e7f8486078 [TEST] Migrate AbstractDiagnosticsTestWithJvmBackend to new test runners 2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
71ffaa2d97 [TEST] Migrate AbstractDiagnosticsTestWithJsStdLib to new test runners 2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
1fe5148f0d [TEST] Extract compiler-specific test utils from :tests-common to new module 2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
d15c7861b2 [TEST] Invert dependency between :test-generator and :tests-common modules
This is needed to provide ability for declaring new implementations of
  test generators, based on existing infrastructure, which won't add
  dependency on :compiler:tests-common

Also this commit removes implicit dependency on :compiler:tests-common
  from :compiler:tests-common-new
2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
bc7e18fb8a [TEST] Regenerate tests after previous commit 2020-12-16 19:52:28 +03:00
Dmitriy Novozhilov
9e2d691425 [TEST] Move utils for checking all files presented to KtTestUtil
This is needed to remove dependency on :tests-common from module
  with abstract test generators
2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
64ce307f7f [TEST] Drop mechanism for muting tests with .mute files
This mechanism is deprecated and replaced with muting in database (.csv files)
2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
f8ad096abb [TEST] Mute tests in IC JS Klib tests using exclude pattern instead of .mute file 2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
d9848544dc [TEST] Move auto mute wrapping utils to :compiler:tests-mutes 2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
8a5fc2ad29 [Build] Split :tests-mutes package to common and TC integration parts
This is needed because of following problem:
- :tests-mutes has `implementation` dependency on khttp library
- khttp has dependency on spek-junit-platform-engine library
- :tests-common had `testCompile` dependency on :tests-mutes which
    added spek library as as a dependency to all modules which depend
    on :tests-common, including :tests-common-new

Then, if project is configured with JPS then if user tries to run all
  tests in directory in module which uses JUnit 5 (like :tests-common-new)
  then spek library will be added to classpath and junit runner takes
  some platform extension from it which causes NoSuchMethodException
  because spek library was compiled against outdated JUnit 5 version
  and current version doesn't have some API.

So splitting :tests-mutes for two parts fixes this issue, because common
  part (:compiler:tests-mutes) no longer depends on khttp, so spek
  library doesn't spreads to all modules
2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
26d7ea6ce6 [TEST] Migrate AbstractDiagnosticsWithModifiedMockJdkTest to new test runners 2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
b43fa94cb6 [TEST] Migrate AbstractDiagnosticsWithUnsignedTypes to new test runners 2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
23e704f361 [TEST] Migrate AbstractDiagnosticsWithExplicitApi to new test runners 2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
c0e4452cf8 [TEST] Migrate AbstractDiagnosticsWithJdk9Test to new test runners 2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
61302a2e08 [TEST] Migrate duplicating javac tests to new test runners
Also minimize scope of DiagnosticUsingJavac tests to
 `compiler/testData/diagnostics/tests/javac`. This is fine since
 javac compilation mode is still not finished and no one not going to
 support it
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
b44dc55109 [TD] Mute some javac tests or update their testdata
There was a refactoring of AbstractDiagnosticsTest in 9052ef06 which
  contains bug that `setupEnvironment` for AbstractDiagnosticsTestUsingJavac
  was not called, so for last year tests `UsingJavac` had no difference
  with usual diagnostics tests which causes some contradictions in test data
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
8ddf419be5 [Build] Fix gradle tests filter for JUnit 5
There is an a optimization in our `projectTest` config which filters
  out some compiled test classes if they didn't contain specified test
  (if user ran :test task with --tests flag). This optimization for one
  tests left only one .class file which contains test. But JUnit 5 for
  tests in inner classes (with @Nested annotation) requires not only
  target class, but and all it's containers

Test: package.SomeTest$Nested.testMethod
JUnit4: package/SomeTest$Nested.class
JUnit5:
- package/SomeTest.class
- package/SomeTest$Nested.class
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
1d04fecd29 [TD] Remove some outdated tests with unsupported EXPLICIT_FLEXIBLE directive 2020-12-16 19:52:24 +03:00
Dmitriy Novozhilov
0b0e2c3ad2 [TD] Create real helpers files for coroutines checkers 2020-12-16 19:52:24 +03:00
Dmitriy Novozhilov
710c5ec8cc [TEST] Drop old generated tests which are duplicated by new ones 2020-12-16 19:52:24 +03:00
Dmitriy Novozhilov
6128d5e7f2 [TEST] Generate new tests using new runners and old testdata 2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
d7224ad63e [Build] Add generating and running new compiler tests to gradle 2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
3bd3545a05 [TEST] Add abstract test runners for some of compiler test in new infrastructure
This commit includes runners for FE 1.0 and FIR diagnostics tests and
  JVM black box tests for old backend
2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
32fda13ef9 [TEST] Implement test generators for junit 5 based tests 2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
cb5183ab4d [TEST] Add implementation of new infrastructure services for compiler tests
All of new classes lays in lays in :compiler:tests-common-new module
  which includes classes for FE 1.0 and FIR diagnostics tests and
  JVM black boxtests
2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
dd402b16d9 [TEST] Add core of new tests infrastructure
It contains different abstractions which represents parts of compiler
  pipeline and artifacts produced by them, service structure, handlers
  for analysis of artifacts
2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
35437e6da9 [FE] Allow explicitly specify dependent modules fin TopDownAnalyzerFacade 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
c8f3a4802e [TEST] Introduce test-infrastructure-utils module and extract common test utilities here 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
1c91b74ff0 [CMI] Fix clearing code meta infos from original text 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
7960182674 [CMI] Fix CodeMetaInfoParser to properly handle nested meta infos
There was a problem with cases like that:
<!FOO!><!BAR!>some text<!><!>
                        ^  ^
                        1  2
(1) is a closing tag for <!FOO!> and (2) is for <!BAR!>, but before the
  fix they were matched contrariwise
2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
c558df5b4a [CMI] Fix rendering metainfos at the end of file 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
ceb44ddccd [CMI] Improve CodeMetaInfoRenderer
1. Properly handle meta which start == end
2. Sort metainfos of one range by tag
2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
98a2f29f95 [CMI] Allow using right angle bracket symbol in MetaInfo message 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
09df07349c [CMI] Add ability to replace render configuration of DiagnosticCodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
d6ff83c7d8 [CMI] Add ability to copy ParsedCodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
3bf60b3acc [CMI] Rename CodeMetaInfo.platforms to attributes 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
ced9a6fe35 [CMI] Replace getTag with tag property in CodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
9e31b049fc [CMI] Add additional constructor for DiagnosticCodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
87a6a66953 [CMI] Parse description of meta info and save it to ParsedCodeMetaInfo 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
2bbab3170f [CMI] Replace StringBuffer with StringBuilder in CodeMetaInfoRenderer 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
25c011ca40 [CMI] Extract core of CodeMetaInfo to :compiler:tests-common 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
4ad9f48642 [CMI] Cleanup code of CodeMetaInfo 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
23c088afd6 [TEST-GEN] Reorganize package structure in :generators:test-generator module 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
380e8a3814 [TEST-GEN] Extract run of TestGenerator to top of test generation DSL 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
2a73aaba4d [TEST-GEN] Move all generation data to TestGroup.TestClass 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
c51ea6b142 [TEST-GEN] Create abstract TestGenerator and move current generator logic to TestGeneratorImpl 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
d45fb4dfd8 [TEST-GEN] Extract logic of generating test methods into separate abstraction MethodGenerator 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
2acbe96f15 [TEST-GEN] Convert Test Generation DSL classes from java to kotlin 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
31bccb4fb0 [TEST-GEN] Rename .java to .kt 2020-12-16 19:52:18 +03:00
Dmitriy Novozhilov
580d2ed693 [TEST-GEN] Add some comments to TestGenerationDSL 2020-12-16 19:52:18 +03:00
Mikhail Glukhikh
0e43eaa662 Don't call possibleGetterNamesByPropertyName without a reason 2020-12-16 19:50:13 +03:00
Dmitriy Novozhilov
44948aa9a2 [FE] Properly report diagnostics about type arguments of implicit invoke
#KT-40396 Fixed
2020-12-16 17:57:58 +03:00
Dmitriy Novozhilov
329066a4f3 [Parser] Fix parsing of unfinished dot access in string template
Problem appeared in cases like this: "{someVar.}"

#KT-34440 Fixed
2020-12-16 17:57:56 +03:00
Dmitry Petrov
8999fd88b1 JVM_IR KT-43401 KT-43518 fix ACC_STRICT and ACC_SYNCHRONIZED flags 2020-12-16 14:10:36 +03:00
Dmitry Petrov
7ed3860c70 JVM_IR KT-43043 fix nullability annotations for inline class members 2020-12-16 13:43:29 +03:00
Andrei Klunnyi
2b3fc330ad KTIJ-664 [SealedClassInheritorsProvider]: test fixes 2020-12-16 11:35:27 +01:00
Igor Yakovlev
c2bf124d86 [FIR IDE] File symbol scope and symbol test 2020-12-16 12:29:54 +03:00
Igor Yakovlev
2f4842b271 [FIR IDE] Add KtFileScope to support KtFileSymbol 2020-12-16 12:29:54 +03:00
Igor Yakovlev
2fa5ab6e31 [FIR IDE] LC Remove difficult caching from FirLightClassBase 2020-12-16 12:29:54 +03:00
Igor Yakovlev
f282b721bc [FIR IDE] LC Fix test data 2020-12-16 12:29:53 +03:00
Igor Yakovlev
f5d8ae0550 [FIR IDE] LC add caching to light facades 2020-12-16 12:29:53 +03:00
Igor Yakovlev
da54dbba8e [FIR IDE] LC Add callable declarations to KtFileSymbol 2020-12-16 12:29:53 +03:00
Igor Yakovlev
fb63b74b37 [FIR IDE] LC Add KtFileSymbol and fix facade annotations 2020-12-16 12:29:53 +03:00
Igor Yakovlev
46071c1925 [FIR IDE] LC fix annotations with special sites and nullability 2020-12-16 12:29:53 +03:00
Igor Yakovlev
2e7866ca86 [FIR IDE] LC Fix annotations and modifiers for class members 2020-12-16 12:29:52 +03:00
Igor Yakovlev
3019f439fb [FIR IDE] LC More accurate processing for JvmSynthetic and JvmHidden annotations 2020-12-16 12:29:52 +03:00
Igor Yakovlev
3895ad375c [FIR IDE] LC add jvmstatic method into companion object 2020-12-16 12:29:52 +03:00
Victor Petukhov
d32d0a65f0 Revert "Report warning on @JvmStatic in private companion objects"
This reverts commit 9669ab14
2020-12-16 10:24:18 +03:00
Victor Petukhov
94deddef7f Revert "Minor: cover negative cases with test +m"
This reverts commit 04a4f9cd
2020-12-16 10:24:12 +03:00
Ilya Kirillov
5a9ff3471a FIR IDE: fix function targets on context element copy 2020-12-15 22:16:04 +01:00
Ilya Kirillov
67fc1bcb3d FIR IDE: add debug error message when not possible to find fir declarartion by psi 2020-12-15 22:16:03 +01:00
Ilya Kirillov
940ec06f5b FIR IDE: precalculate completion context on dependent analysis session creation 2020-12-15 22:16:02 +01:00
Ilya Kirillov
40b1a4df5a FIR IDE: temp mute failing find usages test 2020-12-15 22:16:01 +01:00
Ilya Kirillov
2d5b23b650 FIR IDE: separate KtExpressionTypeProvider into components 2020-12-15 22:16:00 +01:00
Ilya Kirillov
2101816f03 FIR IDE: add expected type calculation for function calls
does not work in case of incomplete call expression :(
2020-12-15 22:16:00 +01:00
Ilya Kirillov
7be8d69870 FIR IDE: add completion weighers tests for return/if/while 2020-12-15 22:15:59 +01:00
Ilya Kirillov
b16ebe2dc4 FIR IDE: consider if & while conditions expected type as boolean 2020-12-15 22:15:57 +01:00
Ilya Kirillov
c2d83353e8 FIR IDE: introduce builtin types container 2020-12-15 22:15:57 +01:00
Ilya Kirillov
835577383b FIR IDE: introduce expected type provider for return expressions 2020-12-15 22:15:56 +01:00
Ilya Kirillov
299f36183c FIR IDE: add tests for completion weighers from old testdata 2020-12-15 22:15:53 +01:00
Ilya Kirillov
19fff2b1e7 FIR IDE: implement expected type weigher for completion 2020-12-15 22:15:52 +01:00
Ilya Kirillov
c61d4b5f9c FIR IDE: introduce return statement target provider 2020-12-15 22:15:51 +01:00
Ilya Kirillov
a0ed14eafe FIR: use real source element for return statement
fix fir
2020-12-15 22:15:51 +01:00
Andrei Klunnyi
3af0257b38 KTIJ-664 [SealedClassInheritorsProvider]: IDE-specific implementation 2020-12-15 18:43:00 +01:00
Andrei Klunnyi
f02b73103b KTIJ-650 [Code completion]: no "sealed" for classes with modifiers
annotation, data, enum, inner, open - classes supplied with these
modifiers cannot be sealed.

Commit fixes code completion - "sealed" is no longer suggested in
the mentioned case.
2020-12-15 18:43:00 +01:00
Andrei Klunnyi
fe64b13140 KTIJ-650 [Code completion]: support for "sealed interface"
^KTIJ-650 fixed
2020-12-15 18:10:23 +01:00
Svyatoslav Kuzmich
602ed42b99 [Wasm] Move intrinsic generators to generators/wasm
Reason: avoid kotlin-stdlib-gen dependency on kotlinStdlib() via wasm.ir
2020-12-15 19:44:19 +03:00
Jinseong Jeon
efeabac2c5 FIR: do not force coercion-to-Unit for nullable lambda return type
3d7d87ac should have been implemented as aafe41c did.
2020-12-15 17:52:49 +03:00
Jinseong Jeon
6239301f4e FIR: no constraint for coerced-to-Unit last expression of lambda 2020-12-15 17:52:49 +03:00
Jinseong Jeon
4ab0897d7d FIR: pass the explicit expected type to block type
This helps avoid adding redundant return Unit into block.
2020-12-15 17:52:48 +03:00
Jinseong Jeon
0ea6b32c01 NI: allow lower bound of flexible type for coercion-to-Unit
Example from
box/inference/coercionToUnitForLambdaReturnTypeWithFlexibleConstraint

// FILE: TestJ.java
public class TestJ {
  public static <T> In<T> materialize() { return null; }
}

// FILE: test.kt

class In<in T>

fun <T> inferred(e: In<T>?, l: () -> T): T = l()

fun box() {
  inferred(TestJ.materialize<Unit>(), { null })
}

`materialize` has flexible type, both for `In<T>` and `T`.
When analyzing `{ null }`, collected type constraints include:
ft<Unit?, Unit> <: T (from ft<In<ft<Unit, Unit?>>, In<ft<Unit, Unit?>>?>)

By allowing the lower bound of flexible type, FIR resolution can visit
`{ null }` with the expected type Unit, which will lead to proper
coercion to Unit at the end.
2020-12-15 17:52:48 +03:00
Dmitry Petrov
b0f6461fa9 JVM_IR KT-42020 special IdSignature for some fake override members 2020-12-15 12:56:45 +03:00
Jinseong Jeon
12cfba9ca9 FIR BB: remove stale test ignoring tags in old language versions
Since bf06d381 (move old Java nullability assertion tests...),
these tests aren't used by (Fir|Ir)BlackBoxCodegenTest anymore.
2020-12-15 11:52:50 +03:00
Jinseong Jeon
f7ade2b0b8 FIR2IR: introduce implicit casts for extension receivers 2020-12-15 11:52:49 +03:00
Dmitriy Dolovov
6e9ac6b333 [Commonizer] Internal tool for tracking memory usage 2020-12-15 09:48:27 +03:00
Igor Yakovlev
010a290132 [LC] Fix for light classes equivalence 2020-12-15 01:51:23 +03:00
Igor Yakovlev
45112a3c11 [ULC] Fix invalid positive inheritor for self checking
Fixed #KT-43824
2020-12-14 20:34:42 +03:00
Svyatoslav Scherbina
0f4173cdfa Fix running stdlib tests in worker on Native
Add `@SharedImmutable` or `@ThreadLocal` where required.
2020-12-14 19:03:06 +03:00
Ilya Gorbunov
8f4e4a4d40 Specify common sources for stdlib test compilation tasks
Some multiplatform tests are compiled in single-platform projects:
- in kotlin-stdlib-jdk7
- in kotlin-stdlib-jdk8
- in kotlin-stdlib-js-ir. The latter is technically MPP but with a
single platform, so its common sources are not considered as common.

Pass information about common sources to test compilation tasks in order
to use OptionalExpectation annotations there.

Co-authored-by: Svyatoslav Scherbina <svyatoslav.scherbina@jetbrains.com>
2020-12-14 19:03:04 +03:00
Svyatoslav Scherbina
c094d77794 Fix DeepRecursiveFunction in worker on Native
Add `@SharedImmutable` to `UNDEFINED_RESULT` top-level property.
2020-12-14 19:03:03 +03:00
Svyatoslav Kuzmich
b3d8c4a0fc [JS IR] Apply missing property for all tests tasks like jsIrTest and quickTest 2020-12-14 19:00:05 +03:00
Shagen Ogandzhanian
32cc95a3b0 [JS IR] Skip export annotations while generating default stubs 2020-12-14 16:41:27 +01:00
Svyatoslav Kuzmich
7efc95705a [Wasm] Publish stdlib klib to maven 2020-12-14 17:47:19 +03:00
Svyatoslav Kuzmich
d37271bf35 [Wasm] Support packed integer array elements 2020-12-14 14:40:38 +03:00
Svyatoslav Kuzmich
51e8d782b0 [Wasm] Support packed integer class fields 2020-12-14 14:40:38 +03:00
Ilya Gorbunov
28168bf230 Correctly implement specialized MutableEntrySet.contains KT-41278
This is a workaround for the problem KT-43321.

Introduce an intermediate abstract set specialized for Map.Entry elements
and implement 'contains(Map.Entry)' method there.

Then inherit that intermediate set in entrysets of JS HashMap,
JS LinkedHashMap, JVM MapBuilder, that are specialized for
MutableMap.MutableEntry elements, so that no override of 'contains' is
required anymore.

This allows to avoid incorrect special 'contains' bridge being generated
that otherwise rejects all arguments except ones of MutableEntry type.
2020-12-14 12:42:47 +03:00
Ilya Goncharov
0a3f3bef51 [Gradle, JS]Process error output and rethrow errors and warns to console
^KT-43869 fixed
2020-12-14 11:49:40 +03:00
Dmitriy Novozhilov
55b0775565 [FE] Call SealedClassInheritorsProvider only for sealed classes 2020-12-14 10:43:14 +03:00
Andrey Uskov
0a2269cccb Fixed out-of-process compiler execution if project directy is absent
If project directory does not exist and out-of-process execution is used
the file with compiler arguments should be created in project directory
(if exists) or in temp directory.
#KT-43740 Fixed
2020-12-13 20:17:29 +03:00
Andrey Uskov
9be7221efd Clear IC caches if they were not properly closed 2020-12-13 20:17:27 +03:00
Andrey Uskov
7bdd7ce6b8 Reformat DirtyClassesMap 2020-12-13 20:17:24 +03:00
Andrey Uskov
275a02ce88 Fix synchronization when working with IC caches
IC caches could be modified and read from different threads.
In JPS builder these threads are RMI worker (invoked from Compiler
Daemon) and JPS worker thread. Proper synchronization fixes cases
when caches could become broken.
#KT-42265 Fixed
#KT-42194 Fixed
#KT-42265 Fixed
#KT-42937 Fixed
2020-12-13 20:17:22 +03:00
Andrey Uskov
af95b8d1fe Add explicit path sensitivity for InspectClassesForMultiModuleIC
Gradle uses PathSensitivity.ABSOLUTE by default, so this change
just explicitly specifies it in order to avoid warnings.
#KT-43895 Fixed
2020-12-13 20:17:20 +03:00
Andrey Uskov
2e607335db Add tests for incremental compilation of sealed interfaces 2020-12-13 20:17:18 +03:00
Andrey Uskov
36f99156fd IC of sealed classes
Supported case then children of sealed classes could be declared
anywhere in a module. If list of classes implementing sealing class
changes the sealed class and all its inheritors should be recompiled
(now sealed class should be compiled together with children in order
to calculate all possible inheritors at compile time) and and
invalidated (as they could have when operators).
2020-12-13 20:17:16 +03:00
Ilya Kirillov
a0651cdba7 FIR IDE: add Java synthetic properties support for completion 2020-12-12 12:27:48 +01:00
Ilya Kirillov
48b7150566 FIR IDE: split KtPropertySymbol into KtKotlinPropertySymbol and KtJavaSyntheticPropertySymbol 2020-12-12 12:26:56 +01:00
Ilya Kirillov
2201dd5198 FIR: make FirSyntheticPropertiesScope to be name aware 2020-12-12 12:26:56 +01:00
Kristoffer Andersen
8a5f260d04 [IR] Align debugging of suspend lambdas with old BE
The existing backend restores LVs and parameters from the suspend lambda
fields used for spilling between suspension points, hence they are
visible in the debugger as local variables, plain and simple.

This PR introduces the same pattern to the IR backend, to bring the
debugging experience in line with the existing backend.

Both backends are still at the mercy of the liveness analysis
performed in the coroutine transformer where a liveness analysis
minimizes live ranges of entries in the LVT. E.g. an unused parameter
will be dropped entirely.

Adjusted existing test expectations accounting for the differences in
LV behavior.
2020-12-12 11:48:47 +01:00
Dmitriy Dolovov
2be62c13b0 [Commonizer] Minor. Renamings
- Absent* -> Missing*
- Target -> CommonizerTarget
- Result -> CommonizerResult
- Parameters -> CommonizerParameters
2020-12-11 22:15:11 +03:00
Dmitry Petrov
b7330a9e14 JVM_IR KT-43877 fix generic signatures for SAM-converted lambdas 2020-12-11 20:26:29 +03:00
Ilmir Usmanov
dc11c2de77 IC Mangling: Use correct java field type if the type is inline class
in JVM_IR BE.
 #KT-26445
2020-12-11 17:51:39 +01:00
Ilmir Usmanov
2b0a99b7b0 IC Mangling: Use correct java field type if the type is inline class
in old JVM BE.
 #KT-26445
2020-12-11 17:51:37 +01:00
Ilmir Usmanov
69bb65496f IC Mangling: Change test since we pass boxed inline class to java method
#KT-28214
2020-12-11 17:51:34 +01:00
Ilmir Usmanov
cbb8eb494a IC Mangling: Do not mangle functions with inline classes from Java
in JVM_IR BE. Map types to boxed variants, when mapping signatures.
 #KT-26445
2020-12-11 17:51:32 +01:00
Ilmir Usmanov
0cab69a7a0 IC Mangling: Do not mangle functions with inline classes from Java
in old JVM BE. Map types to boxed variants, when mapping signatures.
 #KT-26445
2020-12-11 17:51:30 +01:00
Denis.Zharkov
5aaaa3881d Refine diagnostic text for NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER
^KT-43225 Fixed
2020-12-11 14:22:40 +03:00
Mikhael Bogdanov
b143cb9ae5 Disable new test on WASM 2020-12-11 06:36:42 +01:00
Mads Ager
c922484758 [JVM_IR] Use direct field access to backing fields on current class.
The current backend uses direct field access to the backing field
instead of calling the companion object accessor, which calls
an accessibility bridge, which then gets the field for code such as:

```
class A {
  companion object {
    val s: String = "OK"
  }

  // f uses direct access to the A.s backing field.
  fun f() = s
}
```

This change does the same for the IR backend.
2020-12-11 06:24:55 +01:00
Nikolay Krasko
1d14926444 Re-enable evaluation tests in 201 platform
Revert `[DEBUGGER] Temporary mute AbstractKotlinEvaluateExpressionTest`
(85c59328c7) in 201 bunch.
2020-12-10 22:50:57 +03:00
Vyacheslav Gerasimov
1bc369c63c Build: Enable caching for test task with enabled test distribution
#KTI-112
2020-12-10 22:02:24 +03:00
Jinseong Jeon
8f2ad57f7a FIR: pass elvis expected type to lhs/rhs 2020-12-10 20:52:49 +03:00
pyos
41f56729f9 FIR: serialize correct fqnames for local classes 2020-12-10 20:52:48 +03:00
pyos
12f936f6b7 FIR2IR: do not approximate reified type arguments to super class 2020-12-10 20:52:46 +03:00
Jinseong Jeon
148d540580 FIR checker: make unused checker visit qualified accesses in annotations
#KT-43687 Fixed
2020-12-10 20:52:45 +03:00
pyos
5efe774dba FIR: remap Java meta-annotations to Kotlin equivalents
This is a direct port of JavaAnnotationMapper from the old frontend.
2020-12-10 20:52:43 +03:00
Ilya Kirillov
a9ad85f306 FIR IDE: temporary mute find usages test as it fails because of incorrect resolve of init blocks 2020-12-10 17:55:50 +01:00
Ilya Kirillov
170928f498 FIR IDE: allow type rendering only in analysis session 2020-12-10 17:54:21 +01:00
Ilya Kirillov
f30c6bf86a FIR IDE: rework KtCall to work with error cals 2020-12-10 17:54:20 +01:00
Vyacheslav Gerasimov
e6327ef490 Build: Enable test distribution for :js:js.tests:test task 2020-12-10 19:42:32 +03:00
Vyacheslav Gerasimov
06fd7f8526 Build: Add helper to configure gradle test distribution 2020-12-10 19:42:32 +03:00
Vyacheslav Gerasimov
7bbb738a71 Build: Cleanup :js:js.tests buildscript 2020-12-10 19:42:32 +03:00
Vyacheslav Gerasimov
d43af46bf4 Build: Add V8 engine & repl.js to js tests inputs 2020-12-10 19:42:31 +03:00
Mads Ager
fadedc84db [JVM_IR] Refactor and add bytecode text tests for compose-like code.
Tests that the default argument mask is not in the local variable
table.
2020-12-10 17:22:18 +01:00
Mads Ager
83588e9f22 [JVM_IR] Add tests of Compose-like default argument handling. 2020-12-10 17:22:18 +01:00
Mads Ager
a7efa5c98b [IR] Fix remapping of arguments in LocalDeclarationsLowering.
It only remapped arguments for IrGetValue and not for IrSetValue.
This is hitting Compose which has non-standard default argument
handling.
2020-12-10 17:22:18 +01:00
Ilya Goncharov
167e60b9fb [JS IR] Assert createdOn equals 0 for properties initialization fun for file 2020-12-10 18:07:50 +03:00
Dmitry Petrov
5be28520fc JVM_IR KT-43851 preserve static initialization order in const val read 2020-12-10 17:55:13 +03:00
Dmitry Petrov
b0ef6ee1fc JVM_IR Minor: refactor rawType 2020-12-10 17:55:13 +03:00
Denis.Zharkov
f4a25066a8 Fix freshly added CLI tests for windows agents 2020-12-10 16:15:29 +03:00
Mikhail Glukhikh
dd66da7c65 Optimize FirJavaSyntheticNamesProvider.possibleGetterNamesByPropertyName 2020-12-10 15:29:46 +03:00
Mikhail Glukhikh
6d545fc281 Make FirTowerLevel an abstract class 2020-12-10 15:29:46 +03:00
Mikhail Glukhikh
34d7a7c184 FIR tower levels: inline processElementsByName[AndStoreResult] 2020-12-10 15:29:46 +03:00
Mikhail Glukhikh
af4941b222 [FIR] Drop delayedNode from ControlFlowGraph.orderNodes 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
7b277600a9 Optimize/simplify loadFunctions(Properties)ByName in FIR deserializer 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
e51503ab42 Code cleanup: KotlinDeserializedJvmSymbolsProvider 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
1383e923ea Drop KotlinDeserializedJvmSymbolsProvider.findRegularClass 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
7e99f0ee23 Optimize ConeInferenceContext.typeDepth a bit 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
67c7b5ca0a Optimize/simplify FirAbstractImportingScope.getStaticsScope 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
d90cc452fe Simplify: FirSymbolProvider.getClassDeclaredPropertySymbols 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
e344d9e438 Drop unused functions from FirBuiltinSymbolProvider 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
bb0410b143 [FIR] Drop unused utility functions from StandardTypes.kt 2020-12-10 15:29:43 +03:00
Yunir Salimzyanov
f88d51613f Remove old 193 and as40 bunches 2020-12-10 14:57:16 +03:00
Mikhail Glukhikh
bf8de487a0 CliTrace: rewrite smart cast-vulnerable piece of code 2020-12-10 13:02:49 +03:00
LepilkinaElena
c8c83c04c0 [IR] Fix saving function calls during inlining const properties in PropertyAccessorInlineLowering (#3971) 2020-12-10 12:24:23 +03:00
Ilmir Usmanov
dccfb33bcc JVM_IR: Unbox argument of type kotlin.Result
if the argument has different type in parent: either generic or Any.
 #KT-41163 Fixed
 #KT-43536 Fixed
2020-12-10 08:27:32 +01:00
Ilmir Usmanov
775d610045 Value classes: Forbid any identity equality check on value class
#KT-31130 Fixed
2020-12-10 08:24:48 +01:00
Denis.Zharkov
7e088457a2 Temporary clear sinceVersion for ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-36770 Related
^KT-26245 Related
2020-12-10 10:20:30 +03:00
Dmitriy Novozhilov
dbc85a5f18 [TEST] Fix compilation of CodegenTestsOnAndroidGenerator.kt 2020-12-10 01:31:05 +03:00
Dmitriy Novozhilov
b416c669b0 [TEST] Update testdata due to dropped COMMON_COROUTINE_TEST directive 2020-12-10 01:31:04 +03:00
Dmitriy Novozhilov
aacf934b49 [TEST] Drop machinery about experimental coroutines from compiler tests 2020-12-10 01:31:02 +03:00
Dmitriy Novozhilov
8c4b7ad1e1 [TEST] Drop generating tests for coroutines of Kotlin 1.2 2020-12-10 01:31:01 +03:00
Vyacheslav Gerasimov
0389589d83 Build: Setup inputs and outputs for :js:js-tests:test task properly
All task inputs should be declared and separated from outputs produced
by it (e.g. node modules and js compile outputs) to make gradle test
distribution work
2020-12-10 00:17:27 +03:00
Dmitriy Novozhilov
d5c1e5681c [IR] Don't assume subclasses as part of member scope of sealed class 2020-12-09 22:54:39 +03:00
Dmitriy Novozhilov
b6bd7c48f4 [FE] Rename FreedomForSealedClasses feature with more meaningful name 2020-12-09 22:54:38 +03:00
Dmitriy Novozhilov
77aad06008 [FE] Add bunch files to fix compilation on 201 platform 2020-12-09 22:54:37 +03:00
Dmitriy Novozhilov
3246e6b9ac [IC] Add ability to pass additional compiler args to IC tests
Additional arguments should be declared in `args.txt` file in test
  directory in common CLI arguments format
2020-12-09 22:54:36 +03:00
Dmitriy Novozhilov
57a081c399 [FE] Prohibit inheritance of sealed classes in different module
KT-20423
2020-12-09 22:54:34 +03:00
Dmitriy Novozhilov
f8d6f79c17 [FE] Temporary disable exhaustiveness checker for java sealed classes
KT-43551
KT-41215
2020-12-09 22:54:33 +03:00
Dmitriy Novozhilov
1c9f9130e6 [FE] Prohibit implementing java sealed classes 2020-12-09 22:54:32 +03:00
Dmitriy Novozhilov
6809adee9c [FE] Extract computation of sealed class inheritors into separate component
This is needed to provide more optimal provider in IDE plugin
2020-12-09 22:54:31 +03:00
Dmitriy Novozhilov
c0a1aecf9b [FE] Add test for compiling against library with kotlin sealed classes and interfaces
#KT-20423
#KT-13495
2020-12-09 22:54:30 +03:00
Dmitriy Novozhilov
7897bb6adb [FE] Support sealed classes and interfaces from java
KT-43551
KT-41215
2020-12-09 22:54:29 +03:00
Dmitriy Novozhilov
bdfb71b149 [FE] Add sealed classes related properties to java model 2020-12-09 22:54:28 +03:00
Dmitriy Novozhilov
8e9e34350f [FE] Properly support sealed interfaces in exhaustiveness checker
#KT-20423
2020-12-09 22:54:27 +03:00
Dmitriy Novozhilov
9609954560 [FE] Allow using sealed modifier on interface and compute sealed modality for them
#KT-20423
2020-12-09 22:54:26 +03:00
Dmitriy Novozhilov
d605c7e491 [FE] Prohibit inheritors of sealed classes which are declared in different package
#KT-13495
2020-12-09 22:54:25 +03:00
Dmitriy Novozhilov
e76acc8ee0 [FE] Collect inheritors of sealed classes from new places in computeSealedSubclasses
#KT-13495
2020-12-09 22:54:24 +03:00
Dmitriy Novozhilov
70c61be1ef [FE] Allow declare sealed class inheritors as inner or nested classes
#KT-13495
2020-12-09 22:54:22 +03:00
Dmitriy Novozhilov
f5f1984a60 [FE] Allow declare sealed class inheritors in different files in one module
#KT-13495
2020-12-09 22:54:21 +03:00
Jiaxiang Chen
1a377069dd Allow AnalysisHandlerExtension to provide additional classpath on retry 2020-12-09 22:15:36 +03:00
Jiaxiang Chen
a6cb156ce9 Allow multiple retry for AnalysisHandlerExtension 2020-12-09 22:15:36 +03:00
Dmitry Petrov
313dfaf48c JVM_IR KT-43812 erase generic arguments of SAM wrapper supertype 2020-12-09 20:06:02 +03:00
Mikhail Glukhikh
5daa406cdf Use FirNamedFunctionSymbol in FirScope.processFunctionsByName 2020-12-09 19:53:27 +03:00
Jinseong Jeon
2dfba10d84 FIR: extend suspend conversion to intersection type 2020-12-09 19:53:25 +03:00
Mikhail Glukhikh
42ea4463ee Fix type argument inconsistency in FirResolvedQualifier 2020-12-09 19:53:24 +03:00
Mikhail Glukhikh
d6e144c80e [FIR] Extend callableNames known for JvmMappedScope 2020-12-09 19:53:23 +03:00
Mikhail Glukhikh
94014ba3eb Fir2IrLazyClass: don't generate non-f/o properties from superclass 2020-12-09 19:53:22 +03:00
Mikhail Glukhikh
9b0ada2b0f [FIR2IR] Generate f/o overridden symbol with FakeOverrideGenerator
#KT-43669 Fixed
2020-12-09 19:53:21 +03:00
Mikhail Glukhikh
91834ccf46 Use FirNamedFunctionSymbol in FirSimpleFunction & its inheritors 2020-12-09 19:53:19 +03:00
Mikhail Glukhikh
15021f30ff Use FirNamedFunctionSymbol around processOverriddenFunctions 2020-12-09 19:53:18 +03:00
Alexander Udalov
8fedfd2d2a Minor, add workaround for KT-43812 2020-12-09 19:37:49 +03:00
Dmitriy Novozhilov
2b22cbcdd2 Advance bootstrap to 1.5.0-dev-309 2020-12-09 19:37:47 +03:00
anastasiia.spaseeva
38b59ddabf Wizard: Fix tests 2020-12-09 18:16:07 +03:00
anastasiia.spaseeva
71459db9dd Wizard: Do not add bintray repoitory for eap versions 2020-12-09 18:16:06 +03:00
Denis.Zharkov
2d8a8d252b Add 201 bunch files for JavaClass implementations
In 201, there's an old ASM version and PSI doesn't have record-related API
2020-12-09 16:47:25 +03:00
Denis.Zharkov
5a006a3690 Minor. Specify targetBackend for new IR tests 2020-12-09 16:47:25 +03:00
Denis.Zharkov
92b402759b Report incorrect JVM target only when @JvmRecord is actually used 2020-12-09 16:47:25 +03:00
Denis.Zharkov
920ed558ee Add some tests on corner cases for @JvmRecord 2020-12-09 16:47:25 +03:00
Denis.Zharkov
3aa55620d0 Prohibit explicit j.l.Record supertype even for @JvmRecord 2020-12-09 16:47:25 +03:00
Denis.Zharkov
2b29e70b64 Temporary avoid using constant from the new ASM
To make it compilable with 201 platform
2020-12-09 16:47:25 +03:00
Denis.Zharkov
f399f013dd Temporary add another env variable JDK_15_0 that is set on TC agents 2020-12-09 16:47:24 +03:00
Denis.Zharkov
46c3979acd Separate JVM target option from javac's --enable-preview analogue 2020-12-09 16:47:24 +03:00
Denis.Zharkov
3abd8b1ab2 Adapt CliTests for api requirement of @JvmRecord 2020-12-09 16:47:24 +03:00
Denis.Zharkov
dc1a1c5821 Support cross-module usages of @JvmRecord classes
The problem is that JvmRecord has SOURCE retention
Probably, increasing its retention might be a more reliable solution
(or in some other way serializing that the class is a record)

Just checking supertypes seems like a reasonable approximation:
only records kotlin are allowed to extend j.l.Record.
But the relevant diagnostic has been added only since 1.4.30,
so potentially there could have been exist a non-record class with
such supertype compiled by 1.4.20, but this case seems to be ill-formed
and marginal anyway.

For Java classes, it's irrelevant since they don't have member properties
(only synthetic extensions)

^KT-43677 In Progress
2020-12-09 16:47:24 +03:00
Denis.Zharkov
ac0604377d Minor. Extract runJvmInstance for running BB tests with custom JVM 2020-12-09 16:47:23 +03:00
Denis.Zharkov
6e4f84dddf Add @SinceKotlin("1.5") on JvmRecord annotation 2020-12-09 16:47:23 +03:00
Denis.Zharkov
ddbd62054f Prohibit extending java.lang.Record from non-@JvmRecord classes 2020-12-09 16:47:23 +03:00
Denis.Zharkov
695d0dbfbb Check JvmRecordSupport language feature before generating synthetic properties 2020-12-09 16:47:23 +03:00
Denis.Zharkov
a4bf36aee7 Support @JvmRecord for JVM_IR
^KT-43677 In Progress
2020-12-09 16:47:23 +03:00
Denis.Zharkov
f64980a597 Add check for bytecode target when @JvmRecord is used
^KT-43677 In Progress
2020-12-09 16:47:23 +03:00
Denis.Zharkov
b860a0c664 Separate JvmTarget::bytecodeVersion version into major/minor parts 2020-12-09 16:47:22 +03:00
Denis.Zharkov
c8851c4f75 Prohibit @JvmRecord for non-data classes
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
cc0b584445 Adapt test infrastructure to the latest changes
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
1d873a1a73 Move earlier generated tests
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
033f43794d Prohibit irrelevant fields in @JvmRecord classes
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
1b575d7903 Add initial support for @JvmRecord in backend
- Write relevant class files attributes
- Emit property accessors with records-convention: propertyName -> propertyName()

^KT-43677 In Progress
2020-12-09 16:47:21 +03:00
Denis.Zharkov
26d525fa3c Prepare ClassBuilder for record components
^KT-43677 In Progress
2020-12-09 16:29:04 +03:00
Denis.Zharkov
f6a3580c93 Add @JvmRecord diagnostics for open and enums
^KT-43677 In Progress
2020-12-09 16:29:04 +03:00
Denis.Zharkov
bef50c0342 Correct descriptor shape for @JvmRecord annotated classes
This commit adds relevant functions: hashCode, toString, equals
(if the class is not a data class)
And supertype j.l.Record

It only affects descriptor contents, i.e. works for FE

^KT-43677 In Progress
2020-12-09 16:29:04 +03:00
Denis.Zharkov
ca2e199b53 Minor. Move @JvmRecord tests to relevant directory
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
d4de2c4dce Add check that we have JDK 15 in classpath when using @JvmRecord
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
85962d8312 Add check that @JvmRecord classes cannot inherit other classes
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
4f5db241ea Add @JvmRecord annotation and relevant diagnostics
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
059e2aab7a Make BlackBox tests for Java 9 generated 2020-12-09 16:29:03 +03:00
Denis.Zharkov
5d05419016 Add simple JDK15 BlackBox test
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
513f7177ca Support loading Java records
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
f25b7672a7 Introduce FULL_JDK_15 TestJdkKind 2020-12-09 16:29:03 +03:00
Denis.Zharkov
430da22b4b Setup 15_PREVIEW LanguageLevel for Java sources in CLI
It's necessary to read preview-features related Java PSI parts
It should be OK to set it unconditionally because we don't compile Java
sources, only obtain declaration structure from them
2020-12-09 16:29:02 +03:00
Ilya Goncharov
ff52a3f867 [Gradle, JS] Null library and libraryTarget when they are null
^KT-43842 fixed
2020-12-09 15:59:40 +03:00
Svyatoslav Kuzmich
d4233f3f0e [Wasm] Use Wasm GC arrays instead of JS arrays
JS arrays was a workaround for lack of arrays in Firefox Wasm GC prototype
Now with V8 as a test runner we can use proper arrays
2020-12-09 15:56:45 +03:00
Svyatoslav Kuzmich
d15af70a3e [Wasm] Refactoring: replace "struct types" with "GC types"
In preparation for adding array types
2020-12-09 15:56:45 +03:00
Svyatoslav Kuzmich
4bb163fd1f [Wasm IR] Add missing GC and function reference instructions 2020-12-09 15:56:44 +03:00
Svyatoslav Kuzmich
6063353b64 [Wasm] Generate stdlib WasmOp based on WasmOp from Wasm IR 2020-12-09 15:56:44 +03:00
Mikhael Bogdanov
1cfb81455c Generate correct names for companion @JvmStatic accessors in annotation class
#KT-31389 Fixed
2020-12-09 13:26:14 +01:00
Alexander Udalov
3e0efeef31 JVM IR: add test for complex generic diamond hierarchy
This is a test for KT-43832, which is fixed in the previous commit.
2020-12-09 10:52:18 +01:00
Alexander Udalov
3370fa03d7 Revert "JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation"
This reverts commit d41d1bf64d.
2020-12-09 10:52:18 +01:00
Dmitry Petrov
69c88a8a0a PSI2IR KT-41284 use getters for open data class property values
'allopen' compiler plug-in can make data classes and their members open,
which is a compilation error in usual case, but makes sense for Spring
and other frameworks that generate proxy-classes.
2020-12-09 10:29:09 +03:00
Ilmir Usmanov
d8d30263d3 IC Mangling: search parents for method if descriptor is fake override
Otherwise, the compiler generates call using old mangling scheme
because classfile does not contain the method.
2020-12-09 07:34:29 +01:00
Alexander Dudinsky
e089e3606f Disable testSingleAndroidTarget while OOM investigation in progress KT-43755 2020-12-09 09:27:34 +03:00
Nikolay Krasko
df9ecb0f4a Dependency of js tests generation on compiler test data generation (KTI-404)
There was an error during "Generate Compiler Tests" execution:

Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: compiler\testData\codegen\box\ranges\expression\inexactDownToMinValue.kt

The error was probable caused by parallel execution of tasks:compiler:generateTests and :js:js.tests:generateTests.

Exception could occur when GenerateRangesCodegenTestData.main(args) has
just removed directory with test data for regeneration but
:js:js.tests:generateTests had already seen files present.

 #KTI-404 Fixed
2020-12-09 00:58:07 +03:00
Ilya Kirillov
0ca7c50452 FIR IDE: refactor, separate resolveSimpleNameReference into functions 2020-12-08 22:26:24 +01:00
Mads Ager
717e087fd9 [JVM] Do not collaps unrelated locals in state machine transform. 2020-12-08 18:12:19 +01:00
Mads Ager
1bb864bbb0 [JVM] Add tests that expose problem with locals collapsing.
The collapsing happens during suspend function state machine
transformation.
2020-12-08 18:12:19 +01:00
Nikolay Krasko
8e38f9d176 Stop mangle common project descriptor in GenerateTestSupport tests
Use custom project descriptor instead.

Mitingate flaky failures:

ERROR: Save settings failed
java.lang.RuntimeException: java.io.IOException: Cannot save /test_path/test.ipr.
Unable to open the file for writing.
  at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:116)
  at com.intellij.util.lang.CompoundRuntimeException.throwIfNotEmpty(CompoundRuntimeException.java:106)
  at com.intellij.configurationStore.SaveResult.throwIfErrored(SaveResult.kt:59)
  at com.intellij.configurationStore.ComponentStoreImpl.save$suspendImpl(ComponentStoreImpl.kt:152)
  at com.intellij.configurationStore.ComponentStoreImpl$save$1.invokeSuspend(ComponentStoreImpl.kt)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
  at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
  at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
  at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
  at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
  at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
  at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
  at com.intellij.configurationStore.StoreUtil$Companion.saveSettings(storeUtil.kt:44)
  at com.intellij.configurationStore.StoreUtil.saveSettings(storeUtil.kt)
  at com.intellij.openapi.project.impl.ProjectImpl.save(ProjectImpl.java:157)
  at org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest$setUpTestSourceRoot$1.invoke(AbstractGenerateTestSupportMethodActionTest.kt:22)
  at org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest$setUpTestSourceRoot$1.invoke(AbstractGenerateTestSupportMethodActionTest.kt:20)
2020-12-08 18:52:38 +03:00
Nikolay Krasko
b0347c3822 Stable order of generation and errors in ConvertSealedClassToEnumIntention 2020-12-08 18:52:36 +03:00
Mikhail Zarechenskiy
2ad4824eb0 Fix exception on resolving collection literal inside lambda
#KT-31907 Fixed
 #EA-90906 Fixed
2020-12-08 12:55:25 +03:00
Mikhael Bogdanov
c5015c9294 Don't recognize IrVariable as declaration scope in inlining
#KT-42815 Fixed
2020-12-08 06:16:12 +01:00
Ilmir Usmanov
7f51f57998 Generate correct $default method for actual suspend function
In order to do this, we need to get initial expect suspend function
before generating default value parameters checks.
 #KT-43587 Fixed
2020-12-08 04:36:38 +01:00
Ilmir Usmanov
0dc5f3ac00 IC: call JvmDefault method of inline class using boxed receiver
#KT-43698 Fixed
2020-12-08 04:33:36 +01:00
Ilya Kirillov
d6330337a9 FIR IDE: introduce param for enabling disabled tests 2020-12-07 17:46:46 +01:00
Ilya Kirillov
a671054fa3 FIR IDE: change until-build to 203.* in plugin.xml 2020-12-07 17:45:22 +01:00
Vyacheslav Gerasimov
b6d80a1149 Build: Fix kotlin-compiler-internal-test-framework empty sources jar
Should also pack pack test source set from :compiler:tests-common
2020-12-07 19:16:43 +03:00
Nikolay Krasko
1d51dffd76 Reminder about -Pidea.fir.plugin=true for running fir-idea tests 2020-12-07 18:42:36 +03:00
Zalim Bashorov
e5c62c3838 [JS] Disable special checks in labeled-block-to-do-while 2020-12-07 17:27:24 +03:00
Zalim Bashorov
7ca54ec405 [JS IR] unmute test arraySort.kt 2020-12-07 17:27:23 +03:00
Zalim Bashorov
4c69f78de8 [JS] Replace J2V8 based ScriptEngine with a process-based version
The main advantage of this is that we can use a newer and official build of V8.
Also, with new infra, we can use other JS engines.

Other changes:
 * ScriptEngine API is simplified and documented.
 * Introduce ScriptEngineWithTypedResult with typed `eval`, mostly for JsReplEvaluator and JsScriptEvaluator.
 * J2V8 version is completely removed.
 * Use new ScriptEngineV8 everywhere by default.
 * System property `kotlin.js.useNashorn` switches to Nashorn in all tests.
2020-12-07 17:27:23 +03:00
Zalim Bashorov
39cc149da0 [JS] Revert disabling running ES6 tests on all platforms except linux
Revert "[JS TESTS] Emulate failing of non-run tests"

This reverts commit 2fd69218

Revert "[JS TESTS] Don't run ES6 test on win & mac till j2v8 issue is fixed."

This reverts commit 08624165

Revert "[JS TESTS] Add EP to disable run test on specific platform"

This reverts commit 50162265
2020-12-07 17:27:23 +03:00
Zalim Bashorov
2cb4a4906f [JS] Remove j2v8 from dependencies 2020-12-07 17:27:22 +03:00
Zalim Bashorov
f4431a21fc [JS] Make all JS test tasks depending on setupV8 2020-12-07 17:27:22 +03:00
Zalim Bashorov
9cc3725db1 [JS] Move JS engines download and setup code higher to use it from other tasks 2020-12-07 17:27:21 +03:00
Zalim Bashorov
bc4c2349c0 [JS] Extract engine setup related code from wasmTest 2020-12-07 17:27:21 +03:00
Zalim Bashorov
70eb3d2486 [JS] BasicBoxTest.kt: cleanup 2020-12-07 17:27:20 +03:00
Zalim Bashorov
f573b81456 [JS] Minor: fix typo in AntTaskJsTest 2020-12-07 17:27:20 +03:00
Mikhael Bogdanov
b8903f8cf8 Enable kotlin-annotation-processing-cli tests on TC 2020-12-07 12:38:12 +01:00
Ivan Gavrilovic
078aa18479 Fix KAPT cli tests on windows
- Fix line separator issue
- Always quote args with delimiters (=, :)
- fix one of args files by removing obsolete stdlib reference
- Fix kotlinc.bat to ensure lazy evaluation of additional classpath
2020-12-07 12:36:59 +01:00
Ilya Goncharov
82ad230e0d [Gradle, JS] Add nodeArgs to NodeJsExec
^KT-43793 fixed
2020-12-07 13:08:47 +03:00
Jinseong Jeon
cdfe1771d9 FIR DFA: reimplement type OR operation to its original semantics
#KT-43569 Fixed
2020-12-07 10:50:19 +03:00
Jinseong Jeon
16b9312695 FIR DFA: refactor type statements manipulation 2020-12-07 10:50:19 +03:00
Jinseong Jeon
7ea58adc50 FIR: reproduce KT-43569 2020-12-07 10:50:19 +03:00
Nikita Bobko
0d8cdb7bdb Fix double registered "com.intellij.psi.classFileDecompiler" for 203 platform
This commit addresses 1243c641296e74a572a4f274df72a4cda60635c6 in intellij
In intellij they added registration of "com.intellij.psi.classFileDecompiler" in
`JavaCoreApplicationEnvironment`. And because the `KotlinCoreApplicationEnvironment` inherits
`JavaCoreApplicationEnvironment` we don't need to register this EP ourselves.

This commit fixes in 203 tests + 1.4.30 compiler:
```
java.lang.RuntimeException: Duplicate registration for EP 'com.intellij.psi.classFileDecompiler': first in com.intellij.openapi.extensions.DefaultPluginDescriptor@44f464d1, second in PluginDescriptor(name=org.jetbrains.kotlin, id=org.jetbrains.kotlin, path=/home/builduser/.m2/repository/org/jetbrains/kotlin/kotlin-compiler-for-ide/1.4.30-M1-30/kotlin-compiler-for-ide-1.4.30-M1-30.jar, version=1.2)
	at com.intellij.openapi.components.ComponentManager.createError(ComponentManager.java:167)
	at com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.registerExtensionPoints(ExtensionsAreaImpl.java:262)
	at com.intellij.ide.plugins.PluginManagerCore.registerExtensionPointAndExtensions(PluginManagerCore.java:1334)
	...
```
2020-12-07 10:18:38 +03:00
Nikolay Krasko
5f91f79382 Remove usage of idea file systems for checking js libraries
The removed code is probably an outdated code from the age when Kotlin
compiler was using VirtualFiles for operating. Previously the links were
stored and passed further, but now it is only some additional check
(files are unused after the check) with an implicit dependency to
IDEA internals.

The deleted check could probably be responsible for handling references
to JS libraries because of the working compiler daemon.

The code was spotted during an investigation for the
2bf22caeb7 commit (there's a detailed
description in the commit message).
2020-12-05 22:22:30 +03:00
Jinseong Jeon
c959ad7911 FIR checker: revisit per-label iterations to avoid !! 2020-12-05 12:26:05 +03:00
Jinseong Jeon
762e315ce3 FIR checker: deprecate path-insensitive data collection 2020-12-05 12:25:59 +03:00
Jinseong Jeon
168503573a FIR checker: make unused checker path-sensitive 2020-12-05 12:25:55 +03:00
Jinseong Jeon
3d7d87ace5 FIR: keep nullability of lambda return type 2020-12-05 12:25:50 +03:00
Mikhael Bogdanov
28a1d1ceac Disable test on Windows
#KTI-405
2020-12-05 07:18:45 +01:00
Alexander Udalov
c87edc44f3 Fix compilation error in :noarg-ide-plugin
Was overlooked in a06bffc4b9.
2020-12-05 00:59:18 +01:00
Ilmir Usmanov
69be56d042 Value classes: Forbid cloneable value classes
#KT-43741 Fixed
2020-12-04 23:27:46 +01:00
Alexander Udalov
25c228297a JVM IR: support noarg compiler plugin
#KT-41265 Fixed
2020-12-04 22:12:58 +01:00
Alexander Udalov
a06bffc4b9 Noarg: prohibit noarg for inner and local classes
Report warning if old JVM backend is used, and error for JVM IR, which
is supposed to be enabled as default in the next Kotlin release.

 #KT-43725 Fixed
2020-12-04 22:12:58 +01:00
Alexander Udalov
a343fffe9e Noarg: somewhat refactor tests
Extract method that registers components, merge abstract test classes
into one file.
2020-12-04 22:12:57 +01:00
Alexander Udalov
b10e206144 IR: minor, deduplicate unbound symbol in error message 2020-12-04 22:12:57 +01:00
Nikolay Krasko
bf4f2605d4 Mark FirPsiCheckerTestGenerated.Regression.testJet53 as FLAKY 2020-12-04 19:42:17 +03:00
Vyacheslav Gerasimov
7354bcbc99 Build: Publish kotlin-compiler-internal-test-framework maven artifact 2020-12-04 19:15:12 +03:00
Mads Ager
5d9e86863a [IR] Make isHidden and isAssignable explicit on IrValueParameter.
There were a couple of places where they were confused and
isAssignable was passed as a positional parameter in the position
of isHidden.
2020-12-04 17:04:45 +01:00
Dmitry Petrov
3dbe02b7fe JVM_IR KT-43109 generate internal bridge for custom internal 'toArray'
Also add some tests for internal collection stubs.
2020-12-04 18:57:10 +03:00
Ilya Gorbunov
149bcc2d22 Revert using regex Pattern in String.replace
Use String.indexOf(..., ignoreCase) instead in all branches to preserve
compatibility with behavior before 1.4.20 that used String.split which
essentially relied on that String.indexOf

#KT-43745 Fixed
2020-12-04 17:43:54 +03:00
Jinseong Jeon
5167d69b7c FIR checker: introduce member property checker 2020-12-04 16:58:30 +03:00
Nikolay Krasko
2bf22caeb7 Revert "Keep application environment alive between JPS tests"
This reverts commit 175dd567

The revert fixes the flaky behaviour on Windows in jps-plugin tests.

java.lang.RuntimeException: java.nio.file.FileSystemException:
tempdir_path\jps-build\jslib-example.jar:
The process cannot access the file because it is being used by another process.

Can be reproduced when running KotlinJpsBuildTest after IncrementalJsJpsTestGenerated.

1. IncrementalJsJpsTestGenerated sets KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
2. KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY disables environment clean-up.
3. No disposeApplicationEnvironment() call also means no ZipHandler.clearFileAccessorCache()
4. There's jslib-example.jar opening in JsConfig.checkLibFilesAndReportErrors()
5. File handler is not closed and tests fails in tearDown()

Affected tests:
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryCustomOutputDir
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryAndErrors
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibrary
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryNoCopy
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithTwoModulesAndWithLibrary
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryCustomOutputDir
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryAndErrors
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibrary
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryNoCopy
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithTwoModulesAndWithLibrary
2020-12-04 14:09:36 +03:00
Nikolay Krasko
2d8bdcbc9b Minor: use unique temp directories in jps-build tests 2020-12-04 14:09:36 +03:00
Igor Yakovlev
1ee0892f73 [ULC] Fix NPE on generating data class ctor parameters 2020-12-04 13:07:20 +03:00
Ilmir Usmanov
f43899086a Value Classes: Forbid var properties with value class receivers 2020-12-04 09:45:56 +01:00
Ilmir Usmanov
19b16da183 Minor. Add test to check value classes 2020-12-04 09:19:05 +01:00
Ilmir Usmanov
0d55c9108d IC: Forbid inner classes inside inline classes
#KT-43067 Fixed
2020-12-04 05:45:53 +01:00
Ilmir Usmanov
15c325cf10 Value classes: Allow nested inline classes 2020-12-04 05:45:51 +01:00
Vyacheslav Gerasimov
235813736e Build: Set file access rights explicitly in kotlin-stdlib-js jar
Workaround for #KTI-401. Since gradle 6.6 ant.replaceregexp call sets
incorrect access rights `-rw-------` instead of `-rw-r--r--`
2020-12-04 01:47:18 +03:00
Mikhail Glukhikh
4626f21c58 Record type arguments for FirResolvedQualifier 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
68d271fc91 Move FirModifierList inside FirModifierChecker to reduce its scope 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
94ddb71213 [FIR] Simplify UnusedChecker & delete FirSourceChildren.kt 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
8abf27898d Simplify FirMemberDeclaration.implicitModality 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
5fbdc0af5e [FIR] Introduce & use MODALITY_MODIFIER positioning strategy 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
54f9edb597 Simplify RedundantVisibilityModifierChecker 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
b1c9d4b046 [FIR] Introduce & use VISIBILITY_MODIFIER positioning strategy 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
7f1b539011 [FIR] Simplify CanBeValChecker.getDestructuringChildrenCount 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
3877933913 [FIR] Adapt VAL_OR_VAR strategy & use it in CanBeValChecker 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
ea7d738ee1 [FIR] Introduce & use SourceElementPositioningStrategies.OPERATOR 2020-12-03 19:33:49 +03:00
Mikhail Glukhikh
c9806c5af9 [FIR] Simplify RedundantExplicitTypeChecker 2020-12-03 19:33:49 +03:00
Ilmir Usmanov
516fce37db Value classes: Allow unsigned arrays in annotations
including varargs, apparently.
So, we allow unsigned types and unsigned arrays in annotations,
but disallow user-defined inline classes.
 #KT-23816 Fixed
2020-12-03 17:22:08 +01:00
Alexander Udalov
a9c072f826 Regenerate compiler tests 2020-12-03 17:02:35 +01:00
Dmitry Petrov
caea0a9df0 JVM_IR KT-43721 coerce intrinsic result to corresponding unsigned type 2020-12-03 16:44:26 +03:00
Mads Ager
c776fcbd00 [JVM_IR] Fix incorrect name in inner class attributes. 2020-12-03 13:41:36 +01:00
Mads Ager
fae5b8da4b [JVM] Do not put the name of default lambda parameter in LVT.
If we do, the local variable table will not make sense. As as
example:

```
inline fun foo(getString: () -> String = { "OK" }) {
  println(getString())
}

inline fun bar() {
}

fun main() {
    bar()
    foo()
}
```

leads to the following bytecode:

```
  public static final void main();
    descriptor: ()V
    flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    Code:
      stack=2, locals=4, args_size=0
         0: iconst_0
         1: istore_0
         2: nop
         3: nop
         4: iconst_0
         5: istore_1
         6: nop
         7: ldc           #53                 // String OK
         9: astore_2
        10: iconst_0
        11: istore_3
        12: getstatic     #30                 // Field java/lang/System.out:Ljava/io/PrintStream;
        15: aload_2
        16: invokevirtual #36                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
        19: nop
        20: return
      LineNumberTable:
        line 9: 0
        line 13: 2
        line 10: 3
        line 14: 4
        line 15: 6
        line 16: 7
        line 17: 19
        line 11: 20
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            2       1     0 $i$f$bar   I
            6      14     1 $i$f$foo   I
            4      16     0 getString$iv   Lkotlin/jvm/functions/Function0;
```

The `getString$iv` local should not be there. It has been inlined away.
Leaving it in the local variable table leads to inconsistent locals
info. Local 0 contains an int but we declare a local of type
Function0.
2020-12-03 13:41:36 +01:00
Dmitriy Dolovov
e5c46a86aa [Commonizer] Minor. Rename file 2020-12-03 15:33:26 +03:00
Dmitriy Dolovov
daf42c1ee6 [Commonizer] Remove unnecessary nullability at CirKnownClassifiers.commonDependeeLibraries 2020-12-03 15:33:20 +03:00
Vladimir Dolzhenko
984b3c2f30 Fix to address platform expectation for project path
Project path has to be absolute
2020-12-03 12:35:31 +01:00
Dmitriy Dolovov
68f8e88d8b [Commonizer] Introduce various types of classifier caches
- New CirCommonizedClassifiers and CirForwardDeclarations caches
- New CirProvidedClassifiers cache with classifier names loaded from arbitrary modules
- CirClassifiersCache is replaced by CirKnownClassifiers umbrella
- Replace the remaining usages of 'isUnderStandardKotlinPackages' by delegation to
  CirKnownClassifiers.commonDependeeLibraries
2020-12-03 13:11:40 +03:00
Dmitriy Dolovov
dce3d4d1b7 [Commonizer] Rename InputTarget and OutputTarget
Rename target classes to better reflect their meaning:
- InputTarget -> LeafTarget
- OutputTarget -> SharedTarget
2020-12-03 13:11:33 +03:00
Dmitriy Dolovov
b0ff3e7e5e [Commonizer] More fine-grained control of commonized module dependencies
- Reduce usage of 'isUnderStandardKotlinPackages' check in commonizer source code
- Rely on common module dependencies supplied via commonizer Parameters which not only
  Kotlin standard library but may also include common fragments of other libraries
2020-12-03 13:11:27 +03:00
LepilkinaElena
9d749feb64 Fix gradle test for endorsed libraries in K/N (#3953) 2020-12-03 12:57:02 +03:00
Victor Petukhov
d25ad269e0 Reuse captured arguments for flexible type's bounds properly, by equality of type constructors modulo mutability and type argument
^KT-43630 Fixed
2020-12-03 11:13:41 +03:00
Victor Petukhov
9f58e4bcfe Add FlexibleTypeBoundsChecker which can answer the question: "can two types be different bounds of the same flexible type?"; and provide the base bound for the given bound.
For instance: `MutableList` and `List` may be within the same flexible type.
2020-12-03 11:13:39 +03:00
Victor Petukhov
1ccbb09029 Fix formatting in flexibleTypes.kt 2020-12-03 11:13:38 +03:00
Shagen Ogandzhanian
8e5bcd349e [JS IR] Respect JsExport while assigning stable names
see https://youtrack.jetbrains.com/issue/KT-43404
2020-12-02 22:21:16 +01:00
Alexander Udalov
6b649d02d3 JVM IR: fix visibility/modality of $suspendImpl methods
#KT-43614 Fixed
2020-12-02 20:53:55 +01:00
Alexander Udalov
8ce2e4654b JVM IR: allow custom toArray to have any array type
To avoid breaking Java source compatibility. This problem can be fixed
later once JVM IR is stabilized.

 #KT-43111 Fixed
2020-12-02 20:53:47 +01:00
Dmitry Petrov
e6a3e38c4d JVM_IR no static inline class members for Kotlin JvmDefault methods
KT-43698 KT-43051
2020-12-02 20:04:13 +03:00
Ivan Gavrilovic
11673bd09c KAPT: add tests for processed types, remove dead code, simplify logic
Add integration test which checks if only types can be
reprocessed in an incremental round. Also, remove unused
`invalidateTypesForFiles` method.

Furthermore, clarify that types that are reprocessed
(i.e types from .class files) are not necessarily
aggregating types, but simply types that should be reprocessed.

Test: KaptIncrementalWithIsolatingApt.testClasspathChangesCauseTypesToBeReprocessed
2020-12-02 16:55:50 +01:00
Ivan Gavrilovic
08a2b47c77 Incremental KAPT: fix typo and do check processed sources on
clean build
2020-12-02 16:55:49 +01:00
Ivan Gavrilovic
0522583602 Incremental KAPT: add test for isolating AP with classpath origin
Add a regression test for KT-34340 that allows APs to have
classpath types as origins.
2020-12-02 16:55:49 +01:00
Ivan Gavrilovic
05e47da458 Incremental KAPT: simplify impacted types computation
Process aggregating types first, and when computing impacted types
compute isolating generated impacted by classpath changes first.
2020-12-02 16:55:49 +01:00
Ivan Gavrilovic
c7e5beece5 Use types are origins for incremental KAPT and track generated source
This change introduces tracking of generated sources structure in order
to e.g track classpath changes impacting generated sources. This fixes KT-42182.

Also, origin tracking for isolating processors is now using types, allowing
for origin elements from classpath. This fixes KT-34340. However, classpath
origin is used only to invalidate generated files when the type changes and
processing will not be requested for that type. This is in line with the
incap spec.
2020-12-02 16:55:49 +01:00
Shagen Ogandzhanian
d512158c25 [JS IR] Remove redundant guard assertion for extension funs with default params
Introduce corresponding test
See https://youtrack.jetbrains.com/issue/KT-41076
2020-12-02 16:45:12 +01:00
Alexander Udalov
a917ebd11e JVM IR: use origin to detect property/typealias $annotations methods
Now that DEFAULT_IMPLS origins for methods do not exist after previous
commits, the name heuristic is no longer needed.
2020-12-02 15:54:15 +01:00
Alexander Udalov
c7c793c724 JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE(_TO_SYNTHETIC)
Instead, check that origin of the parent class is DEFAULT_IMPLS. Also,
add a separate origin SUPER_INTERFACE_METHOD_BRIDGE for interface
methods with bodies that are copied to classes.
2020-12-02 15:54:14 +01:00
Alexander Udalov
d41d1bf64d JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation 2020-12-02 15:54:14 +01:00
Alexander Udalov
be03bc477d JVM IR: do not use origin DEFAULT_IMPLS_WITH_MOVED_RECEIVERS(_SYNTHETIC)
Instead, check that origin of the parent class is DEFAULT_IMPLS.
2020-12-02 15:54:14 +01:00
Alexander Udalov
988cc52174 JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY(_SYNTHETIC)
It was only used to generate deprecation in codegen, but it's annotated
with `javaLangDeprecatedConstructorWithDeprecatedFlag`, and a similar
annotation for IrField results in ACC_DEPRECATED. Adapt codegen to
generate this flag for functions too.
2020-12-02 15:54:13 +01:00
Ilya Goncharov
697b2b02f1 [JS IR] Add properties lazy initialization with multiple modules
[JS IR] Move tests into compiler/testData

[JS IR] Add cyclic dependencies with lazy property initialization

[JS IR] Add test on not initialization in case of call non properties (classed, objects, enum classes, const vals)

[JS IR] Add initialization through top level

[JS IR] Ignore enum getInstance function in property lazy initialization

[JS IR] Use let function with useful result instead of pure apply and also

[JS IR] Remove duplicated tests in js.translator
2020-12-02 17:35:30 +03:00
pyos
6cb573cb45 [FIR] Import parents of companion objects first
Otherwise, information about members moved from companion objects to the
parent class (e.g. on JVM, companion object fields -> static fields in
parent class) will be incorrect.
2020-12-02 15:29:42 +03:00
Igor Yakovlev
4d7b6c022b [FIR IDE] LC Anonymous to SuperClass type substitution 2020-12-02 15:13:09 +03:00
Igor Yakovlev
842d31d04e [FIR IDE] Fix HL API test data
Ignore failed tests
Set passing test to comparison mode
Fix testdata for symbols
Fix invalid LAZINESS parameter reading from testdata
2020-12-02 15:13:09 +03:00
Igor Yakovlev
7cbcde77dd [FIR IDE] LC More accurate fields visibility and modality 2020-12-02 15:13:08 +03:00
Igor Yakovlev
a7d7aa123e [FIR IDE] LC minor refactorings 2020-12-02 15:13:08 +03:00
Igor Yakovlev
a1603716ed [FIR IDE] LC Add anonymous objects support
+minor fixes
2020-12-02 15:13:08 +03:00
Igor Yakovlev
5630667320 [FIR IDE] LC better support for JvmMultiFileClass annotation 2020-12-02 15:13:08 +03:00
Igor Yakovlev
56c3faee00 [FIR IDE] LC Fix generating unique field names 2020-12-02 15:13:08 +03:00
Igor Yakovlev
18e5af37ff [FIR IDE] LC Fixed incorrect JvmOverloads 2020-12-02 15:13:07 +03:00
Igor Yakovlev
535aa1e9e0 [FIR IDE] LC expand typealiases for applied annotations 2020-12-02 15:13:07 +03:00
Igor Yakovlev
229c6f97ac [FIR IDE] LC Fixed nullability for getters 2020-12-02 15:13:07 +03:00
Igor Yakovlev
aff90b335c [FIR IDE] LC Implement special keywords like transient, volatile, synchronized, strictfp 2020-12-02 15:13:07 +03:00
Igor Yakovlev
6aff96a401 [FIR IDE] Remove extra analyzing for local declarations 2020-12-02 15:13:07 +03:00
Igor Yakovlev
3fc424246b [FIR IDE] LC basic support for type arguments
+ small fixes for deprecation, etc.
2020-12-02 15:13:06 +03:00
Igor Yakovlev
2a8f783393 [FIR IDE] HL API Better support of nullability and modality 2020-12-02 15:13:06 +03:00
Igor Yakovlev
4c69043a15 [FIR IDE] Move refactoring and minor bugfixing for modality, jvmname, etc. 2020-12-02 15:13:06 +03:00
Igor Yakovlev
3e3ec5fc69 [FIR IDE] Supporting member scopes in EnumEntries 2020-12-02 15:13:06 +03:00
Igor Yakovlev
fdaf31dbf3 [FIR IDE] Fix typemapping for FirTypeAliasSymbol 2020-12-02 15:13:05 +03:00
Igor Yakovlev
aae0081f3f [FIR IDE] Fixed invalid HL API getters request 2020-12-02 15:13:05 +03:00
Mikhail Glukhikh
2429f429c5 [FIR] Set isStubTypeEqualsToAnything = true for inference as in FE 1.0
#KT-43616 Fixed
2020-12-02 14:49:08 +03:00
Mikhail Glukhikh
eae8821dec FIR Java: unbind possible named annotation cycle 2020-12-02 14:48:46 +03:00
Nikolay Krasko
2ffedd2731 Fix Daemon compiler tests on Windows
In 202 platform tearDown tries to remove temporary directory, but this
fails on Windows, because while Daemon is active directory can't be
deleted.
2020-12-02 14:23:32 +03:00
Georgy Bronnikov
8a969dab7d Bugfix for FIR 2020-12-02 09:47:34 +03:00
Georgy Bronnikov
b23d7a79b0 IR: get rid of WrappedDescriptorWithContainerSource 2020-12-02 09:47:34 +03:00
Georgy Bronnikov
c0cd9064d7 IR: IrMemberWithContainerSource 2020-12-02 09:47:34 +03:00
Georgy Bronnikov
14b773c1fd JVM_IR: do not rely on DescriptorWithContainerSource in InlineCodegen 2020-12-02 09:47:34 +03:00
Ilmir Usmanov
f0a787551a Value classes: Raise retention of @JvmInline to RUNTIME
so it will be visible by reflection
2020-12-01 23:45:50 +01:00
Ilmir Usmanov
129de76288 Value classes: Generate @JvmInline annotation for inline classes
but not for value classes.
Since inline classes and value classes share the same flag, we use
presence of the annotation to distinguish them.
2020-12-01 23:45:47 +01:00
Dmitry Petrov
ae8abd1832 Minor: ignore nestedBigArityFunCalls.kt in WASM 2020-12-01 19:43:52 +03:00
Dmitry Petrov
1412ee96f8 JVM_IR KT-43524 static wrappers for deprecated accessors are deprecated 2020-12-01 19:43:52 +03:00
Dmitry Petrov
e96fc74ffa JVM_IR KT-43519 no delegates for external funs in multifile facades
Also add ABI tests for @JvmStatic/JvmOverloads + 'external'.
2020-12-01 19:43:52 +03:00
Dmitry Petrov
2b4564059e JVM_IR KT-43459 fix $annotations method receiver type 2020-12-01 19:43:51 +03:00
Dmitry Petrov
85b5948931 JVM_IR KT-43051 no static inline class members for default Java methods 2020-12-01 19:43:51 +03:00
Dmitry Petrov
4c3ffc3451 JVM_IR KT-41911 process big arity 'invoke' arguments recursively 2020-12-01 19:43:51 +03:00
Georgy Bronnikov
b0e2d5637d Mute a test for WASM 2020-12-01 18:37:55 +03:00
Georgy Bronnikov
bb4950a021 Regenerate LightAnalysis tests 2020-12-01 16:01:48 +03:00
Dmitriy Novozhilov
91bccad72b [JS] Fix path of generated js tests 2020-12-01 15:43:25 +03:00
Mikhail Glukhikh
7550a1870b [FIR2IR] Make checks about f/o accessors necessity more precise
#KT-43342 Fixed
2020-12-01 14:23:19 +03:00
Ilya Goncharov
b179b567a9 [Gradle, JS] Add test on resolution of js project with directory dependency
^KT-43668 fixed
2020-12-01 14:12:39 +03:00
Alexander Udalov
2fdc2dfaaf JVM IR: fix regression in JvmStatic-in-object lowering for properties
References to properties with JvmStatic getter were not handled in
MakeCallsStatic (by overwriting dispatchReceiver with null) because the
property itself was not considered static.

 #KT-43672 Fixed
2020-12-01 11:54:45 +01:00
Georgy Bronnikov
4607eca987 JVM_IR: bug fix in classFileContainsMethod
The old test sequence failed for toplevel functions because of file
class wrappers, so that the second branch was never invoked.
2020-12-01 13:15:51 +03:00
Roman Golyshev
f50480d258 FIR IDE: Fix resolving of nested types in type references 2020-12-01 09:24:20 +00:00
Roman Golyshev
94a5379631 FIR IDE: Add tests for resolving from nested types references
Some of those tests are failing in the FIR IDE
2020-12-01 09:24:20 +00:00
Alexander Udalov
19ca9c0fde Enable JVM IR for bootstrap in the project 2020-11-30 22:09:24 +01:00
Alexander Udalov
606de26646 JVM IR: fix generation of equals/hashCode for fun interfaces over references
... in case `-Xno-optimized-callable-references` is enabled. Before this
change, the generated abstract equals/hashCode methods were considered
as accidental overrides because they did not have equals/hashCode from
the supertype in the overriddenSymbols list.

 #KT-43666 Fixed
2020-11-30 19:15:20 +01:00
pyos
50ae360ff9 FIR2IR: fix the way annotations are moved to fields
1. When an annotation has multiple targets, the priority goes like this:
    constructor parameter (if applicable) -> property -> backing field.

 2. The argument to `kotlin.annotation.Target` is a vararg, so that
    should be handled as well.

 3. `AnnotationTarget.VALUE_PARAMETER` allows receivers, constructor
    parameters, and setter parameters, while `AnnotationTarget.FIELD` allows
    both backing fields and delegates.

Known issue: java.lang.annotation.Target is not remapped to the Kotlin
equivalent, so things are still broken for pure Java annotations.
2020-11-30 20:29:18 +03:00
Andrei Klunnyi
4817d5e01d KTIJ-585 [Gradle Runner]: main() cannot be launched from AS 4.1
Android gradle-project model differs from what we have for pure Java
and MPP. It's the reason why application classpath cannot be collected
correctly.
Until universal solution is provided delegation to gradle is put under
the registry flag. If disable platform runner is used as before.
2020-11-30 15:44:37 +00:00
Ilya Goncharov
995d96e5a3 [JS IR] Use one concat elements for non vararg and vararg arguments
^KT-42357 fixed
2020-11-30 17:34:44 +03:00
Ilya Goncharov
67e4b0948e [JS IR] Constructor call with vararg invoking with apply
[JS IR] Nullize external empty varargs

[JS IR] Concat varargs with array of nonVarargs arguments

^KT-42357 fixed
2020-11-30 17:33:28 +03:00
Ilya Goncharov
ac42dcd8da [JS IR] Add test for external fun vararg
[JS IR] Add tests with empty vararg and default arg before it

[JS IR] Ignore backend in tests instead of target backend

[JS IR] Add function with named spread operator

[JS IR] Remove ignoring of current js backend in jsExternalVarargFun

[JS IR] Add with arguments after vararg

^KT-42357 fixed
2020-11-30 17:33:07 +03:00
Ilya Goncharov
e7789d2e30 [Gradle, JS] Add filter on file on fileCollectionDependencies because Gradle can't hash directory
^KT-43668 fixed
2020-11-30 17:04:30 +03:00
Dmitry Petrov
96ed99d62e JVM_IR KT-40305 no nullability assertions on built-in stubs 2020-11-30 15:49:02 +03:00
Dmitry Petrov
b2aed536c9 JVM_IR KT-39612 process subexpressions recursively in 'name' lowering 2020-11-30 15:49:02 +03:00
Dmitry Petrov
3b604cfa7f JVM_IR KT-32701 generate multiple big arity invokes, report error later 2020-11-30 15:49:02 +03:00
Dmitry Petrov
a157b58c61 JVM_IR KT-43610 keep track of "special bridges" for interface funs 2020-11-30 15:49:01 +03:00
Dmitriy Novozhilov
c43db2ee8d [TEST] Inherit UpdateConfigurationQuickFixTest from KotlinLightPlatformCodeInsightFixtureTestCase
This is needed for proper test muting
2020-11-30 15:39:05 +03:00
Alexander Udalov
7d9eeb6847 Minor, add workaround for KT-42137 2020-11-30 12:44:42 +01:00
Alexander Udalov
e1d54bf99f Minor, add workaround for KT-43666 2020-11-30 12:37:27 +01:00
Mikhael Bogdanov
ad579de328 Don't run KaptPathsTest.testSymbolicLinks test on Windows 2020-11-30 12:17:00 +01:00
Dmitriy Novozhilov
d706a7ff74 Build: mute failing tests
Those tests are failing only on windows agents after
  switch to 202 platform
2020-11-30 13:40:29 +03:00
pyos
1cccf2645f FIR: serialize HAS_CONSTANT at least for const properties
Non-const properties may need them too with if the 1.4 feature
NoConstantValueAttributeForNonConstVals is disabled.
2020-11-30 13:05:28 +03:00
Mikhail Glukhikh
04d9afe83e FIR Java: add workaround for classId = null in JavaAnnotation 2020-11-30 13:05:27 +03:00
Mikhail Glukhikh
feb13f98c0 [FIR2IR] Handle Java annotation parameter mapping properly
#KT-43584 Fixed
2020-11-30 13:05:26 +03:00
Mikhail Glukhikh
9b30655d66 [FIR] Load Java annotations named arguments properly (see KT-43584) 2020-11-30 13:05:23 +03:00
Roman Golyshev
e6f380182a Revert "FIR IDE: Add tests for resolving from nested types references"
This reverts commit e127ea3d
2020-11-30 12:37:40 +03:00
Roman Golyshev
f8b6559b6a Revert "FIR IDE: Fix resolving of nested types in type references"
This reverts commit dba14ba9
2020-11-30 12:37:26 +03:00
Roman Golyshev
dba14ba995 FIR IDE: Fix resolving of nested types in type references 2020-11-30 09:26:15 +00:00
Roman Golyshev
e127ea3dad FIR IDE: Add tests for resolving from nested types references
Some of those tests are failing in the FIR IDE
2020-11-30 09:26:15 +00:00
Mikhael Bogdanov
8a00470b40 Enable kotlin-annotation-processing-base tests on TC 2020-11-30 10:06:22 +01:00
Sergey Bogolepov
29bed39a54 Bump to native version version with watchos_x64 enabled 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
37ee2cbe53 [KT-43276] Update tests to support watchos_x64 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
d6f54a7730 [KT-43276] Fix watchos target shortcut. 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
f3424a98b7 generateMppTargetContainerWithPresets: remove unneeded hack 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
e39560b134 [KT-43276] Add watchos_x64 target 2020-11-30 14:01:12 +07:00
Ilya Gorbunov
0634351fbc Introduce pathString/absolute/absolutePathString
Rename invariantSeparatorsPath to invariantSeparatorsPathString
to have more consistent names of methods returning path strings.

KT-19192
2020-11-29 17:46:47 +03:00
Ilya Gorbunov
84f5a294f7 Allow passing null parent directory to createTempFile/Directory
null signifies the default temp directory.

KT-19192
2020-11-29 17:46:47 +03:00
Ilya Gorbunov
64d85f259c Relax writeText/appendText parameter type to CharSequence
KT-19192
2020-11-29 17:46:47 +03:00
Pavel Punegov
2ee8bf7dde Add fastutil dependency for 202 and higher platforms 2020-11-28 14:26:01 +03:00
Dmitriy Novozhilov
f668e906cc Build: unmute passed tests 2020-11-28 14:26:01 +03:00
Dmitriy Novozhilov
e7d305b97a Build: mute failing stepping tests 2020-11-28 14:26:00 +03:00
Dmitriy Novozhilov
78c786de46 Build: Mute failing goto declaration tests 2020-11-28 14:26:00 +03:00
Dmitriy Novozhilov
33b545aea7 Build: Mute failing gradle import with android tests 2020-11-28 14:25:59 +03:00
Dmitriy Novozhilov
85c59328c7 [DEBUGGER] Temporary mute AbstractKotlinEvaluateExpressionTest 2020-11-28 14:25:59 +03:00
Vladimir Dolzhenko
3d33ea7da8 Use absolute paths to locate existed projects to open in AbstractConfigureKotlinTest 2020-11-28 14:25:58 +03:00
Vladimir Dolzhenko
124888eb43 Revert back AddFunctionParametersFix test data output for 201- 2020-11-28 14:25:58 +03:00
Dmitriy Novozhilov
e251a9be14 Build: fix finding layout-api jar in parcelize box test due to platform change 2020-11-28 14:25:57 +03:00
Dmitriy Novozhilov
cc1a0bf6d7 [FE] Update testdata 2020-11-28 14:25:57 +03:00
Vladimir Dolzhenko
17e6e88176 Fixed AddFunctionParametersFix test data output 2020-11-28 14:25:57 +03:00
Dmitriy Novozhilov
406e863a73 [FE] Fix creating location of compiler errors in CLI 2020-11-28 14:25:56 +03:00
Dmitriy Novozhilov
dc364b8be4 Remove useless @author comment 2020-11-28 14:25:56 +03:00
Vladimir Dolzhenko
95e5ea4840 temporary ignore/disable tests 2020-11-28 14:25:55 +03:00
Dmitriy Novozhilov
02f71a63b8 [FE] Disable SKIP_DEBUG flag when building java model from binaries
This is needed to avoid skipping jvm annotations with names of
  function parameters
2020-11-28 14:25:55 +03:00
Dmitriy Novozhilov
bf1abed246 Build: add shadowing processor for core.xml in embeddable compiler 2020-11-28 14:25:54 +03:00
Dmitriy Novozhilov
ad953b6285 Build: remove redundant bunch TODO's 2020-11-28 14:25:54 +03:00
Dmitriy Novozhilov
986ab9cb54 Build: remove useless .as40 files 2020-11-28 14:25:54 +03:00
Dmitriy Novozhilov
1b559fe676 Don't set KOTLIN_BUNDLED in unit tests 2020-11-28 14:25:53 +03:00
Dmitriy Novozhilov
7396abf5a4 Build: add fastutil dependency to scripting tests 2020-11-28 14:25:53 +03:00
Dmitriy Novozhilov
5ab9710cc5 Remove ./local directory from CodeConformanceTest 2020-11-28 14:25:52 +03:00
Dmitriy Novozhilov
d3ef0eb519 Build: register missing TreeAspect service in KtParsingTestCase 2020-11-28 14:25:52 +03:00
Dmitriy Novozhilov
68719831ee Build: update asm version in kotlinp 2020-11-28 14:25:52 +03:00
Dmitriy Novozhilov
dc35a13008 Build: remove useless bunch files 2020-11-28 14:25:51 +03:00
Dmitriy Novozhilov
46fcc7d59d Build: fix registration of ClassFileDecompilers extension 2020-11-28 14:25:51 +03:00
Dmitriy Novozhilov
48cbb74a01 Build: drop deprecated extension point used in test of old j2k 2020-11-28 14:25:50 +03:00
Dmitriy Novozhilov
d887814cc5 Build: fix compilation of :libraries:tools:kotlin-maven-plugin-test 2020-11-28 14:25:50 +03:00
Dmitriy Novozhilov
4779092ba5 Build: fix API differences between 201 and 202 in idea performance tests 2020-11-28 14:25:49 +03:00
Dmitriy Novozhilov
2a053c214d Build: fix API differences between 201 and 202 in scratch tests 2020-11-28 14:25:49 +03:00
Dmitriy Novozhilov
d50d56f68c Build: fix API differences between 201 and 202 in NewKotlinFileAction 2020-11-28 14:25:49 +03:00
Dmitriy Novozhilov
e4e28a5495 Build: update grovy dependencies in :compiler:tests-spec 2020-11-28 14:25:48 +03:00
Dmitriy Novozhilov
07dd9179e8 Build: change 202 platform version 2020-11-28 14:25:48 +03:00
Dmitriy Novozhilov
eeb9b3214c Switch to 202 platform 2020-11-28 14:25:19 +03:00
Ilya Muradyan
89bba93615 Introduce GetScriptingClassByClassLoader interface
It is needed to override default JVM behaviour
2020-11-28 09:44:06 +01:00
Ilya Muradyan
65ce7cd0c2 Fix path for Windows in Fibonacci test 2020-11-28 09:44:06 +01:00
Ilmir Usmanov
78e607c6b0 Value classes: Support @JvmName annotation on functions with inline
classes in signatures, but not on methods of inline classes.
2020-11-28 00:34:04 +01:00
Ilmir Usmanov
871912f257 Value Classes: Increase BINARY_STUB_VERSION after decompiler changes 2020-11-27 23:52:09 +01:00
Ilmir Usmanov
05c4dfef3d Value classes: Use 'value' keyword instead of 'inline' in stub dumps 2020-11-27 23:52:08 +01:00
Ilmir Usmanov
9b9c43b702 Value classes: Change relevant diagnostic to say 'value class'
instead of 'inline class'
2020-11-27 23:52:08 +01:00
Ilmir Usmanov
ca3e7cf1a7 Value classes: Report lacking @JvmInline only on JVM backend
Report when @JvmInline is applied on non-value class.
2020-11-27 23:52:07 +01:00
Ilmir Usmanov
92f1681de0 Value classes: treat @JvmInline value classes as inline classes
Report error on value classes without @JvmInline annotation.
Do not check for @JvmInline annotation in value classes since
it breaks reflection.
2020-11-27 23:52:06 +01:00
Ilmir Usmanov
6c68660ffd Value classes: Render 'value' before class 2020-11-27 23:52:06 +01:00
Ilmir Usmanov
f158411f9a Value classes: Increase JVM metadata version to distinguish
between inline and value classes.
2020-11-27 23:52:05 +01:00
Ilmir Usmanov
361ed117bb Value classes: Add isValue property to class descriptors
Reuse isInline flag in proto and IR.
Check metadata version on deserialization.
2020-11-27 23:52:05 +01:00
Ilmir Usmanov
8eff3a6bb3 Value classes: Increase stub version due to changes in the parser 2020-11-27 23:52:04 +01:00
Ilmir Usmanov
11b2a07a59 Value classes: Support 'value' modifier in parser 2020-11-27 23:52:04 +01:00
Ilya Kirillov
d5979ffded FIR IDE: add tests for checking module invalidation 2020-11-27 23:14:57 +01:00
Ilya Kirillov
2fb4a917f6 FIR IDE: fix module invalidation algorithm 2020-11-27 23:14:57 +01:00
Ilya Kirillov
519f1549f0 FIR IDE: separate logic of TestProjectStructure from AbstractFirMultiModuleLazyResolveTest 2020-11-27 23:14:56 +01:00
Ilya Kirillov
3515cd546d FIR IDE: use PersistentMap to store FromModuleViewSessionCache mappings
Needed to ensure safe pub of map
2020-11-27 23:14:56 +01:00
Ilya Kirillov
76c0dc7dba FIR IDE: add property support for incremental analysis 2020-11-27 20:41:38 +01:00
Ilya Kirillov
953dba808b FIR IDE: move withFirDeclaration to LowLevelFirApiFacade 2020-11-27 20:41:37 +01:00
Ilya Kirillov
b4d63b9b13 FIR IDE: add docs for LowLevelFirApiFacade functions 2020-11-27 20:41:35 +01:00
Ilya Kirillov
93648e6cd3 FIR IDE: use mor specific exception in EntityWasGarbageCollectedException 2020-11-27 20:41:33 +01:00
Ilya Kirillov
65a7ee5012 FIR IDE: remove duplicating withFirResolvedToBodyResolve 2020-11-27 20:41:32 +01:00
Ilya Kirillov
3141fead0d FIR IDE: get rid of LowLevelFirApiFacade object 2020-11-27 20:41:31 +01:00
Dmitry Petrov
a206eca164 JVM_IR KT-43611 report signature clash on private interface members 2020-11-27 18:54:09 +03:00
Dmitriy Novozhilov
fd935b7c54 [TEST] Move generated js compiler tests to test-gen directories 2020-11-27 18:07:47 +03:00
Ilya Goncharov
77ed51b3ab [JS IR] Add message for for enabling option for overwriting reachable nodes
[JS IR] Disable rewriting of EXPECTED_REACHABLE_NODES by default, add system property to enable this behaviour
2020-11-27 17:26:07 +03:00
Dmitriy Novozhilov
908732b3c1 [TEST] Move generated visualizer tests to test-gen directories 2020-11-27 12:55:48 +03:00
Dmitriy Novozhilov
eca769f8e4 [TEST] Move generated fir tests to test-gen directories 2020-11-27 12:55:48 +03:00
Dmitriy Novozhilov
1ee38286a8 [TEST] Move generated compiler tests to test-gen directory 2020-11-27 12:55:45 +03:00
Ilmir Usmanov
524419a2fe IC Mangling: Use new mangling scheme for range tests 2020-11-27 10:56:07 +03:00
Georgy Bronnikov
6381d97aab JVM_IR: compute classId on IR structures 2020-11-27 10:56:07 +03:00
Dmitry Petrov
ee1e05fedd KT-42151 fix type arguments in local class constructor reference types 2020-11-26 18:40:49 +03:00
Mikhael Bogdanov
b2b8562f92 Properly extract JVM version in kapt
#KT-41788
2020-11-26 15:13:06 +01:00
Ilmir Usmanov
9ed5b8f870 IC & Coroutines: Do not box suspend operator fun invoke receiver
if it is called using parens and not by calling 'invoke' method.

Use underlying type when calling continuation constructor if suspend
function is method inside inline class.

 #KT-43505 Fixed
 #KT-39437 Fixed
2020-11-26 15:08:56 +01:00
Ilmir Usmanov
4e334217a8 IC & Coroutines: Unbox inline class parameter of suspend lambda
inside 'create' if 'create' overrides 'create' from
BaseContinuationImpl. In other words, unbox the parameter if 'create'
accepts only one parameter.

 #KT-43249 Fixed
 #KT-43533 Fixed
2020-11-26 15:08:54 +01:00
Ilmir Usmanov
eba260f681 IC & Coroutines: Unbox inline classes of suspend lambdas
inside 'invoke' if 'create' does not override 'create' from
BaseContinuationImpl. In other words, when suspend lambda accepts more
than one parameter (including receiver).

Do that only if we do not generate bridge 'invoke' method, since
inline classes are unboxed in the bridge.

Use mangled name for 'create' function in this case inside 'invoke'.

 #KT-43249 In progress
 #KT-39847 Fixed
 #KT-38937 Fixed
2020-11-26 15:08:51 +01:00
Mikhail Glukhikh
0a0b5b5d2b [FIR DFA] Don't consider anonymous object as stable initializer to bind
#KT-43332 Fixed
2020-11-26 16:29:06 +03:00
Mikhail Glukhikh
1dc897346c [FIR] Fix WRONG_IMPLIES_CONDITION problem in DFA model 2020-11-26 16:28:56 +03:00
Ilya Gorbunov
7fd96f5773 Fix annotation spelling in docs
KT-43586
2020-11-26 15:37:22 +03:00
Dmitriy Novozhilov
db9f301eed [FE] Make DiagnosticFactory.name not null 2020-11-26 11:54:15 +03:00
Dmitriy Dolovov
94ce56bfdc Minor. Add words to project dictionary 2020-11-26 10:57:16 +03:00
Dmitriy Dolovov
c741284458 [Commonizer] Stricter processing of forward declarations 2020-11-26 10:57:11 +03:00
Dmitriy Dolovov
eca231a01d [Commonizer] Extract CIR classifiers cache from the root node 2020-11-26 10:57:05 +03:00
Dmitriy Dolovov
8d9abed3dc [Commonizer] Minor. More specific upper bounds for CirNodeWithClassId 2020-11-26 10:56:59 +03:00
Mikhail Glukhikh
d4b0bf4ad8 [FIR] Make DEFAULT positioning strategy public, drop duplicated one 2020-11-26 08:37:51 +03:00
Mikhail Glukhikh
97c1a3f270 Simplify FirSupertypeInitializedWithoutPrimaryConstructor checker 2020-11-26 08:37:51 +03:00
Mikhail Glukhikh
bf2b318bee Simplify FirSupertypeInitializedInInterfaceChecker 2020-11-26 08:37:51 +03:00
Mikhail Glukhikh
12726cd366 FIR light builder: use type reference node as FirTypeRef source 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
d5f17ea41c Simplify FirDelegationInInterfaceChecker 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
b673996586 Simplify source operations in FirAnnotationArgumentChecker 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
1c71e64f58 [FIR] Create string interpolating call even for single argument
Before this commit, questionable optimization existed which
unwrapped string interpolating call with single argument to this argument.
However, this led to source element loss and the necessity of sub-hacks.
In this commit we dropped this optimization (anyway user can remove
this single-expression string template in code if needed) to keep
source elements intact.
2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
915a66f4fa [FIR] Introduce & use "multiplexing" SourceElementPositioningStrategy 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
f3334b03c4 FIR checkers: simplify FirSupertypeInitializedWithoutPrimaryConstructor 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
58301d8820 FIR exposed visibility checkers: use positioning strategy 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
f095a33970 FIR checkers: extract getChildren(), simplify findSuperTypeDelegation() 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
1e3621a896 FIR checkers: simplify hasPrimaryConstructor by source element check 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
0838ab7fe7 FIR checkers: simplify hasVal / hasVar source element checks 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
c6b703b598 Simplify LighterASTNode.toFirLightSourceElement 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
037c505069 Unbind general FirDiagnostic from PsiFile & PsiElement 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
68b748e164 Rename DebugInfoUtil.java to DebugInfoUtil.kt, same with AnalyzingUtils 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
6f8947dd04 Extract UnboundDiagnostic, DiagnosticFactory/Renderer to frontend-common 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
52a07e31c7 [FIR] Remove D_I_EXPRESSION_TYPE from qualified calls in spec test data
In FIR, the source of FirFunctionCall is set to call's selector.
In practice, sometimes (e.g. for DEBUG_INFO_CALL)
we expect the selector as the source,
and sometimes (e.g. for DEBUG_INFO_EXPRESSION_TYPE)
we expect the whole qualified call as the source.
Also, some diagnostics, like REDUNDANT_CALL_OF_CONVERSION_METHOD,
are expected to be reported on a selector, not on a whole call.
At this moment we ignore the problem & just don't support
DEBUG_INFO_EXPRESSION_TYPE for qualified calls.
2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
558ac1678e Create FIR fake source element for checked safe call subject 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
2592eed0e7 [FIR TEST] More precise control of source kind in createDebugInfo 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
82c5cefba9 Update test data in FIR diagnostic spec tests 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
e7e162c7eb [FIR TEST] Filter some particular tokens during createDebugInfo 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
c602ccb33e Create FIR fake source element for vararg argument expression 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
fa3f805573 Support FirDiagnostic.isValid properly
Diagnostic is considered valid in this commit if it's reported on
a syntactically non-erroneous element without erroneous last child
2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
c7ae176ae4 [FIR] Inherit FIR with parameter renderer from the old parameter renderer 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
3dec848c03 [FIR] Implement light tree DECLARATION_NAME & SIGNATURE strategies 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
42c59f7383 [FIR] Enhance light tree DEFAULT strategy for objects to cover header only 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
d844b33b1c [FIR] Implement light tree CONSTRUCTOR_DELEGATION_CALL strategy
Default strategy sometimes delegates to the CONSTRUCTOR_DELEGATION_CALL
strategy, so we add it in this commit to process some related cases
properly.
2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
8320a2966a [FIR] Implement light tree VAL_VAR strategy as an example 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
1795c4f3e5 Implement common Diagnostic(Factory/Renderer) in related FIR classes 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
d47e16331c Convert DiagnosticFactory.java to Kotlin 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
84f3a4ba9d Rename DiagnosticFactory.java to DiagnosticFactory.kt 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
9040999b55 Convert Diagnostic.java to Kotlin 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
b6cfcc6cad Rename Diagnostic.java to Diagnostic.kt 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
d942780c14 [FIR] Introduce LightTreePositioningStrategy 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
1cb2aeaeff FirSourceElement: introduce common 'treeStructure' property 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
3a2b15521b FirSourceElement: introduce common 'lighterASTNode' property 2020-11-26 08:37:45 +03:00
Zalim Bashorov
6abd656116 [IR] dumpKotlinLike: update testdata after rebase 2020-11-26 00:15:26 +03:00
Zalim Bashorov
0d5a0b207e [IR] KotlinLikeDumper: add a note about some conventions used for TODO comments 2020-11-26 00:15:25 +03:00
Zalim Bashorov
c004269547 [IR] KotlinLikeDumper: unify and add more comments for the cases when used a syntax which is invalid in Kotlin 2020-11-26 00:15:24 +03:00
Zalim Bashorov
5a755054f8 [IR] dumpKotlinLike: add a comment about some conventions which could be unclear 2020-11-26 00:15:22 +03:00
Zalim Bashorov
69f0f4ef19 [IR] update testdata: unify printing custom/non-standard modifiers 2020-11-26 00:15:21 +03:00
Zalim Bashorov
90fdfbde68 [IR] KotlinLikeDumper: unify printing custom/non-standard modifiers 2020-11-26 00:15:19 +03:00
Zalim Bashorov
57cb8f97e9 [IR] update testdata: don't use "D" suffix on double constants 2020-11-26 00:15:18 +03:00
Zalim Bashorov
73771a3513 [IR] KotlinLikeDumper: don't use "D" suffix on double constants 2020-11-26 00:15:17 +03:00
Zalim Bashorov
7df6575a18 [IR] update testdata: unify representation for error nodes 2020-11-26 00:15:16 +03:00
Zalim Bashorov
ef9a901635 [IR] KotlinLikeDumper: unify representation for error nodes 2020-11-26 00:15:15 +03:00
Zalim Bashorov
f8690d0395 [IR] KotlinLikeDumper: minor, collapse an if to helper function and add few more todos 2020-11-26 00:15:14 +03:00
Zalim Bashorov
c68040753d [IR] dumpKotlinLike: add testdata for FIR tests 2020-11-26 00:15:13 +03:00
Zalim Bashorov
d7bd4240e1 [IR] dumpKotlinLike: don't crash when type argument is null 2020-11-26 00:15:12 +03:00
Zalim Bashorov
dec067af8c [IR] stop overwriting testdata for dumpKotlinLike and use assertEqualsToFile 2020-11-26 00:15:11 +03:00
Zalim Bashorov
43ee50b91d [IR] update testdata after rebase 2020-11-26 00:15:10 +03:00
Zalim Bashorov
2773e4baca [IR] KotlinLikeDumper.kt -> dumpKotlinLike.kt 2020-11-26 00:15:09 +03:00
Zalim Bashorov
36591ba5f7 [IR] KotlinLikeDumper: replace all usages of commentBlockH with commentBlock 2020-11-26 00:15:07 +03:00
Zalim Bashorov
ad0f154ed1 [IR] add new testdata after rebase 2020-11-26 00:15:07 +03:00
Zalim Bashorov
f9fe82e735 [IR] KotlinLikeDumper: process specially when IrElseBranch's condition is not true constant 2020-11-26 00:15:05 +03:00
Zalim Bashorov
503370c9c2 [IR] update testdata: escape special symbols in Char and String constant values 2020-11-26 00:15:04 +03:00
Zalim Bashorov
0f10b5eb9e [IR] KotlinLikeDumper: escape special symbols in Char and String constant values 2020-11-26 00:15:03 +03:00
Zalim Bashorov
92dda5cd92 [IR] KotlinLikeDumper.kt: cleanup 2020-11-26 00:15:02 +03:00
Zalim Bashorov
5b0efe2b64 [IR] KotlinLikeDumper: rearrange methods 2020-11-26 00:15:01 +03:00
Zalim Bashorov
d9dbc01c3e [IR] KotlinLikeDumper: p.print("") -> p.printIndent() 2020-11-26 00:15:00 +03:00
Zalim Bashorov
c7d9b7adbe [IR] KotlinLikeDumper: rearrange methods 2020-11-26 00:14:59 +03:00
Zalim Bashorov
76e959ef8c [IR] KotlinLikeDumper: minor, update some comments 2020-11-26 00:14:58 +03:00
Zalim Bashorov
e94528fe0d [IR] update testdata: print class name for callable references without receivers 2020-11-26 00:14:57 +03:00
Zalim Bashorov
b6e37c1f89 [IR] KotlinLikeDumper: print class name for callable references without receivers 2020-11-26 00:14:56 +03:00
Zalim Bashorov
2dbd784a6a [IR] update testdata: print else -> ... 2020-11-26 00:14:55 +03:00
Zalim Bashorov
14dabed85a [IR] KotlinLikeDumper.kt: move branch support to corresponding visit* methods 2020-11-26 00:14:54 +03:00
Zalim Bashorov
8f155c23a0 [IR] update testdata: better support for callable references 2020-11-26 00:14:53 +03:00
Zalim Bashorov
0d3d61862b [IR] KotlinLikeDumper: better support for callable references 2020-11-26 00:14:52 +03:00
Zalim Bashorov
87eb06a21f [IR] update testdata: improve annotations rendering in case when argument was not provided and there is default value 2020-11-26 00:14:51 +03:00
Zalim Bashorov
a34a311e86 [IR] update testdata: support annotations on parameters 2020-11-26 00:14:50 +03:00
Zalim Bashorov
182cb52bdb [IR] KotlinLikeDumper: various changes for value and type params
* support annotations on value parameters
* support new value parameter flags -- hidden, assignable
* extract and reuse logic for value and type parameters
2020-11-26 00:14:49 +03:00
Zalim Bashorov
5cb2572c60 [IR] update testdata: better support for enum and object accesses 2020-11-26 00:14:48 +03:00
Zalim Bashorov
1fd12b7b8a [IR] KotlinLikeDumper: better support for enum and object accesses 2020-11-26 00:14:47 +03:00
Zalim Bashorov
635cb44bf3 [IR] update testdata: support IrDynamic* nodes 2020-11-26 00:14:46 +03:00
Zalim Bashorov
82839e6a67 [IR] KotlinLikeDumper: support IrDynamic* nodes 2020-11-26 00:14:45 +03:00
Zalim Bashorov
cdc74304c7 [IR] add testdata for irJsText 2020-11-26 00:14:44 +03:00
Zalim Bashorov
68b17fe55b [IR] KotlinLikeDumper: add more visit* to implement 2020-11-26 00:14:43 +03:00
Zalim Bashorov
4fb762e019 [IR] update testdata: minor updates for error nodes 2020-11-26 00:14:41 +03:00
Zalim Bashorov
b129788823 [IR] KotlinLikeDumper: minor updates for error nodes 2020-11-26 00:14:40 +03:00
Zalim Bashorov
a128cdc99c [IR] KotlinLikeDumper: add more TODOs and remove some obsolete ones 2020-11-26 00:14:39 +03:00
Zalim Bashorov
bf20720590 [IR] KotlinLikeDumper: reformat 2020-11-26 00:14:38 +03:00
Zalim Bashorov
ad5df79e39 [IR] KotlinLikeDumper: merge Break & Continue 2020-11-26 00:14:36 +03:00
Zalim Bashorov
64b42401a1 [IR] update testdata: print a parameter in catch 2020-11-26 00:14:34 +03:00
Zalim Bashorov
2775c89ebb [IR] KotlinLikeDumper: print a parameter in catch 2020-11-26 00:14:33 +03:00
Zalim Bashorov
5c8a93c7ff [IR] update testdata: support labels on loops, break & continue 2020-11-26 00:14:32 +03:00
Zalim Bashorov
9daa86c1a2 [IR] KotlinLikeDumper: support labels on loops, break & continue 2020-11-26 00:14:31 +03:00
Zalim Bashorov
21da2b0350 [IR] update testdata: print whole string concatenation at one line 2020-11-26 00:14:30 +03:00
Zalim Bashorov
91c9d9d25c [IR] KotlinLikeDumper: print whole string concatenation at one line 2020-11-26 00:14:29 +03:00
Zalim Bashorov
a6b408978f [IR] update testdata: super and receiver for field accesses 2020-11-26 00:14:28 +03:00
Zalim Bashorov
029ee6f2e7 [IR] KotlinLikeDumper: super and receiver on field accesses 2020-11-26 00:14:27 +03:00
Zalim Bashorov
0bf587ad4b [IR] KotlinLikeDumper: deduplicate code between IrDelegatingConstructorCall and IrEnumConstructorCall 2020-11-26 00:14:26 +03:00
Zalim Bashorov
e56787c0b0 [IR] update testdata: IrInstanceInitializerCall 2020-11-26 00:14:25 +03:00
Zalim Bashorov
26dd009713 [IR] KotlinLikeDumper: change rendering for IrInstanceInitializerCall 2020-11-26 00:14:24 +03:00
Zalim Bashorov
ab8188b032 [IR] update testdata: removed extra indentation for function expressions 2020-11-26 00:14:23 +03:00
Zalim Bashorov
cf5ba82453 [IR] KotlinLikeDumper: don't indent function expressions 2020-11-26 00:14:22 +03:00
Zalim Bashorov
5500b014f5 [IR] update testdata: better support for IrEnumConstructorCall and IrEnumEntry 2020-11-26 00:14:21 +03:00
Zalim Bashorov
602f0ddbc8 [IR] update testdata after using maxBlankLines=1 for Printer 2020-11-26 00:14:20 +03:00
Zalim Bashorov
6e318893f6 [IR] KotlinLikeDumper: support for IrEnumConstructorCall and better rendering for IrEnumEntry 2020-11-26 00:14:18 +03:00
Zalim Bashorov
b518c19b38 [IR] update testdata: support for IrDelegatingConstructorCall 2020-11-26 00:14:17 +03:00
Zalim Bashorov
84d6e43590 [IR] update testdata: print arguments for annotations 2020-11-26 00:14:16 +03:00
Zalim Bashorov
2a19dc32f2 [IR] update testdata: better support for IrConstructorCall 2020-11-26 00:14:15 +03:00
Zalim Bashorov
197f5ca885 [IR] update testdata: better support for IrCall 2020-11-26 00:14:13 +03:00
Zalim Bashorov
ef2adfa835 [IR] KotlinLikeDumper: better support for calls and annotations
* IrCall
* IrConstructorCall
* IrDelegatingConstructorCall
* print arguments for annotations
2020-11-26 00:14:12 +03:00
Zalim Bashorov
fc5c674c60 [IR] update testdata 2020-11-26 00:14:11 +03:00
Zalim Bashorov
6a1ab1b325 [IR] KotlinLikeDumper: WIP
* rearrange some declarations
* add space for before "BLOCK"
* add comment for "RETURNABLE BLOCK"
2020-11-26 00:14:10 +03:00
Zalim Bashorov
0294ff4f10 [IR] add TODO to RenderIrElement 2020-11-26 00:14:09 +03:00
Zalim Bashorov
a5b224fda1 [IR] add new testdata after rebase 2020-11-26 00:14:07 +03:00
Zalim Bashorov
3b1a6389ab [IR] update testdata after rebase 2020-11-26 00:14:06 +03:00
Zalim Bashorov
1c6c996084 [IR] KotlinLikeDumper: fixes after rebase 2020-11-26 00:14:05 +03:00
Zalim Bashorov
7abd09ce96 [IR] initial version of dumpKotlinLike 2020-11-26 00:14:04 +03:00
Zalim Bashorov
8d5facb15f [IR] add testdata for dumpKotlinLike 2020-11-26 00:14:03 +03:00
Zalim Bashorov
d2022ab115 [IR] hack AbstractIrTextTestCase to test dumpKotlinLike 2020-11-26 00:14:01 +03:00
Vyacheslav Gerasimov
6241f9be2d Build: Fix ide plugin maven artifacts publication 2020-11-25 22:44:46 +03:00
Mikhael Bogdanov
8f187f328a Switch ASM artifact 2020-11-25 19:57:06 +01:00
Sergey Shanshin
b5143ba2ab Optimize check for missing fields in deserialization (#3862)
Fixes Kotlin/kotlinx.serialization#662 Kotlin/kotlinx.serialization#657
2020-11-25 21:50:42 +03:00
Svyatoslav Kuzmich
f9503efb74 [JS IR] Make WITH_RUNTIME imply KJS_WITH_FULL_RUNTIME
There is a lot of intersection between these
2020-11-25 21:22:39 +03:00
Bingran
b0ebb02b6f Fix more deprecated configurations and disable fail mode for some tests 2020-11-25 20:56:11 +03:00
Bingran
858f73124d Update settings script properly, more tests with warning-mode=fail
For some test class where most of the sub tests are able to run
warning-mode=fail, we should not disable that warning mode for all
sub tests in that class.
2020-11-25 20:56:11 +03:00
Bingran
52c22d891f MPP plugin: add expectedBy deps to "api" configuration
Currently, KotlinPlatformJvmPlugin and KotlinPlatformJsPlugin are
adding expectedBy deps to "compile" configuration which is deprecated
by Gradle. This PR fixes that by replacing "compile" with "api" which
is what we are doing in KotlinPlatformAndroidPlugin.

This PR also makes integration tests running with warning-mode=fail by
default and fixes most of the integration tests. For the remaining tests
to be fixed, we make them run with warning-mode=summary and will fix
them incrementally in following PRs.
2020-11-25 20:56:11 +03:00
Hung Nguyen
4bf63a9539 Sort class members to ensure deterministic builds
Class methods and fields are currently sorted at serialization (see
DescriptorSerializer.sort) and at deserialization (see
DeserializedMemberScope.OptimizedImplementation#addMembers). Therefore,
the contents of the generated stub files are sorted in incremental
builds but not in clean builds.

The consequence is that the contents of the generated stub files may not
be consistent across a clean build and an incremental build, making the
build non-deterministic and dependent tasks run unnecessarily (see
KT-40882).

To work around that, this commit sorts class methods and fields when
outputting stub files.

Bug: KT-40882 (there are actually 2 issues in here; this commit fixes
     the first one)
Test: New DeterministicBuildIT + Updated existing test expectation files
2020-11-25 20:51:09 +03:00
Igor Chevdar
07a797cc3a [IR] Fixed bug with type parameters of referenced constructor 2020-11-25 21:27:09 +05:00
Kevin Bierhoff
c90546104e Uast: partial fix for reified functions resolve (#3923, KT-41279)
doesn't take into account compiled reified functions from jars
2020-11-25 18:21:14 +03:00
Dmitry Petrov
7cc6204d6b Minor: update testData 2020-11-25 17:31:47 +03:00
Dmitry Petrov
e5dce9f994 KT-42933 inline class backing field can't be static 2020-11-25 17:31:46 +03:00
Dmitry Petrov
f6abc5c3cf KT-43286 use JVM 1.8 intrinsics for coercible unsigned values only 2020-11-25 17:31:46 +03:00
Dmitry Petrov
498047e64e KT-43562 don't remap static inline class funs as special builtins 2020-11-25 17:31:46 +03:00
Sergey Shanshin
f6c7372089 Fix serializing properties with custom accessors (#3907)
Fixes Kotlin/kotlinx.serialization#956
2020-11-25 17:06:10 +03:00
pyos
7327c20200 FIR: add a resolution mode for property delegates
Like function arguments, they are context-dependent, but unlike function
arguments, callable references should be resolved eagerly as if they are
explicit receivers.
2020-11-25 16:55:10 +03:00
Jinseong Jeon
0a5b899aab FIR: more comprehensive substitution of stub types after builder inference 2020-11-25 16:55:09 +03:00
Jinseong Jeon
30c97e6cb4 FIR: update unsubstituted return types in builder
#KT-43340 Fixed
2020-11-25 16:55:09 +03:00
Jinseong Jeon
d58e5b1d95 Remove unnecessary semi-colons 2020-11-25 16:55:09 +03:00
Jinseong Jeon
a0dd62f8c5 Remove unnecessary expression 2020-11-25 16:55:09 +03:00
Jinseong Jeon
dfc5059d6b FIR: reproduce KT-43340 2020-11-25 16:55:08 +03:00
Andrei Klunnyi
c13650fd79 KT-43511 [Gradle Runner]: run task is not created for top level modules 2020-11-25 11:10:22 +00:00
Vladimir Dolzhenko
25a631a1ca Improved IDE performance tests vega specs 2020-11-25 10:08:57 +01:00
Ilya Kirillov
dcdd69d039 Invalidate caches before resolve in AbstractPerformanceHighlightingTest 2020-11-25 09:18:19 +01:00
Victor Petukhov
04846ca47a Rework checking constraints by presented OnlyInputTypes annotation in accordance with changed incorporation mechanism 2020-11-25 11:15:23 +03:00
Victor Petukhov
0857b9c9e7 Rethink constraints incorporation
Namely, remove incorporation “otherInsideMyConstraint” to eliminate
constraint system redundancy and produce a potentially very large number
 of constructs.
Instead, introduce not so “spreadable” incorporation during variable
fixation (equality constraint with result type into other constraints).
^KT-41644 Fixed
^KT-42195 Fixed
^KT-42920 Fixed
^KT-42791 Fixed
^KT-41741 Fixed
2020-11-25 11:15:20 +03:00
Victor Petukhov
616e40f879 Reuse equality constraints during simplification in adding constraints 2020-11-25 11:15:19 +03:00
Ilmir Usmanov
aabe709079 Value classes: Add @JvmInline annotation to stdlib 2020-11-25 01:08:31 +01:00
Andrey Uskov
a7100134a0 Don't mark testJsTestOutputFileInProjectWithAndroid as flaky in 202 2020-11-24 23:05:55 +03:00
Mikhail Glukhikh
ee40b3a4a4 Drop redundant fields around AbstractFir2IrLazyFunction 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
fda5ee7d06 Fir2IrLazyPropertyAccessor: make inline iff FIR accessor is inline 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
d27a0c91f6 Extract AbstractFir2IrLazyFunction (base for accessor & simple function) 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
c03fa59a63 Introduce Fir2IrLazyPropertyAccessor 2020-11-24 17:50:12 +01:00
Alexander Udalov
7117932623 JVM IR: handle JvmStatic in object as module phase
This allows to get rid of the situation where a JvmStatic function in
object can be seen in different states in different lowerings: unlowered
with a dispatch receiver parameter, declaration is lowered but calls are
not, and both declaration and calls are lowered.

Now it works like this:
1) JvmStatic functions in objects coming from dependencies are always
   loaded as lowered, without the extra dispatch receiver parameter. In
   psi2ir this is done via JVM-specific extension; in fir2ir it's done
   in place (but probably should be extracted to extension too).
2) Functions from sources are created as unlowered by both psi2ir and
   fir2ir, and are lowered in a module-wide phase at the beginning of
   JvmLower.
3) Calls to all JvmStatic functions from objects (from sources and
   dependencies) are lowered in the same phase at the beginning of
   JvmLower.

This ensures that all lowerings after the module-wide phase
`jvmStaticInObjectPhase`, which include all per-file phases, see all
JvmStatic functions in objects without the additional dispatch receiver
parameter, and calls do not have dispatch receiver either.

The only issue with this approach is that function/property reference
representation in reflection needs to have that dispatch receiver
parameter, and that is achieved via a hack in those lowerings, which
seems not too out of place anyway, given that they're handled specially
in kotlin-reflect as well.
2020-11-24 17:50:11 +01:00
Alexander Udalov
0a00cbefaf JVM IR: minor, refactor replaceThisByStaticReference
Allow to replace "this" references not only inside IrBody, but inside
any IrElement. This will be useful in JvmStatic in object lowering where
we want not only to replace usages inside the function body, but also in
default values of its parameters.
2020-11-24 17:50:11 +01:00
Margarita Bobova
ebb545a9fb Split ChangeLog file to files by major releases 2020-11-24 18:46:44 +03:00
Margarita Bobova
71d3d8bffc Add ChangeLog for 1.4.20 2020-11-24 18:46:44 +03:00
Leonid Startsev
b1c355e7eb Directly search in IrClass for declarations to fill bodies with plugin
because some other compiler plugins (Compose) copy/rewrite IR declarations
completely, and in the end, functions that are present in the final IR tree
do not have bodies.

Correctly create IrProperty and IrField when they were absent from the
descriptors (in case for private serializer properties)

Do not use symbol table because 'declare' API is not available in plugins.

Fixes https://github.com/JetBrains/compose-jb/issues/46
2020-11-24 18:40:10 +03:00
Ilya Goncharov
5efefabb93 [JS IR] webpackConfigAppliers as internal to not break Gradle lambda serialization in some cases
[JS IR] Add synthetic config and webpack config is nested object

^KT-43535 fixed
2020-11-24 17:49:33 +03:00
Mikhael Bogdanov
42a9d64578 Track binary output class names 2020-11-24 15:20:12 +01:00
Mikhael Bogdanov
6748560184 Proper support of aggregated processors 2020-11-24 15:20:12 +01:00
Ilya Goncharov
f382a55b17 [JS IR] Add EXPECTED_REACHABLE_NODES for JS tests of external tail args 2020-11-24 16:34:27 +03:00
Sergey Shanshin
176071b7db Add support of nullable serializers to UseSerializers annotation (#3906)
Fixes Kotlin/kotlinx.serialization#984
2020-11-24 16:34:02 +03:00
sebastian.sellmair
6c7247cbd3 syncKotlinAndAndroidSourceSets: Don't register Kotlin source dirs in Android java source dirs 2020-11-24 13:16:11 +00:00
sebastian.sellmair
2286498d8d Share defaultSourceFolder logic between syncKotlinAndAndroidSourceSets.kt and KotlinSourceSetFactory.kt 2020-11-24 13:16:10 +00:00
sebastian.sellmair
7c7eada452 Add comment about unsupported associate compilations to functionalTest source files 2020-11-24 13:16:10 +00:00
sebastian.sellmair
3f98e2974c Expand AndroidSourceSet#kotlinSourceSet to AndroidSourceSet#kotlinSourceSetOrNull 2020-11-24 13:16:09 +00:00
sebastian.sellmair
3e5cbf324d syncKotlinAndAndroidSourceSets.kt: Cover flavors with tests 2020-11-24 13:16:09 +00:00
sebastian.sellmair
cdfbbca580 Also register shaders for kotlin source sets 2020-11-24 13:16:08 +00:00
sellmair
2c325c45e2 Register Kotlin MPP source sets in AGP
^KT-43391 fixed
2020-11-24 13:16:07 +00:00
Dmitry Petrov
3a166f3592 KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors 2020-11-24 16:06:20 +03:00
Alexander Udalov
ca78261d7f Minor, fix "unknown -Xstring-concat mode" error message 2020-11-24 11:50:31 +01:00
Alexander Udalov
ed481add08 Fix performance regression in KotlinSuppressCache.isSuppressedByAnnotated
After a seemingly innocent refactoring in 61548a0a36, we've lost the
optimization that was enabled by the suppressorAbove logic in
isSuppressedByAnnotated.
2020-11-24 11:49:31 +01:00
Ilya Goncharov
efee3ea648 [JS IR] - Remove file lowering declarations from lowering phases
- rename fileToPurenessInitializers onto fileToInitializerPureness
- remove redundant check on top-level property

[JS IR] Rename initialis* to initializ* for consistency

[JS IR] Move propertyLazyInitialization property to context from configuration

[JS IR] Add test on lazy initialization properties order

[JS IR] Add multi module for lazy initialization of properties

[JS IR] Move tests onto js.translator

[JS IR] Rename fileToInitializerPureness according to context name

^KT-43222 fixed
2020-11-24 12:33:44 +03:00
Ilya Goncharov
1b5ebd83de [JS IR] Lazy initialisation is optional for tests
^KT-43222 fixed
2020-11-24 12:33:43 +03:00
Ilya Goncharov
a2d41b86bf [JS IR] Add compiler argument about lazy initialisation
^KT-43222 fixed
2020-11-24 12:33:43 +03:00
Ilya Goncharov
fcb3ee5e45 [JS IR]Add check on pureness to not calculate fields to expression twice
^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
aa0f9dc1e2 [JS IR] Don't target exact wasm backend
^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
c224394dfc [JS IR] Return with createdOn hack
^KT-43222 fixed

[JS IR] Not create initialisation function for file if there were attempt to create it earlier

^KT-43222 fixed

[JS IR] Pureness for PIR and memoize file fields pureness

^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
8b4d42e70a [JS IR] Add initialisation call for functions in method
^KT-43222 fixed
2020-11-24 12:30:37 +03:00
Ilya Goncharov
06b276f9c3 [JS IR] Migrate on body lowering pass and declaration transformer
^KT-43222 fixed
2020-11-24 12:30:21 +03:00
Ilya Goncharov
99d0740234 [JS IR] Ignore JS_IR backend in top level side effect properties
^KT-43222 fixed
2020-11-24 12:30:04 +03:00
Ilya Goncharov
d6bc309c94 [JS IR] Eager initialisation for all pure properties
^KT-43222 fixed
2020-11-24 12:29:48 +03:00
Ilya Goncharov
3da9761f37 [JS IR] Add test on lazy initialisation
^KT-43222 fixed
2020-11-24 12:29:28 +03:00
Ilya Goncharov
f4c1e52338 [JS IR] Continuation parameter in main through accessor
^KT-43222 fixed
2020-11-24 12:29:11 +03:00
Ilya Goncharov
34ee146148 [JS IR] Internal visibility for init fun
^KT-43222 fixed
2020-11-24 12:28:57 +03:00
Ilya Goncharov
07b6ef65a3 [JS IR] Init delegated properties as usual
^KT-43222 fixed
2020-11-24 12:28:07 +03:00
Ilya Goncharov
841118a64d [JS IR] Add init properties call to top level functions
^KT-43222 fixed
2020-11-24 12:27:51 +03:00
Ilya Goncharov
5746a7c4fc [JS IR] Only consider top level properties
^KT-43222 fixed
2020-11-24 12:27:36 +03:00
Ilya Goncharov
0dc4f51d74 [JS IR] Add init function call into first step of property accessor
^KT-43222 fixed
2020-11-24 12:27:20 +03:00
Ilya Goncharov
71bfed3253 [JS IR] From searcher get only properties, mutate in lowering
^KT-43222 fixed
2020-11-24 12:27:04 +03:00
Ilya Goncharov
42e1a3280b [JS IR] Add guard into init properties function
^KT-43222 fixed
2020-11-24 12:25:38 +03:00
Ilya Goncharov
d752b7439e [JS IR] Add init function for properties
^KT-43222 fixed
2020-11-24 12:25:24 +03:00
Alexander Likhachev
003ea4bcdf [Gradle, MPP] Make metadata jar task cc-compatible with warnings
#KT-43329 Fixed
2020-11-24 11:33:20 +03:00
Shagen Ogandzhanian
3282e092d8 [JS] Don't fail on recursive upper bounds while resolving JsExports
Fixes https://youtrack.jetbrains.com/issue/KT-42112
2020-11-23 18:01:00 +01:00
Jinseong Jeon
f9a032dbfa FIR2IR: add AnnotationGenerator to Fir2IrComponents 2020-11-23 19:36:11 +03:00
Jinseong Jeon
eff4cec3e0 FIR2IR: convert annotations on delegated members 2020-11-23 19:36:10 +03:00
pyos
d980074624 FIR: deserialize the fun interface flag 2020-11-23 19:36:09 +03:00
pyos
20c7c4881d FIR: fix @JvmPackageName
A single `JvmGeneratorExtensions` instance should be passed around.
2020-11-23 19:36:08 +03:00
Shagen Ogandzhanian
2d4e9af289 [JS IR] Throw exception if test class or test method has explicit parameter
resolves https://youtrack.jetbrains.com/issue/KT-41032
2020-11-23 15:47:32 +01:00
Ilya Kirillov
c4a8d1c3a1 FIR: use java functional interface as a source of sam function call 2020-11-23 15:31:31 +01:00
Ilya Kirillov
7b1eef136e FIR IDE: introduce KtFirCollectionLiteralReference 2020-11-23 15:31:30 +01:00
Ilya Kirillov
bac5ebcb12 FIR IDE: use custom thread local value for storing KtFirScopeProvider
java.lang.ThreadLocal stores value maps in corresponding threads
which causes memory leaks
2020-11-23 15:31:29 +01:00
Ilya Kirillov
b31def0bae FIR IDE: invalidate analysis session on project roots change 2020-11-23 15:31:26 +01:00
Ilya Kirillov
be95d067f3 FIR IDE: add KotlinOutOfBlockPsiTreeChangePreprocessor 2020-11-23 15:31:24 +01:00
Ilya Kirillov
7a86ca632d FIR IDE: fix collecting diagnostics for anonymous object declaration 2020-11-23 15:31:20 +01:00
Ilya Kirillov
7061608567 FIR IDE: introduce common function to mute tests 2020-11-23 15:31:14 +01:00
Ilya Kirillov
e4d2e38ea2 FIR IDE: fix reference resolving of qualified expression with nested classes 2020-11-23 15:31:11 +01:00
Ilya Kirillov
164f4d14d7 FIR IDE: do not collect diagnostics for generated declarations 2020-11-23 15:31:08 +01:00
Ilya Kirillov
60cc30286c FIR IDE: update file structure testdata after structure elements classes rename 2020-11-23 15:31:05 +01:00
Ilya Kirillov
75990f7619 FIR IDE: fix tesdata 2020-11-23 15:31:02 +01:00
Ilya Kirillov
7320620285 FIR IDE: add local visibility to symbols 2020-11-23 15:30:58 +01:00
Ilya Kirillov
5fdcc4bb83 FIR IDE: refactor KotlinFirModificationTrackerService 2020-11-23 15:30:55 +01:00
Ilya Kirillov
112f6771eb FIR IDE: fix compilation 2020-11-23 15:30:51 +01:00
Ilya Kirillov
65b5e4b62b FIR IDE: make some session components to be non-thread local
To avoid memory leaks
2020-11-23 15:30:47 +01:00
Ilya Kirillov
c3caa3a137 FIR IDE: clean AbstractFirReferenceResolveTest 2020-11-23 15:30:42 +01:00
Ilya Kirillov
3174eb4b09 FIR IDE: do not get ktDeclaration for FirFile 2020-11-23 15:30:39 +01:00
Ilya Kirillov
ff7857a812 FIR IDE: refactor, simplify structure element class names 2020-11-23 15:30:37 +01:00
Ilya Kirillov
15277c0974 FIR IDE: introduce memory leak checking in symbols test 2020-11-23 15:30:36 +01:00
Ilya Kirillov
11e94c1de1 FIR IDE: fix building of local declaration symbols 2020-11-23 15:30:29 +01:00
Ilya Kirillov
e78e26234b FIR IDE: do not store cone session in every KtFirType 2020-11-23 15:30:24 +01:00
Ilya Kirillov
e54d16e7e4 FIR IDE: fix fir declaration leak in symbols 2020-11-23 15:30:20 +01:00
Ilya Kirillov
b01ee163d1 FIR IDE: wrap KotlinDeserializedJvmSymbolsProvider into thread safe cache
This is needed by the two reasons:
- KotlinDeserializedJvmSymbolsProvider does not cache all symbols by itself
and as KtSymbol's holds fir elements under via weak refs, this weak refs
may be garbage collected
- KotlinDeserializedJvmSymbolsProvider is not thread safe
2020-11-23 15:30:17 +01:00
Ilya Kirillov
911662bc2f FIR IDE: introduce out of block modification tracker tests 2020-11-23 15:30:14 +01:00
Ilya Kirillov
da7b12f7e1 FIR IDE: introduce ProjectWideOutOfBlockKotlinModificationTrackerTest 2020-11-23 15:30:12 +01:00
Ilya Kirillov
880e76b203 FIR IDE: introduce FIR IDE specific out of block modification tracker 2020-11-23 15:30:07 +01:00
Ilya Kirillov
6c1faec171 FIR IDE: introduce file structure tests 2020-11-23 15:30:05 +01:00
Ilya Kirillov
7c912cd3e4 FIR IDE: introduce FileElementFactory 2020-11-23 15:30:02 +01:00
Ilya Kirillov
315629c99b FIR IDE: refactor lock provider 2020-11-23 15:29:59 +01:00
Ilya Kirillov
559b07d78a FIR IDE: fix memory leak in scope provider 2020-11-23 15:29:58 +01:00
Ilya Goncharov
64895fe7da [JS IR] Test with js specific moved to js.translator
- Move js function from `main` to separate js file

^KT-40090 fixed
2020-11-23 16:05:33 +03:00
Ilya Goncharov
fe3030c432 [JS IR] Drop last null arguments in calls of external functions
^KT-40090 fixed
2020-11-23 16:05:19 +03:00
Ilya Goncharov
5c731c6c04 [JS IR] Add test in external js fun with default args
^KT-40090 fixed
2020-11-23 16:05:02 +03:00
Jinseong Jeon
8eb2ae18dc FIR checker: refactor EventOccurrencesRange accumulation 2020-11-23 14:54:19 +03:00
Jinseong Jeon
b9d3578a86 FIR checker: refactor ControlFlowInfos whose key is EdgeLabel 2020-11-23 14:54:19 +03:00
Jinseong Jeon
b6a4c279a4 FIR checker: refactor ControlFlowInfos whose value is EventOccurrencesRange 2020-11-23 14:54:19 +03:00
Jinseong Jeon
cf8f5b0912 FIR checker: make calls effect analyzer path-sensitive 2020-11-23 14:54:18 +03:00
Dmitry Petrov
2662679579 KT-43399 properly erase extension receiver type in property$annotations 2020-11-23 13:58:52 +03:00
Dmitry Petrov
551d0c1b64 JVM_IR KT-43440 private-to-this default interface funs are private 2020-11-23 13:56:17 +03:00
Dmitry Petrov
bf7fdcda6e KT-42909 fix missing loop variable in 'withIndex' ranges 2020-11-23 13:56:17 +03:00
Ilya Matveev
a9c9406a55 [Gradle, K/N] Set LIBCLANG_DISABLE_CRASH_RECOVERY=1 for cinterop
Issue #KT-42485 Fixed
2020-11-23 10:49:12 +00:00
Alexander Anisimov
37197a95cd Update ReadMe.md 2020-11-23 13:14:26 +03:00
Kristoffer Andersen
18612c1ef0 [JVM+IR] Rebase LVT test of destructuing in lambda params
The debug experiece of destructuring patterns in lambdas is different
across the two backends due to the IR backend moving local variables
to fields.

However, since the destructuring variable is never actually visible in
the debugger (no linenumbers in the live range of the variable), and
the variable is never used for anything other than hiding it from the
debugger, we propose that it is not actually necessary to include it
in the LVT (and in fact, could be left out of the LVT on the old
backend).
2020-11-23 10:54:04 +01:00
Ivan Gavrilovic
ccc272c49f KT-43489: KGP - Avoid storing build history mapping in a property
If tasks are created eagerly, it is possible for this
mapping to be initalized too early. This causes incremental
compilation to fail, as it will contain mappings only for
projects that have been evaluated thus far.

Fixes KT-43489
2020-11-23 11:45:46 +03:00
Alexander Anisimov
2c28e6556b Add JetBrains to the first part of text 2020-11-23 11:14:52 +03:00
Hollow Man
926dc085da Fix typo
inferrred -> inferred
2020-11-21 14:00:28 +01:00
Vyacheslav Gerasimov
3351887ae5 Build: Upgrade GE plugin to 3.5 2020-11-20 20:15:27 +03:00
LepilkinaElena
dd9c0c5c6e Use separate logic for filtering and skipping in collectAndFilterRealOverrides [KT-43487] (#3921) 2020-11-20 19:10:41 +03:00
Alexander Udalov
362775b6b6 JVM IR: minor, improve exception message 2020-11-20 12:43:47 +01:00
Dmitry Petrov
b495fd542f JVM, JVM_IR: KT-42281 proper array->primitive coercion 2020-11-20 14:33:20 +03:00
Dmitry Petrov
e59c8e0a5c JVM_IR KT-42137 bridges are not generated for fake overrides 2020-11-20 14:33:20 +03:00
Roman Artemev
5d5473ef08 [IR BE] Drop unused context member 2020-11-20 12:04:18 +03:00
Roman Artemev
51cff97b78 [JS IR BE] Drop implicit declaration file 2020-11-20 12:03:05 +03:00
Jinseong Jeon
67604551c5 FIR: reuse visibility checker when determining immutable property reference 2020-11-20 10:48:13 +03:00
Jinseong Jeon
463d53ee5c FIR: handle reference to property with invisible setter 2020-11-20 10:48:13 +03:00
Ilya Gorbunov
b2b2629e79 Use new kotlin.io.path API in tests 2020-11-20 09:03:25 +03:00
Ilya Gorbunov
d38e145529 Use new kotlin.io.path API in generators 2020-11-20 09:03:13 +03:00
Ilya Gorbunov
dce3e57685 Use NIO Files for creating temp files: idea plugin 2020-11-20 06:09:37 +03:00
Ilya Gorbunov
090b562db7 Use NIO Files for creating temp files: scripting, daemon, main-kts 2020-11-20 06:09:37 +03:00
Ilya Gorbunov
c9bbdf6575 Use NIO Files for creating temp files: build tools 2020-11-20 06:09:36 +03:00
Nikolay Krasko
30bb7d19c0 Revert "Build: Temporary disable capturing inputs for tasks"
Now GE server is updated and should process scans with inputs faster.

This reverts commit e331e80b
2020-11-19 23:59:16 +03:00
Nikolay Krasko
e8af601cea Mute very flaky FirPsiCheckerTestGenerated.Regression.testJet53
A very probable failure that can be reproduced locally:

```
ERROR: While resolving call checkSubtype#<R|kotlin/collections/List<kotlin/Int>?|>(Collections#.emptyList#<R|kotlin/Int|>())
java.lang.RuntimeException: While resolving call checkSubtype#<R|kotlin/collections/List<kotlin/Int>?|>(Collections#.emptyList#<R|kotlin/Int|>())
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer.transformFunctionCall(FirExpressionsResolveTransformer.kt:282)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFunctionCall(FirBodyResolveTransformer.kt:114)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFunctionCall(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFunctionCall(FirTransformer.kt:957)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFunctionCall(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.expressions.FirFunctionCall.accept(FirFunctionCall.kt:31)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.visitors.FirTransformerUtilKt.transformSingle(FirTransformerUtil.kt:12)
	at org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl.transformInitializer(FirPropertyImpl.kt:104)
	at org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl.transformInitializer(FirPropertyImpl.kt:34)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.transformChildrenWithoutAccessors(FirDeclarationsResolveTransformer.kt:278)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.access$transformChildrenWithoutAccessors(FirDeclarationsResolveTransformer.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.transformProperty(FirDeclarationsResolveTransformer.kt:132)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformProperty(FirBodyResolveTransformer.kt:254)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.access$transformProperty$s1271549241(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer$transformProperty$1.invoke(FirImplicitBodyResolve.kt:143)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer$transformProperty$1.invoke(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.computeCachedTransformationResult(FirImplicitBodyResolve.kt:169)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.transformProperty(FirImplicitBodyResolve.kt:142)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.transformProperty(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitProperty(FirTransformer.kt:753)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitProperty(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirProperty.accept(FirProperty.kt:53)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.visitNoTransform(FirBodyResolveTransformer.kt:358)
	at org.jetbrains.kotlin.idea.fir.low.level.api.trasformers.FirDesignatedImplicitTypesTransformerForIDE.transformDeclarationContent(FirDesignatedImplicitTypesTransformerForIDE.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:66)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:801)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirFile.accept(FirFile.kt:32)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.visitNoTransform(FirBodyResolveTransformer.kt:358)
	at org.jetbrains.kotlin.idea.fir.low.level.api.trasformers.FirDesignatedImplicitTypesTransformerForIDE.transformDeclarationContent(FirDesignatedImplicitTypesTransformerForIDE.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:66)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:801)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirFile.accept(FirFile.kt:32)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver$runLazyResolvePhase$$inlined$runPhaseWithCustomResolve$3.run(utils.kt:82)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:188)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.runLazyResolvePhase(FirLazyDeclarationResolver.kt:246)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.runLazyResolveWithoutLock(FirLazyDeclarationResolver.kt:127)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.lazyResolveDeclaration(FirLazyDeclarationResolver.kt:63)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.lazyResolveDeclaration$default(FirLazyDeclarationResolver.kt:39)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.createDeclarationStructure(FileStructure.kt:131)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.createStructureElement(FileStructure.kt:171)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.access$createStructureElement(FileStructure.kt:29)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure$getStructureElementForDeclaration$structureElement$1.apply(FileStructure.kt:48)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure$getStructureElementForDeclaration$structureElement$1.apply(FileStructure.kt:29)
	at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getStructureElementForDeclaration(FileStructure.kt:46)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getStructureElementFor(FileStructure.kt:42)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getAllDiagnosticsForFile(FileStructure.kt:71)
	at org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.DiagnosticsCollector.collectDiagnosticsForFile(DiagnosticsCollector.kt:27)
	at org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl.collectDiagnosticsForFile$idea_fir_low_level_api(FirModuleResolveStateImpl.kt:63)
	at org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade.collectDiagnosticsForFile(LowLevelFirApiFacade.kt:93)
	at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirDiagnosticProvider.collectDiagnosticsForFile(KtFirDiagnosticProvider.kt:26)
	at org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.collectDiagnosticsForFile(KtAnalysisSession.kt:63)
	at org.jetbrains.kotlin.idea.fir.highlighter.KotlinHighLevelDiagnosticHighlightingPass.doCollectInformation(KotlinHighLevelDiagnosticHighlightingPass.kt:36)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:52)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:442)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:435)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:434)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:410)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:168)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:168)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:408)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:171)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:163)
```
2020-11-19 23:58:02 +03:00
Steven Schäfer
7bfe2c0bbc JVM IR: Update test expectation for testSamAdapterAndInlineOnce
...and remove redundant bytecode text tests.
2020-11-19 19:46:49 +01:00
Steven Schäfer
8574cb4466 JVM IR: Don't generate line numbers and null checks in SAM wrapper constructors 2020-11-19 19:46:49 +01:00
Steven Schäfer
68e2d0d245 JVM IR: Generate synthetic final implementation methods in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer
a475fa2a21 JVM IR: Use raw types in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer
999151abac JVM IR: Generate SAM wrapper fields as synthetic final 2020-11-19 19:46:49 +01:00
Steven Schäfer
ec1d42e92b JVM IR: Generate SAM wrapper classes as non-synthetic 2020-11-19 19:46:49 +01:00
Steven Schäfer
36711a768b JVM IR: Use inline SAM wrappers inside of inline lambdas 2020-11-19 19:46:49 +01:00
Alexander Udalov
f2b8c67962 Fix JvmTarget6OnJvm11 tests after 7b5544ebd3 2020-11-19 18:49:55 +01:00
Ilmir Usmanov
c22071566e IC mangling: Use old mangling scheme when LV is 1.3
Add integration test to check, that nothing is broken with LV 1.3.
2020-11-19 17:39:34 +01:00
Ilmir Usmanov
7ee35af721 IC mangling: Use correct mangling scheme when
checking for duplicate signatures.
2020-11-19 17:39:33 +01:00
Ilmir Usmanov
7761d30365 Minor. Add test to check fallback 2020-11-19 17:39:33 +01:00
Ilmir Usmanov
7a18ab9094 IC mangling: Generate version requirements to properties as well
Generate the requirements at JVM only.
2020-11-19 17:39:32 +01:00
Ilmir Usmanov
0d79ed1077 Minor. Update test data 2020-11-19 17:39:32 +01:00
Ilmir Usmanov
9070d6d581 IC mangling: Use old mangling scheme in stdlib 2020-11-19 17:39:31 +01:00
Ilmir Usmanov
89d45bf909 IC mangling: Use old mangling scheme in FIR tests
instead of ignoring them.
This affects all unsigned tests.
2020-11-19 17:39:31 +01:00
Ilmir Usmanov
2cd9016016 IC mangling: Replace compiler hack with configuration flag 2020-11-19 17:39:30 +01:00
Ilmir Usmanov
bc1b6fef1f IC mangling: Generalize mangling algorithm between two backends 2020-11-19 17:39:29 +01:00
Ilmir Usmanov
b33774e5f2 IC mangling: Use empty list as a separator in the new mangling scheme 2020-11-19 17:39:28 +01:00
Ilmir Usmanov
20e7a77b78 IC mangling: Write version 1.4.30 requirement to functions with new mangling 2020-11-19 17:39:28 +01:00
Ilmir Usmanov
2829d37cf5 IC mangling: Use old mangling scheme for stdlib
This way, new stdlib can still be usable in 1.4.20
2020-11-19 17:39:27 +01:00
Ilmir Usmanov
488d4ab018 IC mangling: Use '_' instead of 'x' as a placeholder before hashing 2020-11-19 17:39:27 +01:00
Ilmir Usmanov
f7164404c9 IC mangling: Ignore FIR tests 2020-11-19 17:39:26 +01:00
Ilmir Usmanov
23184bae05 IC mangling: JVM_IR: Fallback to old mangling rules
if classfile does not contain functions mangled in the new way.
2020-11-19 17:39:26 +01:00
Ilmir Usmanov
546eea1982 IC mangling: Old JVM BE: Fallback to old mangling rules
if classfile does not contain functions mangled in the new way.
2020-11-19 17:39:25 +01:00
Ilmir Usmanov
c62093f54c IC mangling: Change mangling rules
1. Use 'x' for each parameter, which is not an inline class, every
possible clash is handled by signature rather than name. This change
makes more API changes binary-compatible. So, the changes are in line
with the vision of inline classes are value classes, like primitives.

2. Take return type into account when mangling a function if the return
type is inline class. Otherwise, boxing bridge will not be generated,
which leads to CCE at runtime.
2020-11-19 17:39:24 +01:00
Alexander Udalov
d21a01ef59 IR: improve "no such .. argument slot" exception message
Include the symbol signature, if it's available.
2020-11-19 16:34:03 +01:00
Kirill Shmakov
8ede19811d Make mpp tests gutters aware of different platforms run
Behaviour is similar to the test suite gutters:
- simple triangle when there is no history
- triangle + red circle if some runs failed
- triangle + green circle if all runs passed

^KMM-100 Fixed.
2020-11-19 17:20:06 +03:00
Dmitriy Dolovov
0d50ccc42d [Commonizer] Fix: Lost nullability in commonized type aliases 2020-11-19 16:47:24 +03:00
Dmitry Petrov
e17158d961 JVM_IR KT-42758 don't use 'this' for object self-reference by name 2020-11-19 16:34:04 +03:00
Dmitry Petrov
118a7d4e34 JVM_IR KT-43242 generate switch subject as primitive 'int' 2020-11-19 16:34:04 +03:00
Andrei Klunnyi
05ddbeab0a KT-42561 [Gradle Runner]: run task is created for extra modules
Approach to take classpath from 'project.sourceSets' failed because it
was applied to extra modules - those without java like plugins
(extending project model with 'sourceSets').

This commit specifies criterion of gradle-project selection - the one to
create run task for.
    
^KT-42561 fixed
2020-11-19 12:47:39 +00:00
LepilkinaElena
b0c74c841e Remove extra copyOf calls during filtering in collectRealOverrides (#3916) 2020-11-19 09:53:25 +03:00
Alexander Udalov
7b5544ebd3 Use -source/target 1.6 for Java sources in codegen tests
In cases when the test has the JVM_TARGET directive, use that one for
Java compilation as well.

Otherwise, for box tests, the corresponding test in `JvmTarget6OnJvm6`
(module `:compiler:tests-different-jdk`) will fail. However, it affects
all codegen tests, so fix a bunch of them which use Java 8+ features to
explicitly compile with JVM target 1.8. In particular, this obsoletes
the SKIP_JDK6 directive in those tests because "JVM_TARGET: 1.8" also
skips it for JDK 6.

The check for IS_SOURCE_6_STILL_SUPPORTED is needed in order to still be
able to run tests in the project while only having a single JDK > 11
installed, and having all of the env vars JDK_16, JDK_17, JDK_18
pointing to that JDK.
2020-11-18 18:43:43 +01:00
Mads Ager
7b4e0b2f5d [JVM_IR] Deal with lowering ordering issues for JvmStatic function references.
Do not destructively update the @JvmStatic function, instead
create a copy on first access, and replace the original with
the copy in the jvm static lowering. This ensures that the original
function is seen in other lowerings independently of file lowering
order.
2020-11-18 17:13:00 +01:00
Dmitry Petrov
3d2f5f4bc1 KT-42018 explicitly cast inline class values in safe-as 2020-11-18 18:51:15 +03:00
Kristoffer Andersen
edd3b457d4 [JVM+IR] Migrate/improve receiver mangling test suite 2020-11-18 15:18:10 +01:00
Kristoffer Andersen
5967e8295e [IR] Align captured receiver variable naming with old BE 2020-11-18 15:18:10 +01:00
Vladimir Dolzhenko
7732fc38e0 Add more IDE performance tests vega chart specs 2020-11-18 14:31:56 +01:00
Mikhail Glukhikh
bcf6980f67 [FIR2IR] Fix CCE in FirTypeRef.canBeNull 2020-11-18 16:26:13 +03:00
Mikhail Glukhikh
91738b7f88 [FIR] Fix broken IDE test data 2020-11-18 16:05:50 +03:00
Dmitry Petrov
ca41f733b6 KT-41841 no delegate to private $default fun in multifile facade 2020-11-18 15:04:39 +03:00
Jinseong Jeon
9a99af53ba FIR JVM: correct signature conversion for array
#KT-43339 Fixed
2020-11-18 13:06:51 +03:00
Jinseong Jeon
77ce5ea15d FIR Java: handle primitive void return type for synthetic setter 2020-11-18 13:06:50 +03:00
Jinseong Jeon
5c61079d75 FIR: reproduce KT-43339 (Throwable.stackTrace) 2020-11-18 13:06:49 +03:00
Jinseong Jeon
4cb32cd38a FIR2IR: add implicit NOT_NULL cast for @FlexibleNullability type 2020-11-18 13:06:48 +03:00
Mikhail Glukhikh
b658e99f91 FIR Java: simplify flexible nullability manipulations 2020-11-18 13:06:47 +03:00
Jinseong Jeon
fc7f589caa FIR Java: record Java types with flexible nullability 2020-11-18 13:06:46 +03:00
Jinseong Jeon
1f48092ec1 FIR Java: convert more annotations to @EnhancedNullability 2020-11-18 13:06:45 +03:00
Alexander Gorshenev
01ef41ab17 No need to explicitly deprecate -Xdisable-fake-override-validator
A warning is produced automagically
2020-11-18 12:46:40 +03:00
Alexander Gorshenev
f42b902bc8 Made -Xfake-override-validator off by default
Deprected -Xdisable-fake-override-validator
2020-11-18 12:46:40 +03:00
Steven Schäfer
4e03b1e05f JVM: Allow the JvmSynthetic annotation on file classes (KT-41884) 2020-11-17 22:06:19 +01:00
Dmitriy Dolovov
66bc142f92 [Commonizer] Empty sources/javadocs Jars 2020-11-17 19:02:18 +03:00
Dmitry Petrov
a27c6b77cf KT-43370 ACC_DEPRECATED on property accessors implemented by delegation 2020-11-17 18:16:37 +03:00
Dmitriy Novozhilov
986bdd1099 Build: replace usages of kotlin.build.useIR with kotlinBuildProperties.useIR 2020-11-17 18:14:09 +03:00
Dmitriy Novozhilov
c625a83ab5 Build: replace usages of idea.fir.plugin with kotlinBuildProperties.useFirIdeaPlugin 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
1a3727a17c Build: advance kotlin-build-gradle-plugin version in build files 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
f531612aa4 Build: update kotlin-build-gradle-plugin version 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
bab08c29be Build: add several FIR flags to kotlin-build-gradle-plugin 2020-11-17 18:14:08 +03:00
Alexander Udalov
8160f579d3 Build: add useIR/useIRForLibraries to kotlin-build-gradle-plugin 2020-11-17 18:14:07 +03:00
Nikolay Krasko
e331e80b5d Build: Temporary disable capturing inputs for tasks
We are suffering from the increasing build scan queue. Try to help
the server to overcome it.
2020-11-17 15:08:44 +03:00
Ivan Gavrilovic
33a0ec9b4f KGP: Clean up configurations setup
KAPT classpath now uses extendsFrom in order to
resolve all configurations as a single graph.

Also, use Configuration.extendsFrom instead of
DependencyHandler.add that is being deprecated
in Gradle 6.7.
2020-11-17 10:44:15 +03:00
Ivan Gavrilovic
519aeeb644 KT-40140: Task configuration avoidance for Android projects
When adding Java sources to Kotlin task, avoid
force-configuring source-generating tasks in AGP.

Fixes https://youtrack.jetbrains.com/issue/KT-40140.

Test: ConfigurationAvoidanceIT.testAndroidUnrelatedTaskNotConfigured
2020-11-17 10:43:48 +03:00
Yan Zhulanow
d376585821 IDE dependencies: Publish kotlin-coroutines-experimental-compat library 2020-11-17 10:29:21 +03:00
Vyacheslav Gerasimov
d7474bb2f7 Build: Use only @Exported & whitelisted classes for tools.jar api
This makes it stable between JDK vendors and versions
2020-11-17 01:21:00 +03:00
Alexander Likhachev
ac851523d8 [Gradle, MPP] Make KotlinCompileCommon task cc-compatible with warnings
Kotlin options are accessed via compilation. Compilation field is marked as transient and so not available after deserializing task from Gradle configuration cache.
Accessing 'isCompatibilityMetadataVariantEnabled' property via project in tasks 'onlyIf' causes Gradle to project instance serialization attempt that fails
(#KT-43141, #KT-43329) Fixed
2020-11-17 00:52:30 +03:00
Denis Zharkov
c6f46598ca Set TARGET_BACKEND to JVM for failing irrelevant tests 2020-11-16 22:20:44 +03:00
Martin Petrov
68fdeaf865 Produce deterministic jar files.
This resets all timestamps present in jars produced by kotlinc.

This is important for build systems like bazel that rely on
deterministic outputs.

Before:

```
$ kotlinc ~/test.kt -d /tmp/a.jar
$ kotlinc ~/test.kt -d /tmp/b.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/a.jar
1ba022697317f796bd123fb4dc95418a18bcb51a  /tmp/a.jar
6d2a2683470c24928f3fbd6768a4c57f55b0d196  /tmp/b.jar
$ unzip -l /tmp/a.jar
Archive:  /tmp/a.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
       75  09-25-2020 16:48   META-INF/MANIFEST.MF
      683  09-25-2020 16:48   TestKt.class
       28  09-25-2020 16:48   META-INF/main.kotlin_module
---------                     -------
      786                     3 files
```

After:

```
$ kotlinc ~/test.kt -d /tmp/a.jar
$ kotlinc ~/test.kt -d /tmp/b.jar
$ shasum /tmp/a.jar /tmp/b.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/a.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/b.jar
$ unzip -l /tmp/a.jar
Archive:  /tmp/a.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
       75  12-31-1969 19:00   META-INF/MANIFEST.MF
      590  12-31-1969 19:00   TestKt.class
       36  12-31-1969 19:00   META-INF/main.kotlin_module
---------                     -------
      701                     3 files
```

See https://github.com/JetBrains/kotlin/pull/3226 for a similar change.
2020-11-16 19:25:20 +01:00
Alexander Udalov
a3830b2611 JVM IR: copy corresponding property+annotations for DefaultImpls methods
Instead of using methodSignatureMapper which was an obsolete hack to
make accessor names "getFoo" instead of "<get-foo>".

In particular, this keeps the `@Deprecated` annotation on the
corresponding property, which results in ACC_DEPRECATED in codegen.

 #KT-43326 Fixed
2020-11-16 19:15:49 +01:00
Alexander Udalov
5212ae6bbd JVM IR: keep property annotations for inline class replacements
In particular, `@Deprecated` is not lost anymore and accessors of
deprecated property are generated with ACC_DEPRECATED just as in the old
backend.

 #KT-43327 Fixed
2020-11-16 19:15:49 +01:00
Alexander Udalov
4ca60a2d7d Fix warnings and some inspections in buildSrc 2020-11-16 19:15:43 +01:00
Denis Zharkov
22109e97d6 FIR: Unmute passing FirPsiCheckerTestGenerated.testJet53 2020-11-16 15:50:39 +03:00
Denis Zharkov
14305d1eba FIR: Simplify callable references resolution
Also that fixes some bugs
2020-11-16 15:50:39 +03:00
Denis Zharkov
387fd895a6 FIR: Drop unused FirComposedSuperTypeRef 2020-11-16 15:50:39 +03:00
Denis Zharkov
ad35723f56 FIR: Simplify super-qualified calls resolution 2020-11-16 15:50:39 +03:00
Denis Zharkov
d4c7d4fc7c FIR: Fix callable references resolution with stub receivers
Use stubReceiver as a receiver for fake calls

See issues KT-43358 KT-43359 KT-43378
2020-11-16 15:50:39 +03:00
Denis Zharkov
f97cc0b62d FIR: Rework receivers processing in resolution
- Put extensionReceiver to candidate even if it's explicit (for sake of clarity)
- Split CheckReceiver (dispatch part should only check nullability)
2020-11-16 15:50:39 +03:00
Denis Zharkov
e2099a0307 FIR: Fix false-positive successful resolution of call with lambda receiver
Do not try to integrate/postpone receiver expression to the base system
Receiver should be resolved independently anyway
2020-11-16 15:50:39 +03:00
Denis Zharkov
396e799e5d FIR: Fix resolution for type-alias based SAM 2020-11-16 15:50:39 +03:00
Denis Zharkov
4c9a4548f2 FIR: Fix overrides binding for Java inheritor
`overriddenMembers` contract requires original (non-enhanced) function
See other usages

Ignored tests have been working accidentally

^KT-43289 Open
2020-11-16 15:50:39 +03:00
Denis Zharkov
855af08f7c Regenerate tests 2020-11-16 15:50:39 +03:00
Mikhail Glukhikh
4f7b45dfcc Fir2IrTypeConverter: simplify captured type cache 2020-11-16 15:14:26 +03:00
Jinseong Jeon
cb77b76c0d FIR2IR: convert recursive captured type properly
#KT-43346 Fixed
2020-11-16 15:14:24 +03:00
Mikhail Glukhikh
8ecf056927 [FIR2IR] Enter scope a bit earlier in createIrPropertyAccessor 2020-11-16 14:44:43 +03:00
Mikhail Glukhikh
59c86bcdc4 [FIR2IR] Provide more information for errors inside convertToIrSetCall 2020-11-16 14:44:42 +03:00
Mikhail Glukhikh
9de244515e Upgrade coroutines: 1.3.7 -> 1.3.8 2020-11-16 14:29:58 +03:00
Dmitry Petrov
93f868fb96 KT-43196 member extension property can't be "primary" in inline class 2020-11-16 13:54:19 +03:00
Vladimir Dolzhenko
b6f958f856 Do not queue bg task under read action
Relates to #EA-218701
2020-11-16 09:25:08 +00:00
Dmitriy Dolovov
6e7b5a55b3 kotlinx-metadata: Don't write flags for absent property accessors 2020-11-13 22:54:34 +03:00
Dmitriy Novozhilov
a6cbae9719 [FIR] Rename FirErrors.SYNTAX_ERROR to SYNTAX 2020-11-13 16:19:30 +03:00
Dmitriy Novozhilov
2f5b231d50 [FIR] Add default renderers to FirDiagnosticFactories 2020-11-13 16:19:30 +03:00
Dmitriy Novozhilov
dc662efcf4 [FIR] Introduce FirDiagnosticRenderers 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
ed0e5adce7 [FIR] Make FirAnalyzerFacade returns diagnostics grouped by fir file 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
dabc259ae8 [FIR] Make diagnostics collectors returns List instead of Iterable 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
20453bf0d8 [FIR] Get rid of FirSessionProvider.project property 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
82a2ecfe14 [FIR] Cleanup creating sessions in CLI FIR compiler 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
3aa8b09e31 [FIR] Add configurable language version settings to FirSessionFactories 2020-11-13 16:19:29 +03:00
Dmitry Petrov
5d76df6e1a KT-43045 mangle function name for fake override with default impl 2020-11-13 16:15:29 +03:00
Mads Ager
1ecf5943ab [JVM_IR] Determine correct type of empty varargs array.
When calling vararg methods with a generic vararg type without
passing explicit parameters, we have to allocate an empty array
of the right type. We failed to do so previously, as we did
not take the type arguments for the dispatch receiver into
account.
2020-11-13 12:13:53 +01:00
Georgy Bronnikov
ffc003c051 IR: copy IrProperty's attributes in deepCopyWithSymbols 2020-11-13 11:44:35 +03:00
Yan Zhulanow
7b98876475 Parcelize: Fix typo in diagnostic message (KT-43290) 2020-11-13 17:37:21 +09:00
Dmitriy Novozhilov
e3bfb9245c [FIR] Rename nested directory with testdata to innerClasses
This is needed to avoid clashing name of generated test class (`Nested`)
  with annotation @Nested from JUnit 5
2020-11-13 10:36:39 +03:00
Dmitriy Novozhilov
419f54259c [TEST] Change semantics of CHECK_TYPE directive and update testdata
Previously helpers from checkType.kt was in special package, and
  if directive was enabled then test runner (`AbstractDiagnosticTest`)
  injected additional imports to test files and removed them after test
  was completed.
It's very hard to support such behavior in new test infrastructure so
  there was a decision about changing `CHECK_TYPE`:
1. All helpers from `checkType.kt` now stays in default package
2. `CHECK_TYPE` only adds `checkType.kt` to set of analyzed files
      and don't modify their content

For test which are written in default package (most of tests actually)
  there are no changes. On the other hand if there is a test where dev
  want to use checkType functions in testfile with some package then he
  should explicitly import functions which he needed (`checkSubtype`,
  `checkType`, `_`)
2020-11-13 10:36:12 +03:00
Dmitry Petrov
653b26174b KT-43006 don't generate no-arg constructor with inline class parameters 2020-11-13 09:59:34 +03:00
Georgy Bronnikov
364773bf0f IR: fix IrClassSymbol.starProjectedType 2020-11-12 21:49:11 +03:00
Dmitriy Dolovov
f5329b6f1d [Commonizer] Don't publish sources and javadocs 2020-11-12 17:23:52 +03:00
Dmitriy Novozhilov
15cc979378 [FIR] Add enter contract node as exit for exceptional path to avoid compiler crashing
This fixes crashing test
 `FirDiagnosticsTestSpecGenerated.NotLinked.Contracts.Declarations.ContractBuilder.Common.Neg.test17`
2020-11-12 14:46:39 +03:00
Dmitriy Novozhilov
87380d1913 [FIR] Don't assume that exit lambda node is target for exceptional exit for inplace lambdas
#KT-39709 Fixed
#KT-43156 Fixed
2020-11-12 14:46:38 +03:00
Jinseong Jeon
440cf78884 FIR CFG: add more uncaught exception paths 2020-11-12 14:46:37 +03:00
Jinseong Jeon
7b06885348 FIR checker: reproduce KT-43156 2020-11-12 14:46:36 +03:00
Dmitriy Novozhilov
f4347a60c2 [FIR] Fix typo 2020-11-12 14:46:35 +03:00
Mikhail Glukhikh
3c48f2eb68 [FIR] Handle isProp/setProp synthetic pair properly in Java use-site scope 2020-11-12 13:37:38 +03:00
Mikhail Glukhikh
2725930460 [FIR] Code cleanup in JavaClassUseSiteMemberScope 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
fb961f7070 [FIR] Copy also synthetic setter during fake override generation 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
22fb620344 [FIR Java] Copy also synthetic setter during enhancement 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
e0abf3a62c [FIR Java] More precise synthetic setter search in use-site scope
In this commit we detect both Java void & Kotlin Unit return types
2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
c515af4373 Fir2IrDeclarationStorage: extract common getIrCallableSymbol 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
b90391ced4 [FIR2IR] Implement getIrConstructorSymbol like getIrFunctionSymbol 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
0cc57fc90c Fir2IrDeclarationStorage: reorder functions slightly 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
90f135dc3e [FIR2IR] Use computeDeclarationOrigin in getIrPropertySymbol 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
6c1f5a4513 [FIR2IR] Cache functions/properties both by symbol & signature 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
92840b8ec5 FirTypeIntersectionScope: fix typo in name 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
5b947144d4 FirTypeIntersectionScope: don't create in no-supertypes situation 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
8ace0d9ad1 [FIR] Replace local types with Any in deserializer 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
744918fb47 [FIR] Cleanup ConeIntegerLiteralTypeImpl 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
0d03e5f235 [FIR] Simplify constructStarProjectedType 2020-11-12 13:37:34 +03:00
Mikhail Glukhikh
af52232058 [FIR2IR] Use proper lookup tags in data class member generator 2020-11-12 13:37:34 +03:00
Mikhail Glukhikh
7905bc8632 Forbid creation of local ConeClassLikeLookupTagImpl 2020-11-12 13:37:34 +03:00
Bingran
5dc7964137 Optimize the way of enabling "--warning-mode=fail"
Make sure project directory is cleaned up after testing
This change is a "follow-up" PR of
https://github.com/JetBrains/kotlin/pull/3804.
2020-11-12 11:13:56 +03:00
Dmitriy Dolovov
e5539b9a9e Gradle, Native: Log raw and transformed args in KotlinToolRunner, p.2 2020-11-12 10:40:33 +03:00
Ilya Gorbunov
4767696840 Qualify replacement expression with receiver to workaround KT-42874 2020-11-12 05:29:39 +03:00
Andrey Uskov
e0655b2f96 Unmute fixed android importing tests in platform 202 2020-11-12 00:24:50 +03:00
Andrey Uskov
a0d5af8dd1 Execute gutters calculation in read action in tests 2020-11-12 00:24:44 +03:00
Andrey Uskov
e5be9601e6 Disable indexation ExternalSystem tests 2020-11-12 00:24:43 +03:00
Andrey Uskov
9318d401f7 Fix test runtime dependencies in NativeImportingTests 2020-11-12 00:24:42 +03:00
Andrey Uskov
dea383460e Add dependency on platform-images in tests 2020-11-12 00:24:41 +03:00
Yan Zhulanow
5f7d7ff9c7 Parcelize: Activate checkers only when the plugin is enabled for module (KT-43291) 2020-11-12 05:38:27 +09:00
Ilya Kirillov
9d207c2cf5 FIR IDE: temporary mute some not passing tests 2020-11-11 21:02:34 +03:00
Ilya Kirillov
3e43efb93e FIR IDE: fix working with copied file in completion 2020-11-11 21:02:33 +03:00
Igor Yakovlev
0d59656532 FIR IDE: Add resolving KtParameter in FirLazyDeclarationResolver 2020-11-11 21:02:31 +03:00
Dmitriy Novozhilov
345a0d3f89 [FIR] Implement writeGenericType in FirJvmTypeMapper 2020-11-11 21:02:31 +03:00
Ilya Kirillov
9350f7aff9 FIR IDE: remove unused method in light classes with compilation error 2020-11-11 21:02:29 +03:00
Ilya Kirillov
b42bed7b3c FIR IDE: make some access to FIR elements under read locks, resolve under write locks 2020-11-11 21:02:28 +03:00
Ilya Kirillov
12ed92cd49 FIR IDE: allow getting parent declaration for Java one 2020-11-11 21:02:27 +03:00
Ilya Kirillov
cbd1ec35ce FIR IDE: lazy resolve property accessors 2020-11-11 21:02:26 +03:00
Ilya Kirillov
fbc6f1b10f FIR IDE: introduce SOURCE_MEMBER_GENERATED declaration kind 2020-11-11 21:02:24 +03:00
Ilya Kirillov
7dcda00e1d FIR IDE: do not fail on invalid code 2020-11-11 21:02:22 +03:00
Ilya Kirillov
c646cb3d7e FIR IDE: fix deadlock in getter symbol resolve 2020-11-11 21:02:21 +03:00
Ilya Kirillov
171157ff78 FIR IDE: allow reference resolving from EDT
It may be called from some other subsystems like Find usages.
Throwing PCE every time we try to resolve some reference from EDT
may result endless try to resolving
2020-11-11 21:02:19 +03:00
Igor Yakovlev
b742a475ff [FIR IDE] Initial FIR LightClass implementation 2020-11-11 21:02:18 +03:00
Igor Yakovlev
c881cf7af6 [FIR IDE] Add when branch for new symbols in FunctionCallHighlightingVisitor 2020-11-11 21:02:14 +03:00
Igor Yakovlev
b423da106f [FIR IDE] Add fir data into symbols to support FIR LC 2020-11-11 21:02:09 +03:00
Ilya Kirillov
3d93503894 FIR IDE: introduce analyze function for with by existing module resolve state 2020-11-11 21:02:07 +03:00
Igor Yakovlev
dbb54c87bc [FIR IDE] Add Fir lightclasses tests and fix FindUsages tests 2020-11-11 21:02:00 +03:00
Igor Yakovlev
3cefef03ff Move refactoring for ifTrue and ifFalse extensions 2020-11-11 21:01:58 +03:00
Ilya Kirillov
a42674ef0e FIR IDE: add hack to allow access symbols on edt 2020-11-11 21:01:57 +03:00
Igor Yakovlev
97f062cb2a [FIR IDE] Add FirJvmTypeMapper to Ide components factory 2020-11-11 21:01:56 +03:00
Igor Yakovlev
36ffde5ca8 [FIR] Implement isArrayOrNullableArray for ConeTypeContext 2020-11-11 21:01:55 +03:00
sebastian.sellmair
06cb64bb51 Allow open callable members in expect interfaces
#KT-42094 fixed
2020-11-11 17:41:59 +00:00
Dmitriy Dolovov
bf0156f7c6 Native, Gradle IT: Fix GeneralNativeIT.testNativeArgsWithSpaces() 2020-11-11 20:29:36 +03:00
Dmitriy Dolovov
0fe842c38f Gradle, Native: Log raw and transformed arguments in KotlinToolRunner 2020-11-11 20:29:31 +03:00
Dmitriy Dolovov
ee7f3b1bfe Native: Use NIO Files.createTemp*() in favor of File.createTemp*() extension functions 2020-11-11 20:29:25 +03:00
Dmitry Petrov
47e2656ca9 JVM_IR keep track of original overrides at collection stubs generation
KT-43068
2020-11-11 18:35:41 +03:00
Yan Zhulanow
65d8e5a615 Don't publish kotlin-dist-for-ide in publishIdeArtifacts as it's now published alone 2020-11-11 18:12:26 +03:00
Roman Artemev
01f3c06ec9 Add test for KT-40412 2020-11-11 17:00:25 +03:00
Alexander Udalov
116606ecd2 JVM IR: fix class kind of created java.lang.Deprecated symbol
If it isn't ANNOTATION_CLASS, the newly added code in
`FunctionCodegen.isDeprecatedHidden` (0e91d3fcb0) ends up transforming
IR annotation constructor calls to annotation descriptors, and an
assertion fails in `IrBasedDeclarationDescriptor.toAnnotationDescriptor`
which checks that the class has kind ANNOTATION_CLASS.

Specifically, this failed in the JVM IR bootstrap on
`CallResolutionInterceptorExtension.interceptCandidates` from module
'frontend'.
2020-11-11 12:53:32 +01:00
Svyatoslav Kuzmich
c1b73f5fee [Wasm] Diable Wasm IR tests on Windows TeamCity 2020-11-11 14:30:22 +03:00
Vyacheslav Gerasimov
3feff16a77 Cleanup 193 compatibility fixes 2020-11-11 14:28:54 +03:00
Vyacheslav Gerasimov
8620d26a8a Delete 193 bunch files 2020-11-11 14:28:53 +03:00
Alexander Gorshenev
ade46ef808 Update Kotlin/Native: 1.4.30-dev-17200 2020-11-11 14:27:45 +03:00
Sergey Igushkin
3666327c81 Fix JVM maven-publish caching by not capturing state in POM rewriting
In POM rewriting logic, ensure that non-serializable entities are
accessed from within project.provider { ... } and their evaluation
results are therefore properly serialized.

Issue #KT-43054 Fixed
2020-11-11 13:55:07 +03:00
Sam Wang
d1ba2f3d46 Restore KotlinExplicitMovementProvider in as41 and as42 2020-11-11 11:37:27 +01:00
Vladimir Dolzhenko
4f76c747ec Mark org.jetbrains.kotlin.mavenProjectImportHandler as dynamic 2020-11-11 10:29:16 +00:00
Vladimir Dolzhenko
b0f6b739d0 Declare missed org.jetbrains.kotlin.defaultErrorMessages EP 2020-11-11 10:29:16 +00:00
Vladimir Dolzhenko
51a1990e50 Drop missing gradle extensions from jvm-common.xml
Similar to 0cad41bb0c

Relates to ^KT-38518
2020-11-11 10:29:15 +00:00
Kirill Shmakov
0eea3a5e95 Bump AS version
To support newest Canary and fix module wizard issues.
^KT-43188 Fixed.
2020-11-11 12:10:36 +03:00
Mikhail Glukhikh
f2f00a4654 Fix BB test to work on JDK 6 2020-11-11 12:00:18 +03:00
Dmitriy Dolovov
078963eead Native, Gradle IT: Fix assertion message 2020-11-11 11:36:51 +03:00
Alexander Likhachev
fbd8de04b8 [Gradle, K/N] Configuration cache support for run with warns
#KT-42849 Fixed
2020-11-11 10:58:37 +03:00
Alexander Likhachev
2d2042ad12 [Gradle, K/N] Configuration cache support for compile & link with warns
#KT-43151 Fixed
2020-11-11 10:58:37 +03:00
Yaroslav Chernyshev
a3b951e505 [Gradle, Cocoapods] Refactor, log process outputs with info level
Also fixed broken `stdErr` processing for `xcodebuild` commands.

#KT-42938 Fixed
2020-11-11 10:47:11 +03:00
Dmitriy Novozhilov
67b262aa34 [FIR] Move tracking candidate applicability from CheckerSink to Candidate 2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
f1ac1f177b [FIR] Extract overload by lambda return type into separate component 2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
a97c107a2b [FIR] Replace callee reference before checking completion from inference session
This is needed because in some cases inference session checks candidate
  and candidates of all sub calls and for that it uses candidate from
  callee reference of call. So we should replace reference with specific
  candidate even if we didn't choose proper candidate yet

#KT-43129
2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
9f5aadd2f4 [FIR] Implement overload resolution by lambda return type
#KT-43129 Fixed
2020-11-11 09:52:55 +03:00
Dmitriy Novozhilov
025ec8e8b1 Add FQ_NAME postfix to OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION 2020-11-11 09:52:55 +03:00
Dmitriy Novozhilov
dfad21270f [FIR] Remove workaround for #KT-43129
Revert changes from 4612f26b and a936386e
2020-11-11 09:52:55 +03:00
Vyacheslav Gerasimov
1148d527ee Build: Upgradle gradle to 6.7 2020-11-11 02:39:23 +03:00
Kris
173954b3b3 Add samples for Random.nextX() functions 2020-11-11 01:37:37 +03:00
Kris
ebdd023633 Add samples for last() and lastOrNull() functions 2020-11-11 01:37:24 +03:00
Yan Zhulanow
e83a3c3f27 Parcelize: Use @Parcelize annotations from Android Extensions instead of the copied&deprecated ones (KT-42342, KT-43150)
Dex can't merge class files from both android-extensions-runtime and parcelize-runtime, so we have to keep only one copy of each class.
Instead of @Deprecated annotations, there are new diagnostics (without quick-fixes yet).
The goal is to allow simple usages (@Parcelize alone) but forbid kotlinx.android.synthetic.Parceler usage.
2020-11-11 04:25:07 +09:00
Ilmir Usmanov
fa42a6ba58 Use non-local return target instead of inline site in suspend function
return type coercion.
 #KT-43226 Fixed
2020-11-10 20:08:45 +01:00
Mikhail Glukhikh
d4f08018ce [FIR2IR] Extract special symbol provider to make JVM extension 2020-11-10 21:07:27 +03:00
Mikhail Glukhikh
bc47a30dd3 [FIR] Handle 'EnhancedNullability' more properly
This commit includes three changes:
1. 'EnhancedNullability' is no more set for declaration types
2. It is no more used for conversion types in translator
3. Translator inserts implicit not-null cast only when enhanced type is cast to not-null type.
2020-11-10 21:07:27 +03:00
Mikhail Glukhikh
e7a84fd1ee [FIR2IR] Preserve 'EnhancedNullability' type annotation in IR 2020-11-10 21:07:26 +03:00
Jinseong Jeon
f8dc56e2bb FIR render: fix typos on RenderMode 2020-11-10 21:07:26 +03:00
Mikhail Glukhikh
f8e03786c0 Mute not relevant JS/WASM back ends for new BB tests 2020-11-10 21:07:09 +03:00
Juan Chen
9486f58fb1 [FIR] fix subtyping for definitely notnull types.
The current implementation doesn't consider Foo a subtype of Captured<in
Foo>!!, since AbstractTypeCheckerContext::checkSubtypeForSpecialCases
does not handle DefinitelyNotNullType cases. This PR adds handling of
DefinitelyNotNullType by looking at its original type.

^KT-42824 Fixed
2020-11-10 21:07:09 +03:00
Juan Chen
eb804709da [FIR] fix subtyping for nullable captured types.
The issue is the type checker doesn't consider P? a subtype of
CapturedType<in P>?, whereas P a subtype of CapturedType<in P>?. In
AbstractTypeCheckerContext::checkSubtypeForSpecialCases, it checks if
P? is a subtype of the lower type of the captured type, which is
P, and returns false.

This fix uses nullable version of the lower type when the captured
type is marked nullable. To check if P? is a subtype of Captured<in
P>?, we check the LHS, P?, against the nullable lower type of RHS,
P?.

^KT-42825 Fixed
2020-11-10 21:07:09 +03:00
Alexander Udalov
d96223a2ff Fix compiler warnings in new wasm modules
Also don't output v8ExecutablePath in js.tests on each project
configuration.
2020-11-10 18:19:41 +01:00
Alexander Udalov
84d1393711 Minor, workaround compiler exception (KT-43286) 2020-11-10 18:06:17 +01:00
Sergey Shanshin
202459531d Add support of nullable serializers to UseSerializers annotation (#3898)
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/984
2020-11-10 19:42:02 +03:00
Ilya Gorbunov
66f5c98505 Deprecate createTempFile/createTempDir functions
Document their potential permission problems.
Suppress this deprecation in tests.
2020-11-10 18:25:48 +03:00
Georgy Bronnikov
31bfc7d4e3 Fix test data 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
2c404a654b JVM_IR: avoid scope violation in BridgeLowering 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
d246005891 JVM_IR: fix unbound type parameters in AddContinuationLowering 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
9929047f5d JVM_IR: avoid scope violation in BridgeLowering 2020-11-10 17:49:55 +03:00
Dmitry Petrov
e10d8e51b6 JVM_IR more precise superclass stub filtering
Filter out abstract members of superclasses when generating collection
stubs.

KT-43207
2020-11-10 16:41:45 +03:00
Svyatoslav Kuzmich
7f26deb5e6 [Wasm] Enable for loops optimization 2020-11-10 16:09:22 +03:00
Denis Zharkov
233bb47b99 FIR: Fix SAM conversion for raw types with non-trivial TP upper bounds 2020-11-10 14:26:54 +03:00
Denis Zharkov
ce4a11144d FIR: Correctly handle nullable/flexible captured types 2020-11-10 14:26:54 +03:00
Denis Zharkov
ed07bbc734 FIR: Fix inner type resolution during body transformation 2020-11-10 14:26:54 +03:00
Denis Zharkov
a5545b96cb FIR: Fix ambiguity between current Companion and one from supertypes
Companion as qualifier should be found at static scope not a member one
2020-11-10 14:26:54 +03:00
sebastian.sellmair
96352b9c8c Add (and disable) metadata compilation for single backend source sets
KotlinProjectStructureMetadata is created by inspecting source sets
with metadata compilation. Single backend common source sets are
currently not supported for metadata compilation and therefore
did not register one. Foreseeing to support this case with KT-42468,
metadata compilation is now created and registered, but just disabled.
This change will include android variants in
KotlinProjectStructureMetadata even when not officially published.
With those variants, the IDE can infer visibility from some module's
"jvmAndAndroidMain" source set to another modules "jvmAndAndroidMain"

KotlinMetadataTargetConfigurator: rename getPublishedCommonSourceSets to getCommonSourceSetsForMetadataCompilation

KotlinMetadataTargetConfigurator: isMetadataCompilationSupported and add comment to getPublishedCommonSourceSets

Re-use androidPluginIds in KotlinPlugin

KotlinAndroidTarget: Create KotlinComponents for non-published variants and mark them with publishable=false

JvmAndAndroidIntermediateSourceSetTest: add KotlinProjectStructureMetadata jvmAndAndroidMain exists in jvm variants test

AbstractAndroidProjectHandler: Add java sources only in post processing

KotlinAndroidTarget: Inline creation of usageContexts

KotlinAndroidTarget.doCreateComponents: filter non-publishable variants when publishLibraryVariantsGroupedByFlavor is enabled

#KT-42383 fixed
2020-11-10 10:21:40 +00:00
Svyatoslav Kuzmich
03e63f1103 [Wasm] Enable maven-publish plugin in wasm stdlib 2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
ffe3487aa5 [Wasm] Don't generate unnecessary unreachable instructions
Helps with WAT readability
2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
b371b61cf5 [Wasm] Indent blocks of produced WAT
Makes it more readable
2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
4d59a58291 [Wasm] Add interop annotation @JsFun 2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
e51a76bc4e [Wasm] Basic CLI
-Xwasm option that will produce wasm instead of JS when used with -Xir-produce-js
Does not affect klib production
2020-11-10 13:08:04 +03:00
Vladimir Dolzhenko
80f316168e Updated IDE perf tests vega visualization to handle wide time ranges with aggregation 2020-11-10 10:58:17 +01:00
Kristoffer Andersen
297c33b452 [IR] Correct line number on suspend function with implicit unit return 2020-11-10 10:58:02 +01:00
Roman Artemev
c2fec38384 [JS IR BE] Unmute fixed tests 2020-11-10 11:06:11 +03:00
Roman Artemev
94acfa50bd [IR BE] Remap dispatch receiver for inner ctor too
- do not forget to add into mapping dispatch receiver
 - fix KT-40686 (at least part of it)
 - add test
2020-11-10 11:06:11 +03:00
Roman Artemev
1ced0138ff [JS IR BE] Drop redundant marker since function doesn't use descriptors anymore. 2020-11-10 11:06:11 +03:00
Dmitriy Novozhilov
e66daf90fd Advance bootstrap to 1.4.30-dev-2196 2020-11-10 11:02:48 +03:00
Dmitry Petrov
785466acee Minor: add '// JVM_TARGET: 1.8' 2020-11-10 06:48:07 +03:00
Alexander Udalov
106ee1d1ff JVM IR: restore ability to suppress codegen-reported diagnostics
In the old backend, BindingContextSuppressCache is used (which is now
created explicitly in GenerationState), which looks up `@Suppress`
annotations on elements right before reporting the diagnostic. In JVM
IR, we clear the binding context after psi2ir, so this approach doesn't
work. This change provides another implementation of KotlinSuppressCache
which eagerly precomputes all suppressions on all annotated elements in
all source files at the point of creation of GenerationState (when the
binding context is still full).

 #KT-43047 Fixed
2020-11-09 19:55:31 +01:00
Alexander Udalov
61548a0a36 Fix inspections and slightly "kotlinify" KotlinSuppressCache 2020-11-09 19:48:04 +01:00
Alexander Udalov
9d3c9a823d Improve rendering of failures in AbstractWriteFlagsTest
When expected and actual flag values are not equal, transform them to
presentable strings according to `Opcodes.ACC_*` field values.
2020-11-09 19:47:54 +01:00
Alexander Udalov
0e91d3fcb0 JVM IR: generate ACC_SYNTHETIC for deprecated-hidden declarations correctly
Extract the logic that computes ACC_SYNTHETIC flag for deprecated
declarations, and use `DeprecationResolver` as the old backend does in
`DescriptorAsmUtil.getCommonCallableFlags`. Creating IR-based
descriptors for each function to pass it there is a bit costly though,
so as a small optimization, use `allOverridden` to check if anything in
the method hierarchy is deprecated.

Also optimize `allOverridden` for the case of linear inheritance which
is far more common.

 #KT-43199 Fixed
2020-11-09 19:47:54 +01:00
Alexander Udalov
d9efc2d922 Fix warnings in compiler code and tests 2020-11-09 19:46:10 +01:00
Roman Golyshev
ebfbc2f601 KT-43205 Ignore annotations in CallableClsStubBuilder when needed
Kotlin compiler can add `@Deprecated` annotations to the fields of
private companion objects, and if those annotations are not supposed to
be shown in decompiled code and used, the field is marked with
`HAS_ANNOTATIONS=false` flag (see KT-25009)

However, it was not taken into account in stubs building process, which
led to the 'Stubs vs PSI mismatch' exceptions

^KT-43205 Fixed

Also, restore the order of nested typealiases and classes (see KT-41859)

We didn't want to bump the version of the stubs when we fixed this
issue; now we have an opportunity to restore the order back to
match the `MemberComparator`

Also, some refactoring is done to underscore that
`createPackageDeclarationsStubs` is suitable only for packages, not
for any declarations container
2020-11-09 15:49:50 +00:00
Svyatoslav Kuzmich
fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
02a84fa6e1 [Wasm] Remove wasmBox tests
They are be covered by common codegen box tests.
2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
bfd0f21e9d [Wasm] Major compiler and stdlib update 2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
3be38d1796 [Wasm] Add Wasm IR
Intended to be used by Kotlin/Wasm compiler.

Includes:
 * IR tree: declarations, instructions, types.
 * Convertors: ir2text, ir2bin, bin2ir
 * Spec tests, to test convertors against reference Wabt tool
2020-11-09 16:04:42 +03:00
Svyatoslav Kuzmich
65cf991e84 [JS IR] Move JS-specific isInlineClass utils from common to JS compiler module 2020-11-09 16:04:42 +03:00
Vladimir Dolzhenko
e101e6762c Add uploading IDE performance benchmarks to ES 2020-11-09 14:03:58 +01:00
Alexander Gorshenev
ff7c38b2df Unmuted a test 2020-11-09 16:02:15 +03:00
Alexander Gorshenev
eea5a9102c Bump klib abi version to 1.4.2 to reflect absence of serialized fake overrides 2020-11-09 16:02:14 +03:00
Alexander Gorshenev
cb288d47ea Don't serialize fake overrides anymore 2020-11-09 16:02:14 +03:00
Alexander Gorshenev
5de7a10df0 Eliminated -Xdeserialize-fake-overrides 2020-11-09 16:02:14 +03:00
Dmitry Petrov
b9c6267a63 KT-43217 Encode @EnhancedNullability types in IdSignature 2020-11-09 15:20:46 +03:00
Stanislav Erokhin
f6df624c6b KT-43202 Fix isEap function: support RC version
Since 1.4.20 we changed rc suffix to RC.
Old variant (rc) kept just in case
#KT-43202 Fixed
2020-11-09 10:52:50 +03:00
Igor Chevdar
5e0f54a30b [IR] Fixed https://youtrack.jetbrains.com/issue/KT-43159 2020-11-09 11:37:37 +05:00
Pavel Kirpichenkov
0e8cf58a35 Minor: reformat 2020-11-08 15:33:30 +03:00
Pavel Kirpichenkov
b79b94fe75 [MPP] Allow smart casts for properties from dependsOn modules
Smartcasts for public properties from different module are not
stable because module declaring a property in general can be
compiled separately from the module using it. However, if client
module has dependsOn relation with declaring module their simultaneous
compilation is guaranteed which makes this smart cast safe.

Cache all transitive 'expected by' modules in module dependencies.
Extend test to check smart casts are allowed for properties from transitive
'expected by' dependencies and prohibited otherwise.

^KT-42754 Fixed
2020-11-08 15:33:30 +03:00
Pavel Kirpichenkov
778bbd76cb [MPP] Add test for KT-42754 2020-11-08 15:33:30 +03:00
Dmitriy Dolovov
9f0cec3443 Native, Gradle IT: Add verbosity to IT 2020-11-07 11:38:07 +03:00
Alexander Udalov
9adc1a6e9b JVM IR: generate 'main' wrappers as non-final
To replicate bytecode generated by the old backend, and thus simplify
ABI comparison.
2020-11-06 19:27:53 +01:00
Alexander Udalov
791be7c2dc JVM IR: improve ABI of properties in multifile facades
When copying top level declarations from multifile parts to facades,
also copy corresponding properties. This allows to keep their
annotations, which are later used in codegen (for example, to generate
ACC_DEPRECATED on property accessors), and allows to get rid of the hack
where the JVM name of the property accessor was computed prematurely via
methodSignatureMapper.

Also, don't copy `$annotations` methods for non-const properties to
facades because the old backend only generates them in parts (which
might be a separate problem, see KT-27644).

 #KT-40262 Fixed
2020-11-06 19:27:53 +01:00
Alexander Udalov
55974b4eda JVM IR: do not generate InlineOnly property accessors in multifile facade
#KT-37007 Fixed
2020-11-06 19:27:53 +01:00
Alexander Udalov
500b1cfbd3 JVM IR: fix flags of $default methods in multi-file facades
Do not change origin of multifile class bridges to something else
because, as it turns out, there are numerous origin-specific checks in
the codegen that start to behave differently for multifile bridges.
Instead of the method-targeted origin MULTIFILE_BRIDGE, use new class
origin JVM_MULTIFILE_CLASS to detect whether a declaration is a
multifile bridge.

 #KT-40198 Fixed
 #KT-43145 Fixed
2020-11-06 19:27:52 +01:00
Alexander Udalov
d326d6a693 Specify module name via moduleName option instead of freeCompilerArgs
This allows to get rid of warnings about duplicate module name in some
of the modules.
2020-11-06 19:27:32 +01:00
Alexander Udalov
bdb8a58b3b JVM IR: merge JvmBackendFacade into JvmIrCodegenFactory 2020-11-06 19:27:08 +01:00
Alexander Udalov
5c2c2591a1 Minor, rename file to keep git history 2020-11-06 19:27:07 +01:00
Alexander Udalov
624204c7b4 JVM IR: remove outdated code in JvmIrCodegenFactory 2020-11-06 19:27:07 +01:00
Alexander Udalov
b2d49e9615 Minor, fix whitespace in toString 2020-11-06 19:26:49 +01:00
Alexander Udalov
c1a292b01b Psi2ir: improve exception stack traces
- Do not wrap exceptions resulting from generating error expressions
  multiple times, as that could lead to stack traces where the identical
  code is wrapped many times and is printed in the exception message on
  each step, which was difficult to read
- Add element location (file name, line number & position) to the
  message, similarly to exceptions from codegen, when catching and
  rethrowing exceptions at the top level
2020-11-06 19:26:48 +01:00
Dmitriy Dolovov
3cb202f576 Gradle IT: Fix Gradle output checks in Kotlin/Native ITs 2020-11-06 19:24:31 +03:00
Alexander Likhachev
e3db96354d Add javadoc and sources artifacts to kotlin-gradle-build-metrics module
#KTI-382 Fixed
2020-11-06 16:23:32 +03:00
Alexander Gorshenev
5f2a963006 Better wording and comments for klib compatibility code 2020-11-06 16:19:43 +03:00
Alexander Gorshenev
891a4c4621 Dropped outdated klib version compatibility mechanisms 2020-11-06 16:19:43 +03:00
Alexander Gorshenev
8b2b36d61f Enabled klib abi version compatibility 2020-11-06 16:19:42 +03:00
Denis Zharkov
e434a1c892 FIR: Drop unused AbstractFirOverrideScope::create*Copy 2020-11-06 14:44:29 +03:00
Denis Zharkov
2e4c41c0d8 FIR: Drop PossiblyFirFakeOverrideSymbol 2020-11-06 14:44:28 +03:00
Denis Zharkov
7b48625b58 FIR: Remove FirCallableSymbol::overriddenSymbol 2020-11-06 14:44:27 +03:00
Denis Zharkov
78b374ec88 FIR: Do not set overriddenSymbol for KFunction::invoke
It has been probably set by mistake since overriddenSymbol is only used for
fake overrides
2020-11-06 11:32:39 +03:00
Denis Zharkov
a11b488c82 FIR: Add workaround for combination of intersection + delegated members
See org.jetbrains.kotlin.fir.Fir2IrTextTestGenerated.FirProblems#testDelegationAndInheritanceFromJava
2020-11-06 11:32:39 +03:00
Denis Zharkov
41f878e104 FIR: Adjust test data for type alias constructors
They are not SubstitutionOverrides anymore
2020-11-06 11:32:39 +03:00
Denis Zharkov
96c3436e73 FIR: Temporary adjust diagnostics test data
UPPER_BOUND_VIOLATED for type alias constructors is not supported properly
See KT-43142
2020-11-06 11:32:39 +03:00
Denis Zharkov
d58e66e79a FIR: Merge both synthetic type alias constructor kinds 2020-11-06 11:32:39 +03:00
Denis Zharkov
f9aab77ce5 FIR: Simplify ConstructorProcessing relevant to type aliases 2020-11-06 11:32:39 +03:00
Denis Zharkov
8a949b0dcf FIR: Use attribute instead of overriddenSymbol for synthetic type alias constructor 2020-11-06 11:32:39 +03:00
Denis Zharkov
4282e27d73 FIR: Get rid of usages of FirCallableSymbol::overriddenSymbol 2020-11-06 11:32:39 +03:00
Denis Zharkov
728c2a808f FIR: Do not propagate overriddenSymbol at FirObjectImportedCallableScope 2020-11-06 11:32:39 +03:00
Denis Zharkov
037ba4d973 FIR: Simplify VariableStorage::isStable 2020-11-06 11:32:39 +03:00
Denis Zharkov
317d981472 FIR: Do not use overriddenSymbol for imported from object 2020-11-06 11:32:39 +03:00
Denis Zharkov
65119adb6a FIR: Adjust test data. FakeOverride -> SubssitutionOverride 2020-11-06 11:32:39 +03:00
Denis Zharkov
3e37995004 FIR: Get rid of FirCallableSymbol::isFakeOverride and isIntersectionOverride 2020-11-06 11:32:39 +03:00
Alexey Tsvetkov
36387d97ad Add IC metrics reporting 2020-11-05 23:26:46 +03:00
Alexey Tsvetkov
5bde6457b1 Metrics reporting utils 2020-11-05 23:26:46 +03:00
Alexey Tsvetkov
97a09680d5 Remove CompositeICReporterAsync 2020-11-05 23:26:42 +03:00
Zalim Bashorov
2c1e4c1769 [IR] Use more specific type (IrSimpleFunction) for accessors in IrLocalDelegatedProperty 2020-11-05 22:25:05 +03:00
Sergey Igushkin
11bc1c0753 Revert "Fix configuration cache issue in AbstractKotlinTarget" 2020-11-05 21:02:47 +03:00
Roman Artemev
8ca9e792e9 [KLIB] Make sure that referenced local anonymous class is deserialzied.
In case if such class is used an type argument for field type make sure
that field initializer is being read.

Check type recursively.

- fix KT-41143
- update test
2020-11-05 20:28:11 +03:00
Dmitriy Dolovov
0dd329d3d4 Gradle IT: Intercept and log Gradle process output on import failures 2020-11-05 18:51:16 +03:00
Dmitriy Dolovov
4de1bf8d35 Gradle IT: Move GradleProcessOutputInterceptor to the test framework
This is necessary to make GradleProcessOutputInterceptor available for
other tests, e.g. Gradle IT.
2020-11-05 18:51:08 +03:00
Dmitriy Dolovov
fae3ba35e9 Gradle, Native: More verbose logging in KotlinToolRunner
Especially for tools executed in a separate JVM process:
JVM options, Java system properties, custom ENV variables.
2020-11-05 18:51:02 +03:00
Dmitriy Dolovov
734dff6282 [Commonizer] Use compact variants of collections to reduce memory footprint 2020-11-05 18:50:56 +03:00
Dmitriy Dolovov
30bf7b87fe Minor. Code formatted 2020-11-05 18:50:50 +03:00
Dmitriy Dolovov
f5bb60f7cd [Commonizer] Refactor CIR type representation
1. Drop CirClassifierId
2. Specialized classes for each kind of types (classes, TAs, type parameters, flexible types).
3. TypeCommonizer now returns commonized type. In case of TAs this could be a completely new type
   describing expect class or a new TA with the different underlying type.
2020-11-05 18:50:43 +03:00
Dmitriy Dolovov
2764550bbe [Commonizer] Relax conditions for TA lifting-up
Allow lifting up matching TAs with non-empty list of type parameters
and non-empty list of type arguments in the expanded type.
2020-11-05 18:50:37 +03:00
Dmitriy Dolovov
cb2e94df16 [Commonizer] Minor. Convert approximation keys back to data classes 2020-11-05 18:50:31 +03:00
nataliya.valtman
45ce0c6c11 avoid failing KotlinGradleIT.testInternalTest for Windows agent 2020-11-05 13:43:02 +03:00
Sergey Igushkin
c839282f9b Merge pull request #3878 from google/prr/hungnv/KT-43054-configurationCacheIssue
Fix configuration cache issue in AbstractKotlinTarget
2020-11-05 13:26:40 +03:00
Victor Petukhov
90ea64a0e5 Don't report warning about changing execution order for varargs if it's inside an annotation
^KT-43110 Fixed
2020-11-05 13:18:00 +03:00
Victor Petukhov
f052bc341c Don't report warning about implicitly inferred Nothing for call arguments if there is non-Nothing return type
^KT-43108 Fixed
2020-11-05 13:17:59 +03:00
Andrei Klunnyi
7859287337 [KT-40688] Inlay Hints: lambda hints removal on editing
Due to the platform API limitation lambda related hints are treated
separately to all others. Hints removal on editing is not an exclusion
and is now supported as well.
2020-11-05 10:10:19 +00:00
Jinseong Jeon
b3b09ea9b7 FIR: adjust spec testData after DFA changes:
* recording type statements for null assignments
* element-wise join by default
2020-11-04 16:35:42 +03:00
Jinseong Jeon
a5389b067b FIR DFA: use element-wise join everywhere 2020-11-04 16:35:42 +03:00
Jinseong Jeon
771c839d74 FIR DFA: element-wise join at merging points of try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
bd173ebebc FIR DFA: isolate effects between blocks in try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
1f1e1828a7 FIR CFG: reconfigure exception throwing paths in try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
146036010c FIR DFA: add tests about smartcasts in/after try-catch-finally 2020-11-04 16:35:42 +03:00
Mads Ager
2c8c47399a [JVM_IR] Enable KotlinAgainstJava and remaining JavaAgainstKotlin test. 2020-11-04 14:16:37 +01:00
Yunir Salimzyanov
24345bb6b3 Prevent NPE while fetching muted tests from Teamcity server 2020-11-04 16:14:01 +03:00
MikeKulasinski-visa
bc2b396ecd kotlin.native.cocoapods.targets can be a custom list of architectures (#3861)
Co-authored-by: Mike Kulasinski <mike.kulasinski@payworks.com>
Co-authored-by: Ilya Matveev <ilya.matveev@jetbrains.com>
2020-11-04 18:21:12 +07:00
Mads Ager
0279068214 [JVM_IR] Follow old backend in bridge visibility and varargs marking.
The old backend makes bridges for protected and package-private
methods public. Also, for bridges for vararg methods, the vararg
marker is not on the bridge.

These differences seem minor but are visible via reflection, so
we might as well follow the old backend.
2020-11-04 12:03:06 +01:00
Ilmir Usmanov
326768e8b5 Minor. Update test data 2020-11-04 00:20:39 +01:00
Steven Schäfer
bd4e2a283c JVM IR: Don't generate null checks on value parameters of private operator functions
The null check on the extension receiver of private operator functions
is a special case and doesn't extend to value parameters.
2020-11-03 21:44:25 +01:00
Steven Schäfer
d4cb521433 JVM IR: Fix names for SAM callable references with inline class return types
This fixes the ABI issues in KT-42879.
2020-11-03 18:33:34 +01:00
Denis Zharkov
aa81041415 FIR: Fix DiagnosticsTestGenerated when FIR starts requesting light classes
Became necessary after fixing loading Java annotation from deserialization
2020-11-03 18:30:15 +03:00
Denis Zharkov
a936386e53 FIR: Add more complicated workaround for OverloadResolutionByLambdaReturnType
That helps for minOfOrNull/maxOfOrNull
2020-11-03 18:30:15 +03:00
Denis Zharkov
4612f26bfb FIR: Add workaround for OverloadResolutionByLambdaReturnType
Mostly, that should help for existing flatMap usages

^KT-43129 Submitted
2020-11-03 18:30:15 +03:00
Denis Zharkov
07ed89b02b Move OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION to compiler.common
So, it could be used in FIR
2020-11-03 18:30:15 +03:00
Denis Zharkov
a444618c27 FIR: Correctly handle Java annotations from deserialization
To obtain enhanced declarations, we should use type scope
2020-11-03 18:30:15 +03:00
Alexander Udalov
f2b0d057b9 JVM IR: minor optimizations in IrTypeMapper.classInternalName
Replace cubic complexity with square when computing internal name for
nested classes by using StringBuilder instead of concatenating strings,
and don't do getLocalClassType/classNameOverride checks on each step of
the recursion.
2020-11-03 15:40:16 +01:00
Alexander Udalov
b3e79d36df Fix compiler warnings and some inspections 2020-11-03 14:00:53 +01:00
Alexander Udalov
e5d5c20473 Minor, suppress deprecation warnings in parcelize plugin 2020-11-03 14:00:53 +01:00
LepilkinaElena
ee8db2f760 Escape resolving same library several times in K/N (#3880) 2020-11-03 15:57:48 +03:00
Ilmir Usmanov
1376fed1d4 Support non-public inline class constructors
#KT-28056 Fixed
2020-11-03 12:10:21 +01:00
Bingran
88bbeea7f6 Fix deprecated gradle api usage in artifact transform
Previously, when adding --warning-mode=fail to KaptIncrementalIT,
it would fail when testing with advance gradle version because
deprecated configurations in build files of test projects and
gradle api usage in artifact transform.

With this PR, we have two "StructureTransformAction'. The one with
latest gradle api is for use at most cases, the legacy one is for use
when gradle version is less or equal than 5.3 because the new gradle api
is introduced in 5.4.

This change also adds some test fixtures and updates deprecated
configurations to support testing artifact transform.

Test: KaptIncrementalIT
2020-11-03 13:50:16 +03:00
Igor Chevdar
94145f880c [IR] Inliner: supported recursion in default arguments 2020-11-03 11:39:00 +05:00
Ilmir Usmanov
5f8fabed61 Minor. Update test data 2020-11-03 02:20:44 +01:00
Ilya Chernikov
497b7ee266 [minor] fix accidental addition of FirScriptCodegenTestGenerated 2020-11-02 20:35:07 +01:00
Mark Punzalan
89836a2c9a Minor, test-data-only: Remove unused "IGNORE_BACKEND_FIR" directives in
asmLike test-data.
2020-11-02 19:37:14 +01:00
Alexander Udalov
c02e92a5e0 JVM IR: minor, use createJvmIrBuilder to simplify code 2020-11-02 19:33:24 +01:00
Alexander Udalov
dd33ed9297 Fix suspend function with inline class types in reflection
#KT-34024 Fixed
2020-11-02 19:33:23 +01:00
Alexander Likhachev
56f7e34e3e [Gradle, K/N] Revert change of AbstractKotlinNativeCompile supertype
It was changed in order to support build cache for K/N tasks but as we doesn't support cache for CInteropProcess task at the moment, there is no overlapping outputs issue
#KT-43080 Fixed
2020-11-02 20:42:46 +03:00
Vladimir Dolzhenko
369b1ef5df Fix compilation in perfTests 2020-11-02 16:44:04 +01:00
Vladimir Dolzhenko
2bffce2259 Revert Open build tool window on Gradle DSL errors
Proper fix is (to handle any exceptions within ProjectModelContributor EPs) is done in a platform

^EA-236697 Fixed
2020-11-02 15:29:54 +01:00
Vladimir Dolzhenko
1a57794e82 Clean ups in IDE performance tests output 2020-11-02 15:09:30 +01:00
Mads Ager
617279310e [JVM_IR] Rebase inline function and defaults args stepping test. 2020-11-02 13:14:12 +01:00
Ilmir Usmanov
7b315a8b52 JVM_IR: Do not box inline class in methods 2020-11-02 10:50:00 +01:00
Mikhael Bogdanov
e20093d762 Support @JvmStatic and @JvmOverload in annotation companion 2020-11-02 08:27:49 +01:00
Mikhael Bogdanov
7ec2d036ae Don't generate final modifier on static interface methods produced by @JvmStatic+@JvmOverloads from interface companion
#KT-35716 Fixed
2020-11-02 08:27:49 +01:00
Vladimir Dolzhenko
7d0e9654bd Clean ups in IDE performance tests output 2020-11-01 14:29:15 +01:00
Vladimir Dolzhenko
d36511c094 Clean ups in IDE performance tests output 2020-10-31 23:36:35 +01:00
Ilya Kirillov
5fae769a90 Wizard: use new compose icon
#KT-43033
2020-10-31 16:57:07 +03:00
Ilya Kirillov
8eefcbb1d4 Wizard: update compose templates
#KT-43032 fixed
2020-10-31 16:57:05 +03:00
Ilya Kirillov
21928d8f51 Wizard: do not allow creating compose projects with gradle groovy
#KT-42983 fixed
2020-10-31 16:57:05 +03:00
Vladimir Dolzhenko
4f6fa1059c Add missed task dependency for IDE performance tests output 2020-10-31 14:55:58 +01:00
Vladimir Dolzhenko
ceea57ab58 Add missed task dependency for IDE performance tests output 2020-10-31 12:17:04 +01:00
Vladimir Dolzhenko
3c0d43dc0d Rebuild IDE performance tests output
format changes: added warmUp tag, index, benchmark format version
perform post processing: geom mean calc, extract warm-up benchmark
2020-10-30 21:30:02 +01:00
Alexander Udalov
f87e46b599 Kx-serialization: generate wrapper type for reference array serializer 2020-10-30 17:47:29 +01:00
Alexander Udalov
42aef01d79 Kx-serialization: support SerialInfo annotations from dependencies in JVM IR
Also handle call sites correctly, by generating an instance of the Impl
class instead of trying to create the annotation.

 #KT-42976 Fixed
2020-10-30 17:47:29 +01:00
Alexander Udalov
51ded98c4b Kx-serialization: support SerialInfo for JVM IR
No tests added because this is going to be checked by the upcoming build
of kotlinx-serialization runtime with JVM IR.

 #KT-42976 In Progress
2020-10-30 17:45:25 +01:00
Dmitry Petrov
e4ba787034 JVM_IR KT-43066 Generate 'clone' in class implementing kotlin.Cloneable 2020-10-30 19:03:31 +03:00
Mikhail Glukhikh
7b4f781ea8 [FIR] Split primary constructor parameter scope into two different
In init block or property initializers,
for `val x` declared in primary constructor,
`x` reference is now resolved to property, not to parameter.
So we need two different scopes for primary constructor,
one for 'pure' parameters and another one for all parameters,
including val/var ones.

#KT-42844 Fixed
2020-10-30 18:44:55 +03:00
Shagen Ogandzhanian
2d0535a713 [JS_IR] Invoke companion init block while instantiating a class
KT-40740, squashed rr/shagen/KT-40740-static-init-js-ir
2020-10-30 16:19:13 +01:00
Hung Nguyen
6d29bb5814 Fix configuration cache issue in AbstractKotlinTarget
AbstractKotlinTarget#buildAdhocComponentsFromKotlinVariants passes a
non-serializable local object to a lambda, which will fail during
serialization when configuration caching is enabled.

To fix that, this commit passes only the relevant parts of the object
to the lambda.

Bug: https://youtrack.jetbrains.com/issue/KT-43054
Test: Manually verified on
      https://android.googlesource.com/platform/tools/metalava/+/refs/heads/master/
      where the issue was detected (I haven't been able to create a mininal
      reproducible project)
2020-10-30 13:44:49 +00:00
Ilya Chernikov
22117604f6 Move script simple type remapper to the common utilities 2020-10-30 12:57:43 +01:00
Ilya Chernikov
de340e9bc8 Implement support for synthetic script params in IR:
implicit receivers and provided properties
also support script imports
2020-10-30 12:57:43 +01:00
Ilya Chernikov
7572b50385 Expose script parameters from descriptor explicitly...
and universally as ValueParameterDescriptors;
update implementation accordingly
2020-10-30 12:57:43 +01:00
Ilya Chernikov
4cb0437145 [minor] fix reflection usage in scripting tests 2020-10-30 12:57:43 +01:00
Ilya Chernikov
94f2813a8a Add script main function generation to JVM IR backend 2020-10-30 12:57:42 +01:00
Ilya Chernikov
62b9d87bfc [minor] scripting tests improvements 2020-10-30 12:57:42 +01:00
Ilya Chernikov
af7102a586 Enable IR backend in script compiler 2020-10-30 12:57:42 +01:00
Ilya Chernikov
60246f2261 Ignore temporarily the kt22029.kts codegen test for JVM IR:
since it fails and I cannot fix it right now.
2020-10-30 12:57:42 +01:00
Ilya Chernikov
d7112a4500 Implement JVM IR support for scripts 2020-10-30 12:57:42 +01:00
Ilya Chernikov
01d73ba0fc Make IrScript a statement container first, update JS support
The IrScript is now the IrStatementContainer with significant
statements order, and the code is adapted accordingly
2020-10-30 12:57:42 +01:00
Andrei Klunnyi
55048f40ab Disable "Incomplete destructuring declaration"
^KT-43037 fixed
2020-10-30 09:33:18 +01:00
Dominik Wuttke
3acb468d48 Add a link to scope functions overview for takeIf and takeUnless
Co-authored-by: Dominik Wuttke <Dominik.wu@gmx.net>
2020-10-30 04:09:50 +03:00
Uzi Landsmann
f48f7c6dca Added samples for the kotlin.system package (measureTime* functions)
Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2020-10-30 03:35:15 +03:00
Uzi Landsmann
15381c4662 Added samples for the kotlin.streams package
Co-authored-by: Uzi Landsmann <uzi.landsmann@bisnode.com>
2020-10-30 02:23:31 +03:00
Yuya Urano
18672c99ca KT-20357: Add a sample for requireNotNull 2020-10-30 02:15:48 +03:00
Ciaran Treanor
2b03c10941 Correct small grammatical error in KDocs
Updated KDoc generator template to address all instances of
a grammatical error ("less" -> "fewer").
Also committed newly generate _Collections.kt, _Sequences.kt,
and _Strings.kt.
2020-10-30 01:47:06 +03:00
Ilmir Usmanov
28e148d35a Old JVM: support init blocks in inline classes
#KT-28055 Fixed
2020-10-29 20:38:03 +01:00
Ilmir Usmanov
999604541e JVM_IR: Support init blocks in inline classes
Put their content to constructor-impl, so they are called during
constructor call, but they are not called during boxing, because
box-impl calls <init> and not constructor-impl.

 #KT-28055 In progress
2020-10-29 20:38:01 +01:00
Mikhael Bogdanov
5804f73ebd JVM_IR. Deprecate public access to @JvmField/const fields in private companions
#KT-25009
2020-10-29 17:19:49 +01:00
Mikhael Bogdanov
57c9afc73a Deprecate public access to @JvmField/const fields in private companions
#KT-25009
2020-10-29 17:19:49 +01:00
Alexander Udalov
8be23df668 Remove unneeded dependency of util on deserialization & reflect
This is probably a result of a somewhat incorrectly merged
6c37574fce.
2020-10-29 17:03:11 +01:00
Alexander Udalov
0d1bb9acaf JVM IR: do not clear BindingContext in bytecode tool window 2020-10-29 17:02:58 +01:00
Dmitry Petrov
08b761ae7a PSI2IR don't copy annotations for properties implemented by delegation
KT-43012
2020-10-29 16:23:02 +03:00
Sergey Igushkin
53004f97b1 Store processed metadata artifacts in .gradle/ rather than build/
This allows the files to survive Gradle's `clean` task that deletes the
`build/` directory with all its contents, which leads to the IDE losing
dependencies until next re-import.

The `.gradle` directory is chosen because Gradle creates it in every
project and it is normally included in .gitignore (or otherwise ignored
in VCS).

Related to issue #KT-39568
2020-10-29 15:59:23 +03:00
Mads Ager
dca1f4631c [JVM_IR] Use line number 1 for multifile bridge methods.
This is necessary for the intellij debugger filters to hide
these bridges.

Fixes KT-41961.
2020-10-29 13:04:08 +01:00
Alexander Dudinsky
c8a8410fc5 Fix MultiModuleLineMarkerTest on Windows 2020-10-28 22:35:43 +03:00
Anton Yalyshev
d4d93b7091 Add change-notes for 1.4.20 2020-10-28 21:57:05 +03:00
Alexander Udalov
ad5b6da273 JVM IR: substitute generic type for inline class replacement function calls
The main change here is in `JvmInlineClassLowering.visitFunctionAccess`,
where we now store the substituted return type of the function as the
type of the call expression. Without it, the call could have a
meaningless type, e.g. some `T` which is inaccessible at that place, and
that could backfire in subsequent lowerings in codegen. For example, in
the `stringPlus.kt` test, it would prevent the code in
`FlattenStringConcatenationLowering.isStringPlusCall` from recognizing
and replacing the `String.plus` call, leading to a codegen exception.

Other changes are mostly cosmetics to make the code similar to
`visitFunctionReference`, and preventive optimizations for the case when
the substitution map is empty.
2020-10-28 16:46:28 +01:00
Mikhail Glukhikh
4a3a2ef72a [FIR2IR] Test data fix after rebase (regular + delegated supertype) 2020-10-28 18:09:13 +03:00
Mikhail Glukhikh
60141ccbaa [FIR] Fix Substitution scope key to avoid accidental matches 2020-10-28 18:09:12 +03:00
Mikhail Glukhikh
2dc6467b5d [FIR] Modify signatures also from ERASED_COLLECTION_PARAMETER_SIGNATURES
In this commit we change value parameter type of containsAll, removeAll,
retainAll from Java collections. Originally it's Collection<?>,
we change it to Collection<T>

#KT-42340 Fixed
2020-10-28 18:09:11 +03:00
Jake Wharton
3a693e112b Update ExperimentalPathApi annotation's SinceKotlin value to 1.4 2020-10-28 16:55:57 +03:00
Roman Golyshev
82984089f0 KT-42274 Update SOURCE_STUB_VERSION
This update should have been done in
4b7d34b537 commit, as it is stated in the
`KtTokens.MODIFIER_KEYWORDS_ARRAY` docs.

Shifting all modifiers by one have led resulted in incorrect modifiers
when stubs were read from the disk. Updating `SOURCE_STUB_VERSION` will
make IDEA recreate all stubs from scratch

^KT-42274 Fixed
2020-10-28 12:57:53 +00:00
Mikhail Glukhikh
80108444ec FIR2IR: cleanup implicit cast inserter 2020-10-28 15:44:46 +03:00
Jinseong Jeon
2424f2438c FIR2IR: towards comprehensive visits in implicit cast inserter 2020-10-28 15:44:45 +03:00
Jinseong Jeon
5f6d2c5362 FIR2IR: utilize argument conversions 2020-10-28 15:44:44 +03:00
Jinseong Jeon
f1fd3d6b5d FIR2IR: avoid using constant -1 2020-10-28 15:44:42 +03:00
Jinseong Jeon
707e94bab5 FIR2IR: add test about coercion-to-Unit for nested when 2020-10-28 15:44:41 +03:00
Jinseong Jeon
318f4b5f02 FIR2IR: refactor implicit cast insertion, part 3: implicit not_null 2020-10-28 15:44:40 +03:00
Jinseong Jeon
8708bdec0d FIR2IR: refactor implicit cast insertion, part 2: coerce-to-Unit 2020-10-28 15:44:39 +03:00
Jinseong Jeon
8f8ee88957 FIR2IR: refactor implicit cast insertion, part 1: implicit cast 2020-10-28 15:44:38 +03:00
Jinseong Jeon
e9a7b64ca0 FIR2IR: use AnnotationGenerator to convert file annotations 2020-10-28 15:44:37 +03:00
Mikhail Glukhikh
ef6b643b9c [FIR2IR] Don't set WHILE_LOOP origin for blocks 2020-10-28 15:44:36 +03:00
Yan Zhulanow
eb9b5da82b Kapt: Never mark static methods 'default' (KT-42915) 2020-10-28 21:03:26 +09:00
Toshiaki Kameyama
09e1bed5c9 Redundant 'inner' modifier: fix false positive/negative with constructor call
#KT-40879 Fixed
#KT-41223 Fixed
#KT-41311 Fixed
#KT-41680 Fixed
2020-10-28 18:16:57 +07:00
nataliya.valtman
e9669bf5cb fix unstable IncrementalFileToPathConverterTest tests 2020-10-28 12:33:03 +03:00
Denis Zharkov
2589de6c49 FIR: Refine delegated members introduced to use-site scope
- Do not add hashCode/equals/toString
- Do not add privates and ones that are already declared
2020-10-28 11:43:25 +03:00
Denis Zharkov
2105a041a5 FIR: Optimize usages of containingClass and its implementation 2020-10-28 11:43:25 +03:00
Denis Zharkov
923bb3b674 FIR2IR: Mute failing bb test
^KT-42946 Open
2020-10-28 11:43:25 +03:00
Denis Zharkov
2bdb21793f FIR: Adjust test data 2020-10-28 11:43:25 +03:00
Denis Zharkov
b6a312483a FIR: Fix fir2symbol inconsistencies for imported properties
Do not copy delegateFieldSymbol because otherwise the old symbol will be rebound
to the new instance of a property
2020-10-28 11:43:25 +03:00
Denis Zharkov
09b7237ae5 FIR: Introduce importedFromObjectClassId 2020-10-28 11:43:25 +03:00
Denis Zharkov
4d9ef4d414 FIR: Get rid of CallableId::classId usages
Use dispatchReceiverType or containingClassAttr instead
2020-10-28 11:43:25 +03:00
Denis Zharkov
9996c983c9 FIR: Initialize dispatchReceiverType and containingClassAttr for callable members 2020-10-28 11:43:25 +03:00
Denis Zharkov
ecb89a66be FIR: Copy attributes when copying declaration
Otherwise they share FirDeclarationAttributes instance that might lead
to problems when modifying only one of them
2020-10-28 11:43:25 +03:00
Denis Zharkov
52c6aebec2 FIR: Use copy-builders at FirObjectImportedCallableScope 2020-10-28 11:43:25 +03:00
Denis Zharkov
995b1aa1eb FIR: Add FirCallableMemberDeclaration::dispatchReceiverType 2020-10-28 11:43:25 +03:00
Ilya Gorbunov
0fa2cc15de Cleanup more test files and directories after tests
#KT-19192
2020-10-28 07:36:22 +03:00
Ilya Gorbunov
fe098ec821 Revise functions in PathReadWrite
- Adjust implementations to avoid excessive vararg copies
- Remove options from forEachLine, it doesn't make much sense and
isn't consistent with the other read* functions.
- Revise inlineness of functions in PathReadWrite
- Compact implementations of those that are remained inline.
- Clarify docs of functions for reading the entire file

#KT-19192
2020-10-28 07:36:19 +03:00
Ilya Gorbunov
a43cc0d1f9 Implement additional Path extensions
#KT-19192
2020-10-28 07:36:16 +03:00
Ilya Gorbunov
038f1cbd1e Add glob filtering when listing directory entries
#KT-19192
2020-10-28 07:36:14 +03:00
Ilya Gorbunov
e7c888a2e6 Avoid introducing Path.printWriter
#KT-19192
2020-10-28 07:36:11 +03:00
Ilya Gorbunov
9f659d74df Introduce dedicated experimental annotation for Path extensions
#KT-19192
2020-10-28 07:36:08 +03:00
Ilya Gorbunov
997cd35e06 Move Path extensions to the new package kotlin.io.path
This avoids the conflict with the existing top-level functions in
kotlin.io package.

#KT-19192
2020-10-28 07:36:06 +03:00
Ilya Gorbunov
7d58a5e2f2 Simplify Path.copyTo implementation
Delegate most checks to the platform Files.copy.
This changes the exception type thrown in one case,
so document when it happens. Also 'copyTo' no longer
creates target parent directory if it doesn't exist.

#KT-19192
2020-10-28 07:36:02 +03:00
Ilya Gorbunov
f6d2400208 Workaround bugs in Path.relativize
Also add actual paths to the relativeTo error message.

#KT-19192
2020-10-28 07:36:00 +03:00
AJ
b3a87356bd Add java.nio.Path extensions to stdlib-jdk7: part 2
- Add notExists
- Rename isFile to isRegularFile
- Remove forEachBlock
- Rename listFiles
- Add relativeTo extensions
- Remove extra overloads
- Update doc comments
- Address review comments

#KT-19192
2020-10-28 07:35:57 +03:00
AJ
03cc0bf6aa Add java.nio.Path extensions to stdlib-jdk7
This PR adds most extensions on `java.io.File` in `kotlin.io` to `java.nio.Path`. This includes extensions from `FileReadWrite.kt`, `Utils.kt`, and `FileTreeWalk.kt`.

I attempted to keep the implementations, documentation, and tests as similar as possible to the existing implementations.

I am happy to add, remove, or move to separate PRs any of the functions of this PR.

### `File` extensions that were not added to `Path`

##### `createTempDir`, `createTempFile`

These functions have no `File` parameters, so can't be overloaded. Equivalents exist as `Files.createTempFile()` and `Files.createTempDirectory()`.

##### `startsWith`, `endsWith`, `normalize`, `resolve`, `resolveSibling`

These exist as member functions on `Path`

##### `relativeTo`, `relativeToOrNull`, `relativeToOrSelf`, `toRelativeString`, `toRelativeStringOrNull`

This functionality exists as the `Path.relativize` member function, which is equivalent to `relativeTo`, but with the receiver and parameter flipped. `foo.relativeTo(bar)` is equivalent to `bar.relativize(foo)`. We could potentially add a `relativizeOrNull` extension to make that pattern simpler.

##### `isRooted`

`Path` has a `root` method, so `isRooted` is equivalent to `root != null`

### New extensions

All of the simple boolean attribute checks from `java.nio.Files` were added as extensions on `Path`. These extensions are used commonly enough that it seems worth supporting them. This functionality for `File` is implemented as member methods.

The following `Path` extensions were added:

- `exists`
- `isDirectory`
- `isExecutable`
- `isFile`
- `isHidden`
- `isReadable`
- `isSameFile`
- `isSymbolicLink`
- `isWritable`

Some of these extensions take options that are forwarded to their `Files` method, so all of the extensions were implemented as functions rather than properties for consistency.

Additionally, `Path.listFiles` was added to match the `File.listFiles` method. One motivation for its addition was that it's used several times in the implementation of other file extensions. The way to list directory contents with `java.nio` is via `Files.newDirectoryStream()`, which returns an iterable object that must be closed to avoid leaking resources. It's difficult to use correctly with functions like `map` and `filter`, so this extension was added as a simpler, less error-prone alternative.

### Other changes

I added overloads of several of the read-write that take `OpenOptions` to expose the greater control that `java.nio` introduces. For example, you can use `printWriter(APPEND)` to create a `PrintWriter` that doesn't delete the contents of an existing file.

All the new extensions throw exceptions (such as `NoSuchFileException`) from `java.nio` rather than the copies from `kotlin.io`. The `kotlin.io` copies take `File` objects as parameters, and so aren't compatible with `Path`s.

### Address review comments

- Move varargs parameters to the last position
- Remove PathTreeWalk

#KT-19192
2020-10-28 07:35:54 +03:00
Yan Zhulanow
008da87160 Minor: Update Android Extensions deprecation message in relevant test 2020-10-28 00:43:20 +09:00
Yan Zhulanow
9faf91f55d Fix Parcelize settings serialization (KT-42958) 2020-10-28 00:43:20 +09:00
Yaroslav Chernyshev
3386b93009 [Gradle, Cocoapods] Added useLibraries() to allow static library pods
#KT-42531 fixed
2020-10-27 17:57:53 +03:00
Mikhael Bogdanov
21521aa397 Deprecate protected constructors call from public inline function
#KT-21177
2020-10-27 14:51:08 +01:00
Dmitry Gridin
a72cdeabb4 fix testData
^KT-40861
2020-10-27 18:58:48 +07:00
Ilya Goncharov
e6edb62911 [Gradle, JS] Fix for IDEA import with dukat binaries
^KT-42954 fixed
2020-10-27 14:21:34 +03:00
Mikhail Zarechenskiy
bb2e9e2d56 Extract new method from the publicly used interface for compatibility
Note that we can't just use ``@JvmDefault` annotation as the main change
 is in the `core` module which targets Java 6

 #KT-42259 Fixed
2020-10-27 14:14:39 +03:00
Alexander Dudinsky
0e7e657657 Migrate MultiModuleLineMarkerTest to the new CodeMetaInfo test infrastructure 2020-10-27 12:31:45 +03:00
Alexander Dudinsky
94bf38a7b5 Added support for various platforms for CodeMetaInfo tests. ^KT-41996
The tests need to be able to parse and render CodeMetaInfo for different
 platforms. For example, we must draw a run gutter a MAC application on
 OSX, but for a Win application, the gutter should not be drawn at the
 same time. This commit allows to do such checks. In order to indicate
 on which platform it should be rendered, it is necessary to specify the
 platform for a specific CodeMetaInfo in the test data in the format
 {OSX,Unix,Win}, if the block with platforms is missing, this means
 that it should be rendered on each platform.

<!LINE_MARKER{OSX}(...)!> - should only be on OSX
<!LINE_MARKER(...)!> - should be on any platform
2020-10-27 12:31:18 +03:00
Alexander Dudinsky
84d24e5b76 Migrate MultiplatformAnalysisTest to new test runner 2020-10-27 12:23:50 +03:00
Alexander Dudinsky
ac98bc9853 New highlighting/line markers/diagnostics test infrastructure
The current test framework has a number of shortcomings, such as
different markups for different kinds, those formats can not be
mixed in one test file, lacks composability, re-use of it is complicated
This commit contains the first version of the new test runner
to which tests will be migrated in the future.
2020-10-27 12:23:50 +03:00
Yan Zhulanow
994cb6f28e Update deprecation message for the Android Extensions plugin 2020-10-27 18:08:39 +09:00
Toshiaki Kameyama
5e9333773c Remove explicit type arguments: don't report when type argument has annotations
#KT-40985 Fixed
2020-10-27 15:44:44 +07:00
nataliya.valtman
e1a380ec95 KT-34862 use relative path for incremental build cache 2020-10-27 10:45:06 +03:00
Mikhail Glukhikh
09043fb98d [FIR] JvmMappedScope: add mutable methods or not depending on a class 2020-10-27 10:27:06 +03:00
Mikhail Glukhikh
5c3269f489 [FIR] JvmMappedScope: don't add Java methods if Kotlin ones are here 2020-10-27 10:26:55 +03:00
Toshiaki Kameyama
ce407471ec Convert to secondary constructor: suggest on class name
#KT-40861 Fixed
2020-10-27 14:05:28 +07:00
Ivan Gavrilovic
2c5c15f503 Clean-up outputs on non-incremental run
Always clean all outputs on non-incremental run of the
Kotlin compile task.
#KT-38692 Fixed
2020-10-27 09:44:06 +03:00
Abduqodiri Qurbonzoda
2fd7d64db0 Promote CancellationException to stable #KT-41837 2020-10-27 05:06:50 +03:00
Mikhail Glukhikh
caafe21e84 [FIR] Add CheckLowPriorityStage to callable reference resolve 2020-10-26 20:07:37 +03:00
Ilmir Usmanov
a775fa195b Unbox inline class parameter of lambda if underlying type is Any or Any?
The inline class is boxed when we pass it as lambda argument, now we
unbox it. If the underlying type is not Any or Any?, bridge method does
the unboxing.

 #KT-32450 Fixed
 #KT-39923 Fixed
 #KT-32228 Fixed
 #KT-40282 Fixed
2020-10-26 17:34:37 +01:00
Toshiaki Kameyama
752f6d8f72 Elvis -> if intention: don't introduce new variable when RHS type is Nothing 2020-10-26 20:57:16 +07:00
Toshiaki Kameyama
f9f8fd055b Convert receiver to parameter: place value argument list after type argument list
#KT-41499 Fixed
2020-10-26 20:47:35 +07:00
Dmitry Petrov
b1629cc5f4 JVM KT-22465 don't generate accessor to private setter in other class 2020-10-26 14:56:07 +03:00
Roman Artemev
4d63ecd83c [JS IR] Do not copy prototype references of FO from super class
Reduce bundle size from issue from 4.9M to 3.4M

 - fix KT-41227
 - add simple test
2020-10-26 14:30:54 +03:00
Matthew Gharrity
99a6bdeec7 Fix KotlinCoreEnvironment projectCount disposable
The disposable which decrements ourProjectCount was a non-capturing
lambda, meaning it had a single identity and could only be registered
in the Disposer tree once. Therefore the application environment
would never be disposed if ourProjectCount ever went above 1.
2020-10-26 12:23:10 +01:00
Mikhail Glukhikh
e9b51b42f9 [FIR] Add test for both KT-10240 and KT-19446 2020-10-26 14:09:36 +03:00
Alexander Udalov
382a0bd298 JVM IR: clear BindingContext after psi2ir
This helps to reduce peak memory in lowerings/codegen by a lot.

A more robust approach would be to have a separate BindingContext for
each file, and clear each of them after running psi2ir on it. This would
also lower peak memory usage in psi2ir.

Provide a fallback workaround compiler argument
-Xir-do-not-clear-binding-context just in case BindingContext is in fact
used somewhere and it's not caught by tests.
2020-10-26 10:34:43 +01:00
Alexander Udalov
bc76f1fec3 Refactor test utilties to reuse GenerationState construction 2020-10-26 10:34:43 +01:00
Alexander Udalov
dd813777b9 Refactor Main-Class computation in CLI for JVM with .jar outputs
Compute FQ name of the main class right after running the analysis and
before invoking codegen. This is needed because MainFunctionDetector
depends on BindingContext, and JVM IR needs to clear BindingContext as
soon as it's not necessary to reduce peak memory usage, thus breaking
any usages of data from it after the codegen.

Also refactor and use the extracted, but not properly reused previously,
copy of findMainClass in findMainClass.kt.

Note that this replaces NPE in KT-42868 with an UOE.
2020-10-26 10:34:43 +01:00
Vladimir Dolzhenko
0a18be62e5 Add prefix for inner test classes in ide perf tests to avoid metric name clashes 2020-10-25 22:49:30 +01:00
Alexander Udalov
08b8939b80 IR: make IrSymbol.isPublicApi an extension 2020-10-23 20:56:08 +02:00
Alexander Udalov
4bd08e5e0c IR: clear callToSubstitutedDescriptorMap for each file to avoid leaking memory
This map is populated during psi2ir and is only used in
insertImplicitCasts, after which it makes sense to clear it, otherwise
it strongly references a lot of descriptors for calls in other files
which would never be used.
2020-10-23 20:50:08 +02:00
Alexander Udalov
7ac981d4d3 Psi2ir: refactor ModuleGenerator.generateModuleFragment
Move `postprocess` into `generateSingleFile` and do those steps on each
file instead. This will allow to create
`GeneratorContext.callToSubstitutedDescriptorMap` for each file and
clear it after its only call site (InsertImplicitCasts) has used it.
Also simplify code a bit.
2020-10-23 20:50:08 +02:00
Victor Petukhov
7b53d668ab Fix test after 4f06162446 2020-10-23 18:33:23 +03:00
Yan Zhulanow
c07f25fa44 Revert "FoldInitializerAndIfToElvisInspection: don't add explicit type if var is used as non-nullable"
This reverts commit bb7d4c22
2020-10-24 00:22:41 +09:00
Yan Zhulanow
87574dddd9 Revert "ReplaceWith: suggest for "invoke" extension"
This reverts commit be194c34
2020-10-24 00:22:41 +09:00
Yan Zhulanow
04457e92d0 Revert ""Put/Join arguments/parameters" intention: don't suggest on nested argument list"
This reverts commit 4a328981
2020-10-24 00:22:41 +09:00
Yan Zhulanow
3321ce6325 Revert ""Code Cleanup": don't remove deprecated imports when file has @file:Suppress("DEPRECATION") annotation"
This reverts commit cf5a6274
2020-10-24 00:22:41 +09:00
Yan Zhulanow
839c30d04b Revert "Additional minor fixes for KT-33594: avoid using hard-coded annotation name, simplify hasAnnotationToSuppressDeprecation()"
This reverts commit 2a841550
2020-10-24 00:22:40 +09:00
Yan Zhulanow
9320637efe Revert "Redundant companion reference: do not report 'values/valueOf' function in enum"
This reverts commit 55d55446
2020-10-24 00:22:40 +09:00
Yan Zhulanow
383190f25e Revert "Replace with ordinary assignment: do not suggest when operator is augmented assignment operator function"
This reverts commit 73e319ca
2020-10-24 00:22:40 +09:00
Yan Zhulanow
7fccd0153b Revert "Refactoring: Remove hard-coded augmented assignment check with a Name check"
This reverts commit 016e78e4
2020-10-24 00:22:40 +09:00
Yan Zhulanow
0ae21a157f Revert ""Change to return with label" quick fix: apply for type mismatch"
This reverts commit f76e9886
2020-10-24 00:22:39 +09:00
Yan Zhulanow
601198634d Revert "Minor: Extract lambda return expression handling"
This reverts commit 55038e19
2020-10-24 00:22:39 +09:00
Yan Zhulanow
b18de1e3ff Revert "Provide quickfix for specifying type of variable initialized with null"
This reverts commit cdf7f46c
2020-10-24 00:22:39 +09:00
Yan Zhulanow
4327bc4ac3 Revert "KT-23394: Add a test with a property"
This reverts commit f2dc132d
2020-10-24 00:22:38 +09:00
Yan Zhulanow
fe64fcf8a3 Revert "Minor: update order in IntentionTestGenerated"
This reverts commit 6515d53b
2020-10-24 00:22:38 +09:00
Yan Zhulanow
c4a48598c0 Revert ""Add parameter to function" for TYPE_MISMATCH: fix it works correctly for extension function"
This reverts commit 03e725d5
2020-10-24 00:22:38 +09:00
Yan Zhulanow
16dbf7ba74 Revert "Convert to range check: don't report it if recursive call will be created"
This reverts commit 73184884
2020-10-24 00:22:38 +09:00
Yan Zhulanow
d735637f1e Revert "RemoveBracesIntention: add new line for long expression"
This reverts commit f4b9c477
2020-10-24 00:22:37 +09:00
Yan Zhulanow
f615ed2f26 Revert ""Use destructuring declaration": fix it works correctly if variable name is shadowed"
This reverts commit d61158a1
2020-10-24 00:22:37 +09:00
Yan Zhulanow
ab70cc35ea Revert "Add quick fix for 'JAVA_CLASS_ON_COMPANION'"
This reverts commit 15a615d6
2020-10-24 00:22:37 +09:00
Yan Zhulanow
6cc4d70b07 Revert "Minor: Remove hard-coded 'Companion' name"
This reverts commit 871ad2b9
2020-10-24 00:22:37 +09:00
Yan Zhulanow
19f518c037 Revert "IfThenToSafeAccessInspection: fix it works correctly for variable/operator call"
This reverts commit 5095caee
2020-10-24 00:22:36 +09:00
Yan Zhulanow
19896f9616 Revert "Minor: Use second pattern argument instead of explicit callee.text"
This reverts commit 55e36fa1
2020-10-24 00:22:36 +09:00
Yan Zhulanow
519f92599c Revert "Minor: Import DebuggerUtils"
This reverts commit 58f606e1
2020-10-24 00:22:36 +09:00
Igor Chevdar
9b2aa0951b [box-tests] Turned on tests on typeof for K/N 2020-10-23 18:27:10 +05:00
Igor Chevdar
9d1cb6a2c0 Turned off TypeOfChecker for K/N 2020-10-23 18:27:10 +05:00
Victor Petukhov
4f06162446 Get a callable reference expression to report an error on it properly, taking into account possible wrapping
^KT-42620 Fixed
2020-10-23 15:12:08 +03:00
Ilya Muradyan
cb020fb9f4 Change repository adding logic
Now if the repo being added already exists, it is moved to the
end of the list, effectively lowering its priority.

Original issue: https://github.com/Kotlin/kotlin-jupyter/issues/107
2020-10-23 13:31:38 +03:00
Ilya Goncharov
7062bf5737 [JS_IR] Additional check on loop label to not persist name for labeled loop
^KT-42262 fixed
2020-10-23 13:16:03 +03:00
Igor Chevdar
1a9e516dc0 [ir-plugin] Referenced binary operators with the new API 2020-10-23 14:58:33 +05:00
Igor Chevdar
23d12a717e [box-tests] Added a test 2020-10-23 14:22:48 +05:00
Igor Chevdar
27aed0ccbc [IR] Inliner: erase non-reified parameters for casts
Fixes https://youtrack.jetbrains.com/issue/KT-31072
2020-10-23 14:22:09 +05:00
Kristoffer Andersen
27fb46712a [JVM+IR] Unify new debugger tests expectations
This commit unifies the expectation format between the stepping and
LVT tests in the new debugging test harness.

Furthermore, it introduces a compression of runs of locations without
linenumbers. These default to showing as bytecode offsets from
previous line number, which overspecifies the tests: the bytecodes
chosen should not be constrained by a debugging step test.
2020-10-23 11:19:58 +02:00
pyos
e19ecdfb3d [Tests] Suspend Codegen Tests Improvements
This commit enables the execution of suspend box tests in a separate
test. It's a QoL improvement in the existing bb tests but, motivating
these changes, enables the new debugger stepping tests to step
coroutine code.
2020-10-23 11:19:58 +02:00
Kristoffer Andersen
3291f8455b [JVM+IR] Update straight-forward LVT tests 2020-10-23 11:19:58 +02:00
Kristoffer Andersen
2c9bf95227 [JVM+IR] New LVT debugging test harness improvements
This is the first step in a push to improve the test coverage of the
IR debugging experience. This commit improves on the sketch of local
variable table tests built on the new debugger stepping
infrastructure. As improvements on the existing
checkLocalVariableTableTest they:
 - don't overspecify codegen strategy: no hard requirements on slots.
 - test the observed lifespans of locals by stepping through code.

Ultimately this should enable us to bring over all existing tests for
improved coverage of both old and new JVM backends.

WIP list:
 - Gracefully handle absent LVT: treat as empty Add type of local and
 - type of value stored there to expectations Print values in local
 - slots if primitive or java.lang.String Enable specifying
 - expectations per backend Gracefully handle absent box methods
 - Gracefully handle null values in slots of reference type
 - Port a first LVT test
2020-10-23 11:19:58 +02:00
Ilya Goncharov
4479bf0933 [JS_IR] Enum constructor copy parameters with mapping by index
Previously mapping was by name, and there was clash in case of user
parameters named 'name' or 'ordinal'

^KT-39186 fixed
2020-10-23 11:42:43 +03:00
Vladimir Dolzhenko
2790bc1105 Split perf test json reports in a separate files/docs 2020-10-23 09:11:05 +02:00
Vladimir Dolzhenko
d7a783e077 Add prefix for inner test classes 2020-10-23 09:11:05 +02:00
Yan Zhulanow
58f606e1f5 Minor: Import DebuggerUtils 2020-10-23 15:46:54 +09:00
Yan Zhulanow
55e36fa1ab Minor: Use second pattern argument instead of explicit callee.text 2020-10-23 15:46:54 +09:00
Toshiaki Kameyama
5095caee50 IfThenToSafeAccessInspection: fix it works correctly for variable/operator call
#KT-30513 Fixed
#KT-17071 Fixed
2020-10-23 15:46:54 +09:00
Yan Zhulanow
871ad2b909 Minor: Remove hard-coded 'Companion' name 2020-10-23 15:46:53 +09:00
Toshiaki Kameyama
15a615d63b Add quick fix for 'JAVA_CLASS_ON_COMPANION'
#KT-29264 Fixed
2020-10-23 15:46:53 +09:00
Toshiaki Kameyama
d61158a176 "Use destructuring declaration": fix it works correctly if variable name is shadowed
#KT-30601 Fixed
#KT-20570 Fixed
2020-10-23 15:46:53 +09:00
Toshiaki Kameyama
f4b9c4777f RemoveBracesIntention: add new line for long expression
#KT-30523 Fixed
2020-10-23 15:46:52 +09:00
Toshiaki Kameyama
731848849e Convert to range check: don't report it if recursive call will be created
#KT-39182 Fixed
2020-10-23 15:46:52 +09:00
Toshiaki Kameyama
03e725d5da "Add parameter to function" for TYPE_MISMATCH: fix it works correctly for extension function
#KT-39557
2020-10-23 15:46:52 +09:00
Yan Zhulanow
6515d53b94 Minor: update order in IntentionTestGenerated 2020-10-23 15:46:52 +09:00
Yan Zhulanow
f2dc132d5d KT-23394: Add a test with a property 2020-10-23 15:46:51 +09:00
Toshiaki Kameyama
cdf7f46ce1 Provide quickfix for specifying type of variable initialized with null
#KT-23394 Fixed
2020-10-23 15:46:51 +09:00
Yan Zhulanow
55038e19ec Minor: Extract lambda return expression handling 2020-10-23 15:46:51 +09:00
Toshiaki Kameyama
f76e98868c "Change to return with label" quick fix: apply for type mismatch
#KT-32280 Fixed
2020-10-23 15:46:51 +09:00
Yan Zhulanow
016e78e483 Refactoring: Remove hard-coded augmented assignment check with a Name check 2020-10-23 15:46:50 +09:00
Toshiaki Kameyama
73e319ca7a Replace with ordinary assignment: do not suggest when operator is augmented assignment operator function
#KT-34715 Fixed
2020-10-23 15:46:50 +09:00
Toshiaki Kameyama
55d55446c8 Redundant companion reference: do not report 'values/valueOf' function in enum
#KT-34285 Fixed
2020-10-23 15:46:50 +09:00
Yan Zhulanow
2a841550d4 Additional minor fixes for KT-33594: avoid using hard-coded annotation name, simplify hasAnnotationToSuppressDeprecation() 2020-10-23 15:46:50 +09:00
Toshiaki Kameyama
cf5a6274e2 "Code Cleanup": don't remove deprecated imports when file has @file:Suppress("DEPRECATION") annotation
#KT-33594 Fixed
2020-10-23 15:46:49 +09:00
Toshiaki Kameyama
4a328981c6 "Put/Join arguments/parameters" intention: don't suggest on nested argument list
#KT-31020 Fixed
2020-10-23 15:46:49 +09:00
Toshiaki Kameyama
be194c3460 ReplaceWith: suggest for "invoke" extension
#KT-8597 Fixed
2020-10-23 15:46:49 +09:00
Toshiaki Kameyama
bb7d4c224f FoldInitializerAndIfToElvisInspection: don't add explicit type if var is used as non-nullable
#KT-38349 Fixed
2020-10-23 15:46:48 +09:00
Yan Zhulanow
3e632d074e Enable Parcelize IDE plugin in Android Studio 4.2 (KT-42859)
It turned out that all extensions related to the Parcelize IDE plugin are disabled in Android Studio 4.2. The missing inclusion seemingly happened because of a rebase mistake. This commit returns the missing inclusion back.
2020-10-23 15:46:48 +09:00
Mikhail Glukhikh
47a4bd1701 [FIR Java] Look into type arguments during dependent type parameter search 2020-10-23 08:12:17 +03:00
Mikhail Glukhikh
7f3d0af4f7 [FIR Java] Soften rules for matching types for may-be-special-builtins
This commit is workaround for cases like
MyJavaMap<KK : Bound, V> : java.util.Map<K, V>.
After signature changing and substitution we have
MyJavaMap.get(Object) declared and MyJavaMap.get(KK) from supertype,
which can't be otherwise matched as overriding one another.
2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
81529a835b Drop FirAbstractOverrideChecker.isEqualTypes 2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
abc2866902 [FIR] Fold flexible types after substitution if possible 2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
acb03cb28c [FIR2IR] Expand type during super qualifier search 2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
c50aa5f2ec [FIR TEST] Bad test data changes due to Java signature transformation
Both changes are related to getOrDefault. We should either make Java
version low priority or remove it at all.
2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
d3e85dbce0 [FIR] Implement replacing Object with type parameters for specials builtins
#KT-42601 Fixed
2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
d40248cb53 [FIR] Extract computeJvmDescriptorReplacingKotlinToJava 2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
f866eff93e Extract special generic signatures to compiler.common.jvm to reuse in FIR 2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
0e7acd6e8b [FIR Java] Add better type parameter erasure for override matching
Around KT-42601
2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
17de486c23 [FIR Java] Drop nasty code providing type parameter erasure 2020-10-23 08:12:14 +03:00
Alexander Likhachev
999627952a [Gradle, K/N] Add proper assumptions for Mac only integration tests 2020-10-23 05:41:08 +03:00
Alexander Likhachev
ac7b7abcc0 [Gradle, JS] Fix K/JS project build with configuration cache (part 3)
Now configuration cache enabled builds with JS tasks does not fails but prints warning and skips execution on subsequent builds.
Relates to KT-42494
2020-10-23 05:41:07 +03:00
Igor Yakovlev
97d39c102a Fix BWC for Search utils 2020-10-22 19:32:18 +03:00
Andrei Klunnyi
71023cd596 [KT-40688] Inlay Hints: inlay hints are duplicated on code editing
Code editing changes inlay hints offset.
InlayModel.getAfterLineEndElementsInRange(int, int) call didn't return
previously existed hint by its "outdated" offset. From now on hints are
taken by logical line.
2020-10-22 18:22:51 +02:00
Georgy Bronnikov
b7a07fdf03 Review fix: unify irTemporary variants 2020-10-22 18:31:23 +03:00
Georgy Bronnikov
8e331c8afe IR: relax type cast for WrappedVariableDescriptor.containingDeclaration 2020-10-22 18:26:47 +03:00
Georgy Bronnikov
b588839752 EnumConstructorCall.fromSymbolDescriptor 2020-10-22 18:26:46 +03:00
Georgy Bronnikov
887dd10764 IR: remove descriptor usage 2020-10-22 18:26:46 +03:00
Georgy Bronnikov
e5cf7a1be7 Remove descriptor usage from Scope.kt 2020-10-22 18:26:46 +03:00
Leonid Startsev
8d999a2c13 Disable kx.ser plugin inside descriptors serialization in the IDE
Since IDE does not perform any serialization of descriptors, and
metadata written to the 'serializationDescriptorSerializer'
deleted only on call to DescriptorSerializer,
enabling this extension in the IDE effectively causes memory leaks.

 #KT-39624 Fixed

Pass SerializationDescriptorSerializerPlugin to other extensions directly

instead of using static val in companion.
2020-10-22 17:14:06 +03:00
Leonid Startsev
4ec90b18bc Rework DescriptorSerializerPlugin to be a part of Project's extensions
instead of statically registering it.

Static registering can cause subtle errors when plugin implementation
(e.g. SerializationDescriptorPluginForKotlinxSerialization) is registered
from multiple classloaders: in multi-module with daemon compilation scenario

 #KT-41857 Fixed
2020-10-22 17:04:35 +03:00
Mikhail Glukhikh
ef907e0c46 Fix FIR IDE test broken by Jinseong commit 2020-10-22 16:53:12 +03:00
Mikhail Glukhikh
ad12cc296b [FIR] Expand type before adding equality constraint 2020-10-22 15:38:30 +03:00
Alexander Gorshenev
7815529eed [Private fake overrides] Tests for private fake overrides construction 2020-10-22 13:23:29 +03:00
Alexander Gorshenev
294e7dd902 [Private fake overrides] Renamed FakeOverrideBuilder object to FakeOverrideBuilderForLowering 2020-10-22 13:23:29 +03:00
Alexander Gorshenev
81c06b24f7 [Private fake overrides] Private fake overrides linkage 2020-10-22 13:23:28 +03:00
Alexander Gorshenev
223d1dd5e6 [Private fake overrides] Private fake override construction 2020-10-22 13:23:28 +03:00
Alexander Gorshenev
c90556a883 [Private fake overrides] FakeOverrideDeclarationTable for private fake override construction 2020-10-22 13:23:28 +03:00
Alexander Gorshenev
623f9a54c6 [Private fake overrides] Tweak DeclarationTable to be open 2020-10-22 13:23:27 +03:00
Alexander Gorshenev
c7ea8b1ab6 [Private fake overrides] Prepare IdSignature for private fake override construction 2020-10-22 13:23:27 +03:00
Mikhail Glukhikh
91089f5f7a IrValidator: add more details to duplicate message for type parameter 2020-10-22 13:05:01 +03:00
Mikhail Glukhikh
44bb12480b [FIR2IR] Forbid private fake overrides in generator 2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
3663bc6be3 FirClassSubstitutionScope: eliminate second constructor to simplify code 2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
80f8b5b234 IrValidator: mention file in exception message 2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
23e7468e57 [FIR2IR] Cache Java field-based properties more correctly #KT-42805 Fixed
Before this commit, we cached such IR properties by FIR property
which was created by Java field each time when we referenced it.
This led to signature clashes. Now we cache such IR properties
directly by associated FIR field.
2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
3576cbf0d8 [FIR] Add test for KT-42805 2020-10-22 13:04:59 +03:00
Mikhail Glukhikh
f2c651ec9c [FIR2IR] Don't generate Any delegated members for data class
#KT-42771 Fixed
2020-10-22 13:04:59 +03:00
Mikhail Glukhikh
44459e8ac7 FIR mangler: fix alias-based type handling #KT-42770 Fixed 2020-10-22 13:04:58 +03:00
Victor Petukhov
6251568e17 Fix test after 84129098cb 2020-10-22 12:17:26 +03:00
Mikhail Glukhikh
289efd47b2 [FIR2IR] Cleanup code around implicit casts 2020-10-22 11:03:48 +03:00
Juan Chen
620a5d404d [FIR2IR] Keep redundant cast on 'this' for local anonymous function
#KT-42517 Fixed
2020-10-22 10:51:23 +03:00
Jinseong Jeon
f4531b0f34 FIR: set missed source in various FirElements
This could be caught by debuggability tests, such as stepping tests,
which are not enabled for FIR yet.
Instead, for now, full pipeline tests will raise index out-of-bound
errors due to the undefined offsets, which stem from null source.
2020-10-22 10:51:21 +03:00
Jinseong Jeon
46cc01602e FIR2IR: add implicit NOT_NULL cast if needed 2020-10-22 10:51:20 +03:00
Sergey Bogolepov
eeda48e63e Allow prefix and relative path in resolvable properties.
It allows us to move more logic to konan.properties from ClangArgs.
E.g., something like `-$absoluteTargetSysRoot/usr/include/c++/4.9.4`
2020-10-22 12:45:49 +07:00
Victor Petukhov
84129098cb Add equality constraints without subtyping
^KT-42195 Fixed
^KT-41741 Fixed
2020-10-21 21:23:13 +03:00
Dmitry Petrov
b1b87becc8 PSI2IR more JVM-like exhaustive when behavior KT-36840 2020-10-21 20:07:11 +03:00
Ilya Goncharov
7edeccbdc7 Move labeling into NameTables with labeling loops which contain escaped break
^KT-42262 fixed
2020-10-21 16:59:24 +03:00
Ilya Goncharov
400a15e3d6 Add lowering on switch in loop
^KT-42262 fixed
2020-10-21 16:59:24 +03:00
Ilya Goncharov
14d9aa1660 Add test on break in when without label
^KT-42262 fixed
2020-10-21 16:59:24 +03:00
pyos
a4b67f007f JVM_IR: treat suspend-converted references as lambdas for inlining
Again, this is consistent with adapted function references, since
they're pretty much the same anyway.
2020-10-21 15:21:01 +02:00
pyos
12bec7cca2 JVM_IR: when convering references to lambdas, bind the receiver
instead of storing it into a captured temporary.

This makes the resulting lambdas equivalend to adapted function
references produced by PSI2IR or FIR2IR.

 #KT-42492 Fixed
2020-10-21 15:21:01 +02:00
pyos
95fb597da0 PSI2IR / FIR2IR: bind FunctionN as receiver when suspend-converting
This is more consistent with adapted references & allows skipping a
temporary variable.
2020-10-21 15:21:01 +02:00
pyos
ccf921510d PSI2IR / FIR2IR: do not create temporaries for adapted references
Arguments to function references behave the same as arguments to
function calls and should be evaluated once regardless, so the temporary
is unnecessary.
2020-10-21 15:21:01 +02:00
Alexander Udalov
369056ca5d Minor, add explicit type argument to workaround KT-42175 2020-10-21 15:19:25 +02:00
Kirill Shmakov
29aaf70d21 Launch common tests on local JVM via run gutter
For projects with android target and without jvm one. #KT-42463
2020-10-21 15:40:13 +03:00
Jinseong Jeon
1c1e8f7beb FIR CFG: revise edge kind between local func node and fun enter node
so that local function enter node can be visited by FIR CFA

#KT-42814 Fixed
2020-10-21 14:01:31 +03:00
Pavel Punegov
ce8d983b2a Fix test after the fix for KT-17691 2020-10-21 13:58:53 +03:00
Dmitry Petrov
0b34526321 JVM_IR remove lambda hack required for odd JVM+OI behavior in KT-35849 2020-10-21 13:47:01 +03:00
Mads Ager
ad88c60fd8 [JVM_IR] Copy offsets from the original function to invokeSuspend.
Otherwise, implicit returns in void returning suspend functions
will not have the line number of the end brace.

Fixes KT-41962 and KT-40464.
2020-10-21 12:38:45 +02:00
Dmitriy Novozhilov
800bfe2cdb [TEST] Update testdata broken in c2d3a252 2020-10-21 12:49:45 +03:00
Dmitriy Novozhilov
c2d3a252a8 Mute very strange failing of FIR find usages test 2020-10-21 11:53:42 +03:00
Dmitriy Novozhilov
0484ab8cca Don't unwrap captured types in IDE descriptors renderers
#KT-42263 Fixed
2020-10-21 11:53:42 +03:00
Dmitriy Novozhilov
3068d79d2b [FIR-IDE] Add lock for status resolve 2020-10-21 11:53:11 +03:00
Dmitriy Novozhilov
6550bd09b1 [FIR] Ensure class resolve phase in status resolve 2020-10-21 11:53:10 +03:00
Dmitriy Novozhilov
699dd54be9 [FIR] Don't inherit some declaration modifiers (like tailrec) 2020-10-21 11:53:10 +03:00
Dmitriy Novozhilov
bf1a00c73a [FIR] Rework resolution of declaration statuses
There is introduced algorithm of resolution with jumps: before
  resolution of some class we resolve all status of members of its
  supertypes, so we can properly determine inherited visibility
  and modifiers
2020-10-21 11:53:10 +03:00
Mikhail Glukhikh
0b8116dff0 [FIR] Change some phase requirements: STATUS -> DECLARATIONS
NB: Also not quite sure this is better. IMO this shows more clearly that
we require results of declarations resolve and not some strange 'STATUS'
2020-10-21 11:53:10 +03:00
Mikhail Glukhikh
275260720d Add replacePhase in FirTypeResolveTransformer.transformEnumEntry 2020-10-21 11:53:10 +03:00
Mikhail Glukhikh
c171dafd91 FIR serializer: always normalize visibility
Without this commit we fail on package-private or so in serializer
2020-10-21 11:53:10 +03:00
Dmitriy Novozhilov
1ff5da5f41 [FIR] Add forgotten fake override type calculation 2020-10-21 11:53:10 +03:00
pyos
5c55f67923 JVM_IR: generate shorter names for classes in delegate initializers
#KT-41493 Fixed
2020-10-20 21:14:44 +02:00
LepilkinaElena
b786cf7559 [IR] Made signature nullable (#3860) 2020-10-20 21:13:40 +03:00
Alexander Udalov
6a9c72e77c IR: use one traversal instead of two for DeclarationContainerLoweringPass 2020-10-20 20:03:17 +02:00
Alexander Udalov
b5695188f9 IR: remove FunctionLoweringPass, refactor usages to FileLoweringPass
FunctionLoweringPass didn't add much value over FileLoweringPass, but
had a hidden footgun (like ClassLoweringPass) in that if your lowering
pass invoked a visitor/transformer on the function body and you forgot
to override visitFunction to stop visiting nested functions,
runOnFilePostfix would work with the complexity of the squared number of
nesting levels. It looks like this was happening with K/N's
DataClassOperatorsLowering (I haven't measured though).
2020-10-20 20:03:14 +02:00
Alexander Udalov
c110031935 IR: refactor DeclarationTransformer
Do not create extra DeclarationTransformer and FileLoweringPass
instances, instead inline all transformations to
DeclarationTransformer.lower.
2020-10-20 20:02:45 +02:00
Alexander Udalov
2be7afc7f9 IR: minor, give names to anonymous lowering visitors
To improve stacktraces and make the code a bit more readable.
2020-10-20 19:15:50 +02:00
Dmitry Petrov
3979cde738 Add box and PSI2IR tests for special cases listed in KT-35849 2020-10-20 19:31:40 +03:00
Ilya Goncharov
efee322830 [Gradle, JS] Update Dukat on 0.5.8-rc.3 2020-10-20 16:12:38 +03:00
Victor Turansky
4d4aabab8d [JS BE] Make properties configurable when implementing an interface by delegation
#KT-42364 Fixed
2020-10-20 15:49:29 +03:00
Sergey Bogolepov
2ad13847d1 [KT-40670] Allow to override konan.properties from CLI 2020-10-20 17:00:00 +07:00
Konstantin Tskhovrebov
ea34a588f3 Update KMM project wizard. 2020-10-20 12:03:17 +03:00
Dmitry Petrov
47c784f023 JVM_IR fix Java wildcard types translation
Types such as 'Collection<? extends CharSequence>' are treated as
'(kotlin.collections.MutableCollection<out kotlin.CharSequence!>
  ..kotlin.collections.Collection<kotlin.CharSequence!>?)'
by the front-end.
When generating generic signatures, JVM BE takes lower bound (which is
'kotlin.collections.MutableCollection<out kotlin.CharSequence!>').
Emulate this behavior in TypeTranslator.
2020-10-19 20:52:53 +03:00
zhelenskiy
19ed04e3fe Bad capitalization fixed 2020-10-19 16:16:56 +03:00
zhelenskiy
ba08cbbb20 Other typos fixed 2020-10-19 16:16:56 +03:00
zhelenskiy
6e0aa007da Typos fixed 2020-10-19 16:16:56 +03:00
Ilya Goncharov
0367dec035 [Gradle, JS] Dukat change default mode onto source
- Binary only for legacy

^KT-42339 fixed
2020-10-19 16:14:27 +03:00
Konstantin Tskhovrebov
0ce6d694b7 Fix tests for as42. 2020-10-19 15:58:38 +03:00
Alexander Udalov
48cd86b717 Add JVM target bytecode version 15
#KT-41916 Fixed
2020-10-19 14:47:21 +02:00
Ilmir Usmanov
819d64a2ef Box inline class returned from suspend lambda non-locally in JVM_IR
#KT-41194 Fixed
2020-10-19 14:28:39 +02:00
Ilmir Usmanov
70a4ed3ebc Box inline class returned from suspend lambda non-locally
All inline classes should be boxed coming in and out of lambdas,
however, if the inline class was returned non-locally, it was not boxed.
This change fixes the issue in Old JVM BE.
 #KT-41194 In progress
2020-10-19 14:28:36 +02:00
anastasiia.spaseeva
c1765a5306 Add changelog for 1.4.20-M2 2020-10-19 13:15:49 +03:00
Georgy Bronnikov
b70a173595 Formatting changes 2020-10-19 12:21:13 +03:00
Georgy Bronnikov
44893e09c1 IR: remove unneeded ObsoleteDescriptorBasedAPI uses from backend.common 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
a0a6a4b0f1 JVM_IR: make ObsoleteDescriptorBasedApi use explicit in all of backend.jvm 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
305da8ee10 IR: IrFunctionReference.fromSymbolDescriptor 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
14b3beefb3 IR: IrDelegatingConstructorCall.fromSymbolDescriptor 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
b28c85f5ea IR: IrCall.fromSymbolDescriptor 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
ab3ef3a7e9 IR: remove descriptor usage 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
065edac64b IR: remove unused functions 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
726282c1ee IR: remove a descriptor usage 2020-10-19 12:21:11 +03:00
Dmitriy Dolovov
c69402c800 [Commonizer] Fix computing underlyingType and expandedType in CirTypeAlias 2020-10-19 11:21:53 +03:00
LepilkinaElena
cc4d93ac71 [IR] Eliminated expensive calculating of fqNames (#3815) 2020-10-16 21:07:04 +03:00
Ilya Kirillov
4f5b2b8e22 Uncomment accidentally commented code in debugger tests 2020-10-16 20:54:50 +03:00
Mads Ager
318d11dcec [JVM_IR] Remove muting of fwBackingField.
It has been rebased and is not using this .out file at all
for JVM_IR. So in terms of testing this is a noop.
2020-10-16 19:21:08 +03:00
Mads Ager
0505bd958a [JVM] Fix the nop removal optimization.
Never remove a nop if that would cause a line number to move
across a local lifetime boundary.

This fixes KT-42725.
2020-10-16 19:21:08 +03:00
pyos
69127445a3 JVM_IR: refine the condition for caching method nodes
Don't cache non-inline `suspend fun`s if there is no `$$forInline`;
do cache `invokeSuspend` if there *is* `invokeSuspend$$forInline`.
2020-10-16 18:05:04 +02:00
Alexander.Likhachev
d6e0d2a55b [Gradle, JS] Fix K/JS project build with configuration cache (part 2)
It is still does not support configuration cache but these changes allows build to pass with warnings
#KT-42494 Fixed
2020-10-16 16:15:05 +03:00
Roman Artemev
d7db643422 Add box test for KT-33992 2020-10-16 16:02:02 +03:00
Roman Artemev
023a62395a Add box test for KT-36897 2020-10-16 16:02:01 +03:00
Dmitriy Novozhilov
5e406e8803 [FIR-IDE] Unmute passing test 2020-10-16 15:24:58 +03:00
Dmitriy Novozhilov
9f5191f2a1 [FIR-IDE] Regenerate tests 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
8cb08139e1 [FIR-IDE] Add example flag for enabling fir ide to gradle.properties 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
0e47d32587 [FIR] Properly set type of constants for java declarations 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
5f641a2552 [FIR] Add wrapping scopes with forced calculator in checkers and fir2ir 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
e75f218f87 [FIR] Rename FirDeclarationOrigin.FakeOverride to SubstitutionOverride 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
739ebf772c [FIR] Add configuring FakeOverrideTypeCalculator into ConeKotlinType.scope 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
fc23cf76d4 [FIR] Force calculation of return type of fake overrides in return type calculator 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
f9faa5be64 [FIR] Don't force calculation of return type in substitution scope 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
06981fc0af [FIR] Move functions for fake override creating to separate objects 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
1c2fdf7e3f [FIR] Remove scope session from FirClassSubstitutionScope constructor 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
9e863c90fc [FIR] Remove redundant default values for functions in FirClassSubstitutionScope 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
e07f63d26c [FIR] Move declaration attributes to declaration builders 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
0b51fd03e2 [FIR] Add failing test for incorrect type calculation of implicit types 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
23f1cc6b07 [FIR] Get rid of ReturnTypeCalculator in ScopeSession 2020-10-16 15:24:55 +03:00
Dmitriy Novozhilov
fae1b70605 [FIR] Fix type of this reference in copy funciton of data class 2020-10-16 15:24:55 +03:00
Leonid Startsev
0616f948c7 Use actual form of decodeSerializableElement function in 'decodeSequentially'
code path in deserialize.

Old 3-argument form is deprecated and should be removed.
2020-10-16 15:24:12 +03:00
Ilya Kirillov
1bb2eefcaa Fix find usages test testdata adding FIR_COMPARISON directive 2020-10-16 14:54:16 +03:00
Ilya Goncharov
1bc52c195c [Gradle, JS] Uninternal _target in js extension 2020-10-16 14:51:35 +03:00
Alexander.Likhachev
0b6959ee3d [Gradle, K/N] Deprecate K/N compile classpath prop in favor of libraries 2020-10-16 13:48:07 +03:00
Alexander.Likhachev
f4da283ffb [Gradle, K/N] Move build cache tests into appropriate class 2020-10-16 13:48:07 +03:00
Alexander.Likhachev
a0f4898009 [Gradle, K/N] Make compile and link tasks cacheable
Currently build cache isn't supported for frameworks as symlinks in build output is used. Symlinks are transformed into regular files by Gradle build cache and that breaks incremental build. Cinterop process task is not cacheable at the moment as it depends on OS-environment
#KT-39564 Fixed
2020-10-16 13:48:07 +03:00
pyos
a9b53adc50 JVM_IR: make primitive == object slightly less lazy.
Discarding the value used to leave an unused-but-never-destroyed
temporary variable. It's best to not separate calls to `enterTemp`
and `leaveTemp`.

Not sure what kind of test to add though, since this is minor -- if the
result of the comparison is discarded, then the entire statement is more
or less pointless.

 #KT-42251 Fixed
2020-10-16 12:25:55 +02:00
Alexander Udalov
4c09906235 Build: add kotlin.build.useIRForLibraries to enable JVM IR for libraries separately
The next step for JVM IR adoption in our project is going to be enabling
`kotlin.build.useIR`, but keeping `kotlin.build.useIRForLibraries`
disabled until we fix all remaining ABI incompatibility issues for
library code.
2020-10-16 12:13:05 +02:00
Alexander Udalov
29d8730964 Build: when using JVM IR, produce stable binaries
This is needed to allow non-JVM-IR modules depend on the modules
compiled by JVM IR. This also allows us to enable JVM IR in our build by
default now, without introducing errors to all external usages of our
compiler and other artifacts that we publish.
2020-10-16 12:13:05 +02:00
Pavel Kirpichenkov
04a4f9cde6 Minor: cover negative cases with test +m
Add case without reported diagnostic on public companion.
Only report diagnostic if @JvmStatic annotation has source in code.

KT-25114
2020-10-16 11:11:59 +03:00
Pavel Kirpichenkov
9669ab1468 Report warning on @JvmStatic in private companion objects
Deprecation cycle to prohibit in 1.5.
^KT-25114 In Progress
2020-10-16 11:11:59 +03:00
Pavel Kirpichenkov
d769ca06ab Add test for KT-25114 2020-10-16 11:11:58 +03:00
Victor Petukhov
c6da2a1138 Reuse built functional types for postponed arguments by expected types and paths from a top level type variable
^KT-42221 Fixed
2020-10-16 10:46:22 +03:00
Dmitry Petrov
ee5edf4caa JVM_IR fix 'remove' in inline class implementing MutableCollection 2020-10-16 00:02:12 +03:00
Alexander Udalov
95edcea9a9 Build: fix kotlinx-metadata-jvm publication
Co-authored-by: Vyacheslav Gerasimov <vyacheslav.gerasimov@jetbrains.com>
2020-10-15 21:13:50 +02:00
Ilya Kirillov
8dd80fe3c9 Wizard: fix maven testdata 2020-10-15 21:47:42 +03:00
Ilya Kirillov
394245ba4c Wizard: do not run compose tests for Groovy dsl 2020-10-15 21:47:39 +03:00
Ilya Kirillov
ec1528e742 Wizard: use custom Kotlin version for compose project 2020-10-15 21:47:38 +03:00
Ilya Kirillov
b0bb03d761 Wizard: return junit back to android target 2020-10-15 21:47:36 +03:00
Ilya Kirillov
42914b4046 Wizard: add resolutionStrategy for mpp library template 2020-10-15 21:47:32 +03:00
Ilya Kirillov
f5d638eb8f Wizard: do not create empty local.properties file 2020-10-15 21:47:30 +03:00
Ilya Kirillov
aeff3c2682 Wizard: regenerate tests 2020-10-15 21:47:28 +03:00
Ilya Kirillov
b7017c233e Wizard: use different Kotlin version for compose templates 2020-10-15 21:47:25 +03:00
Ilya Kirillov
1cc007fcbf Wizard: introduce Compose MPP template 2020-10-15 21:47:23 +03:00
Ilya Kirillov
7422690ea1 Wizard: fix InvalidModuleDependencyError error message 2020-10-15 21:47:19 +03:00
Ilya Kirillov
2a5679e0c6 Wizard: make project templates list scrollable 2020-10-15 21:47:16 +03:00
Ilya Kirillov
db069c3264 Wizard: add compose desktop template 2020-10-15 21:47:08 +03:00
Ilya Kirillov
d547cb9ee6 Wizard: introduce mobile mpp module template & allow module templates for mpp modules 2020-10-15 21:47:04 +03:00
Ilya Kirillov
ac6b9e4aa0 Wizard: add android extensions plugin only by flag 2020-10-15 21:47:02 +03:00
Ilya Kirillov
ed924a1c99 Wizard: change custom maven repositories rendering 2020-10-15 21:47:00 +03:00
Ilya Kirillov
31dac65a39 Wizard: remove extra line break in build files 2020-10-15 21:46:57 +03:00
Ilya Kirillov
9948c265df Wizard: add setting to hide version & groupId in gradle 2020-10-15 21:46:56 +03:00
Ilya Kirillov
d3e99bd7a7 Wizard: simplify custom maven repository syntax for Gradle 2020-10-15 21:46:55 +03:00
Ilya Kirillov
3ef12e32ee Wizard: update libraries versions 2020-10-15 21:46:51 +03:00
Ilya Kirillov
fa8951c19e Wizard: move common repositories to the allprojects section 2020-10-15 21:46:49 +03:00
Ilya Kirillov
e824199169 Wizard: remove resolutionStrategy from settings.gradle 2020-10-15 21:46:48 +03:00
Ilya Kirillov
8b89eb5dc8 Wizard: clean activity_main.xml & AndroidManifest.xml files 2020-10-15 21:46:41 +03:00
Ilya Kirillov
733cd8891a Wizard: simplify android configuration 2020-10-15 21:46:40 +03:00
dependabot[bot]
4858b72a8d Bump junit from 4.11 to 4.13.1 in /libraries
Bumps [junit](https://github.com/junit-team/junit4) from 4.11 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.11.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.11...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:38:43 +02:00
dependabot[bot]
f69928d2b1 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:38:23 +02:00
dependabot[bot]
845d6ae063 Bump junit in /libraries/tools/kotlin-maven-plugin/src/it/simple
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:38:06 +02:00
dependabot[bot]
b778298486 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:56 +02:00
dependabot[bot]
f3c26af0c7 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:40 +02:00
dependabot[bot]
c2ed625f25 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:24 +02:00
dependabot[bot]
e9255c8f17 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:10 +02:00
dependabot[bot]
41123be3a2 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:55 +02:00
dependabot[bot]
3f27bb374a Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:41 +02:00
dependabot[bot]
fb7736377c Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:25 +02:00
dependabot[bot]
df202c9b3f Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:12 +02:00
dependabot[bot]
7fe9966e02 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:56 +02:00
dependabot[bot]
046ed1e08c Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:41 +02:00
dependabot[bot]
0396ed29cc Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:27 +02:00
dependabot[bot]
2a9e6df9b1 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:12 +02:00
dependabot[bot]
1bf2a6b013 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:34:54 +02:00
dependabot[bot]
797c02e1cb Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:34:39 +02:00
dependabot[bot]
916f9766ad Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:34:05 +02:00
dependabot[bot]
c012b16430 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:33:55 +02:00
dependabot[bot]
74ad4eb00e Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:33:35 +02:00
dependabot[bot]
e888f54ae8 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:33:14 +02:00
Alexander Udalov
0eea089cc1 Merge pull request #3821 from JetBrains/dependabot/maven/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld/junit-junit-4.13.1
Bump junit from 4.9 to 4.13.1 in /libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld
2020-10-15 20:33:06 +02:00
dependabot[bot]
209d5fd6c9 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:32:53 +02:00
Mikhael Bogdanov
c8e84f82eb Proper check NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT in new jvm-default modes
#KT-42699 Fixed
2020-10-15 16:26:00 +02:00
Mikhael Bogdanov
b6dc99b98e Skip java defaults in EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE check
#KT-42674 Fixed
2020-10-15 16:26:00 +02:00
sebastian.sellmair
a60febbdfb KotlinMPPGradleProjectResolver: Ensure that artifactsMap is populated when Android plugin applied
#KT-42381 fixed
2020-10-15 13:23:21 +00:00
Victor Turansky
b42795a9ea Bump 'com.gradle.plugin-publish' from 0.11.0 to 0.12.0 (#3853) 2020-10-15 15:46:34 +03:00
Juan Chen
09acea5548 [FIR]: Set proper classId to enum entries
FirVisibilityChecker::isVisible checked if a private declaration can be
accessed at a use site by matching class ids of the private
declaration's owner with the use site's containing class
declarations. When the private declaration is defined in an enum
entry and used in the same entry, its owner class id has the enum
entry name, but the use site is in an FirAnonymousObject, which has
"anonymous" as the class id. This causes visibility check to fail.

This PR fixes owner class ids of declarations defined in enum entries
to be the same as normal anonymous objects.
2020-10-15 14:46:22 +03:00
Jinseong Jeon
ed188204b4 FIR checker: make property init analyzer path-sensitive
In particular, exception throwing path after finally block is
distinguished via path label.

KT-42350 Fixed
2020-10-15 14:22:39 +03:00
Jinseong Jeon
6fc3f7e776 FIR CFG: label edges from try-enter through finally block to exit target 2020-10-15 14:22:39 +03:00
Jinseong Jeon
43852ad7ab FIR CFG: add edges from try/catch to finally 2020-10-15 14:22:39 +03:00
Jinseong Jeon
ea2f773e54 FIR checker: reproduce KT-42350 2020-10-15 14:22:38 +03:00
Alexander Udalov
da69e3db7c kotlinx-metadata-jvm: report error on using metadata version < 1.4 in writers
The main reason for this change is that the current API for class
version requirements (`KmClass.versionRequirements`) makes it impossible
to support pre-1.4 metadata where this was stored incorrectly for nested
classes: with the "version requirement table" in the outer class, and
indexes into that table in nested classes. See KT-41011.

Other than this aspect, metadata of classes is basically the same in
pre-1.4 and 1.4, which means that if some kotlinx-metadata-jvm users
really need to serialize metadata of an earlier version and they don't
care about the version requirements issue, they can just use these new
bytes but write the earlier version (e.g. 1.1) to the class file.
Everything will work the same, except for the possible version
requirements issue mentioned above.

Note that metadata version 1.4 is still supported for
`KotlinModuleMetadata.Writer` though.

 #KT-41011 Fixed
2020-10-15 13:10:01 +02:00
Alexander Udalov
5d7d9beb0d kotlinx-metadata-jvm: remove bytecodeVersion from write methods
Bytecode version has never been used meaningfully in Kotlin, and will be
removed in a future release, so there's no point in using it. See
KT-41758.
2020-10-15 13:10:01 +02:00
Alexander Udalov
90d66b0ba5 kotlinx-metadata: reformat, cleanup, fix inspections 2020-10-15 13:10:01 +02:00
Roman Artemev
c89c31cd29 [KLIB] Fix package name (js -> common) 2020-10-15 13:55:06 +03:00
Roman Artemev
07a1124b99 [KLIB] Support error code in metadata 2020-10-15 13:55:06 +03:00
Roman Artemev
f4830c88b9 [JS IR] Make error code tests modular 2020-10-15 13:55:06 +03:00
Roman Artemev
0f7032051b [JS IR] Fix klib generation (proper order of flags) 2020-10-15 13:55:06 +03:00
Roman Artemev
a4945878aa [KLIB] Pass containsErrorCode flag from library/IC cache into deserializer
- Make deserializer track whether error node are allowed.
2020-10-15 13:55:05 +03:00
Roman Artemev
28c6d17ab4 [KLIB] Mark klib that contains error with special flag 2020-10-15 13:55:05 +03:00
Roman Artemev
98e5510871 [KLIB] Support IrError* nodes in serialization 2020-10-15 13:55:05 +03:00
Roman Artemev
934141f8af [KLIB] Support IrError* nodes in klib proto
- add proto messages
 - regenerate java-proto
 - support in reader to make code compiled
2020-10-15 13:55:05 +03:00
Roman Artemev
8ce497c7ef [IR] Add wrapped descriptor for error declaration 2020-10-15 13:55:05 +03:00
Mikhail Zarechenskiy
eacc94a89d Do not hide synthetic properties except isEmpty from Java
In order to hide synthetic property isEmpty from JDK 15, there was
 added additional logic in 5cc12b49fc but
 it also lead to the fact that now it's impossible to call synthetic
 property `declaringClass` on `Enum` as it's in the same list as method
 isEmpty(). Note that it's questionable behavior, probably we should
 also hide `declaringClass` as well but for now we turn it back to
 preserve compatibility

 #KT-42467 Fixed
2020-10-15 12:26:17 +03:00
Yaroslav Chernyshev
4227e2dc40 [Cocoapods] Fix task and directory naming to avoid subspecs collision
Logics of generating name for dependencies downloaded from git or url
admits producing tasks with forbidden symbols inside name for subspecs.
This fix introduces replacing of forbidden symbols for such purposes.

#KT-42550 Fixed
2020-10-15 09:59:33 +03:00
Jinseong Jeon
b8817d5884 FIR2IR: clean up dead code regarding overriding utils 2020-10-15 08:47:46 +03:00
Jinseong Jeon
5f64d6ec76 FIR2IR: add support for callable reference to Java field
#KT-42656 Fixed
2020-10-15 08:47:46 +03:00
Jinseong Jeon
65545a10c4 FIR: reproduce KT-42656 2020-10-15 08:47:46 +03:00
Derek Bodin
96834d6f4c Update example for default buildList to not use capacity KT-41136 (#3688) 2020-10-15 01:56:57 +03:00
Vladimir Dolzhenko
d9b3f91d73 Support hasError in ide perf tests vega charts 2020-10-15 00:09:48 +02:00
Vladimir Dolzhenko
051d914996 Align ide perf tests vega charts with json reports camelCase propNames
fix handling test errors
2020-10-14 21:31:03 +02:00
Ilya Kirillov
98efdaa523 FIR IDE: fix KtTypeRendererTest 2020-10-14 22:11:12 +03:00
Ilya Kirillov
5cda4b5ab3 fix test generator compilation 2020-10-14 22:11:12 +03:00
Ilya Kirillov
29151665e1 FIR IDE: add fir ide plugin tests task 2020-10-14 22:11:11 +03:00
Ilya Kirillov
bd68b937e5 FIR: ignore testdata directory in testPsiConsistency test 2020-10-14 22:11:10 +03:00
Ilya Kirillov
5c798d4e13 FIR IDE: fix test data in fir-ide module 2020-10-14 22:11:10 +03:00
Ilya Kirillov
6086b54a06 FIR IDE: do preliminary highlighting in completion tests considering exceptions 2020-10-14 22:11:09 +03:00
Ilya Kirillov
b9cf9d8bc5 FIR IDE: add missing test dependency 2020-10-14 22:11:09 +03:00
Ilya Kirillov
2f093e76b0 FIR IDE: render resolve phase for lazy resolve tests 2020-10-14 22:11:08 +03:00
Ilya Kirillov
9c53c66bb5 FIR IDE: actualize testdata for idea-frontend-fir module 2020-10-14 22:11:08 +03:00
Ilya Kirillov
a585d20639 FIR IDE: fix bodies calculator for property acessors 2020-10-14 22:11:07 +03:00
Ilya Kirillov
ab4faa52f0 FIR IDE: add missing IdeSessionComponents for FirIdeBuiltinsAndCloneableSession 2020-10-14 22:11:06 +03:00
Ilya Kirillov
a22514cf8e FIR IDE: separate lazy phase into 3 phases, add contracts phase 2020-10-14 22:11:06 +03:00
Ilya Kirillov
c418140bef FIR IDE: fix test dependencies 2020-10-14 22:11:05 +03:00
Ilya Kirillov
dc467f7d6c FIR: add test which checks that we do not access lazy bodies & lazy expressions till contract phase 2020-10-14 22:11:04 +03:00
Ilya Kirillov
7611135a4a FIR: add raw fir building delegate expression test 2020-10-14 22:11:04 +03:00
Ilya Kirillov
971e551bae FIR IDE: implement lazy delegate initializers 2020-10-14 22:11:00 +03:00
Ilya Kirillov
3f9735dd5d FIR: use enum in RawFirBuilder to indicate its mode: normals, stubs, or lazy bodies 2020-10-14 22:11:00 +03:00
Ilya Kirillov
81d4371685 FIR IDE: generate lazy initializers for properties 2020-10-14 22:10:59 +03:00
Ilya Kirillov
7c1170722f FIR: add FirLazyExpression node 2020-10-14 22:10:58 +03:00
Ilya Kirillov
71b5b6df7c FIR IDE: add tests for lazy resolving single declaration in file 2020-10-14 22:10:58 +03:00
Ilya Kirillov
f4199a0729 FIR: add ability to render declaration phase in FirRenderer 2020-10-14 22:10:57 +03:00
Ilya Kirillov
bbf450703f FIR: introduce stub bodies raw fir test case 2020-10-14 22:10:56 +03:00
Ilya Kirillov
d2d330c3be FIR IDE: implement lazy functions, constructors & accessors bodies building for raw fir
test
2020-10-14 22:10:56 +03:00
Ilya Kirillov
4fae9cbdb0 FIR: introduce FirLazyBlock node 2020-10-14 22:10:55 +03:00
Ilya Kirillov
864800902b FIR IDE: introduce WeakFirByPsiRef 2020-10-14 22:10:55 +03:00
Mads Ager
17748b4499 [JVM_IR] Fix off-by-one line number error in CoroutineCodegen.
Fixes KT-41957.
2020-10-14 20:57:42 +02:00
pyos
13def12731 IR: remove unnecessary calls to deepCopyWithSymbols
to make it harder to hide incorrect uses.
2020-10-14 20:25:20 +02:00
Alexander Udalov
45a0850d95 Fix KotlinType.isNullabilityFlexible for types based on type parameters
In the compiler, this function was used in psi2ir (and it affected
nullability annotations in the resulting JVM class files), in "useless
elvis with null on the right side" diagnostic checker, and in light
classes.

 #KT-42650 Fixed
2020-10-14 19:32:51 +02:00
Alexander Udalov
fbf56c054b JVM IR: fix names of $annotations methods for internal properties
#KT-40384 Fixed
2020-10-14 19:32:51 +02:00
Alexander Udalov
3f73be391f JVM IR: fix names of $annotations methods with inline classes in signature
#KT-40385 Fixed
2020-10-14 19:31:58 +02:00
Alexander Udalov
1df3bafbaf Minor, fix and unmute fieldNameClash.kt test
#KT-31927
2020-10-14 16:53:58 +02:00
Alexander.Likhachev
ec877843fc [Gradle, K/N] Increase Xmx for MPP tests with native 2020-10-14 17:13:32 +03:00
Mikhail Glukhikh
babc7845af FirSyntheticPropertiesScope: support case with derived getter
#KT-42496 Fixed
2020-10-14 16:33:44 +03:00
Mikhail Glukhikh
2f9b7495fc [FIR2IR] Make safe call result always nullable 2020-10-14 16:33:37 +03:00
Dmitry Petrov
d623f4d1d6 Add test for KT-40190 2020-10-14 16:05:15 +03:00
Alexander.Likhachev
d3f98923dc [Gradle, JS] Fix K/JS project build with configuration cache enabled
KT-42494 Fixed
2020-10-14 15:10:34 +03:00
Alexander.Likhachev
82a66bc659 [Gradle, K/N] Remove wasm from VariantAwareDependenciesIT 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
e505c6473d [Gradle, K/N] Remove check for export API from libraries producing test 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
72ad581fe4 [Gradle, K/N] Change prefix of apple-specific tests to native-*
The commit does nothing but renaming of directories
2020-10-14 15:10:34 +03:00
Alexander.Likhachev
3ab99c1f96 [Gradle, K/N] Reduce number of targets in MPP tests 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
3dda02459d [Gradle, K/N] Add more cases for cinterop test 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
be7cc32c10 [Gradle, K/N] Add export API test for frameworks 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
7c2339bcad [Gradle, K/N] Move compiler version change to separate test 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
f0aa4a59e3 [Gradle, K/N] Tests cleanup 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
4b68678a36 [Gradle, K/N] Add release binaries to generate binaries tests 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
08ee702d19 Update Kotlin/Native: 1.4.30-dev-16766 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
5dd1e75793 [Gradle, K/N] Configure memory properties for tests in single place 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
780b85e3ec [Gradle, K/N] Simplify testNativeTests test by reducing number of targets 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
882f442848 [Gradle, K/N] Simplify native cinterop test 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
7523b401c3 [Gradle, K/N] Remove wasm32 from mpp tests compile tasks 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
79ba6df7b8 [Gradle, K/N] Remove "kotlinx.html" maven repository from tests 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
03ee0f60ea [Gradle, K/N] Add workaround for iOS simulator warning report check 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
00cbfa9eb4 [Gradle, K/N] Simplify native binaries DSL test 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
4f8503dc30 [Gradle, K/N] Reduce number of targets in tests 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
8aa9ef5049 [Gradle, K/N] Enable compiler daemon in tests 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
923e7f7de5 [Gradle, K/N] Create new framework producing test 2020-10-14 15:10:32 +03:00
Ilya Matveev
76e03842ae [Gradle, K/N] Refactor native-specific Gradle tests 2020-10-14 15:10:32 +03:00
Ilya Matveev
71fe60f4a2 [Gradle, K/N] Rename native native-specific test projects
Some native-specific tests was moved from NewMultiplatformIT
but test projects used by them still have the "new-mpp" prefix.
This patch replaces this prefix with "native".
2020-10-14 15:10:32 +03:00
Ilya Matveev
174e390d2c [Gradle, K/N] Add separate tasks for native-specific Gradle tests
Native-specific tests are removed from default test tasks.
2020-10-14 15:10:32 +03:00
Ilya Matveev
d971817c32 [Gradle, K/N] Move native-specific tests to a separate class from MPP
This patch just copies the tests without any refactoring.
2020-10-14 15:10:31 +03:00
Jinseong Jeon
4d28463f1a FIR CLI: initialize module and dependencies
#KT-42624 Fixed
2020-10-14 14:56:37 +03:00
Yaroslav Chernyshev
01ba1cded7 [Cocoapods] Minor. Fix CocoaPodsIT, test data update 2020-10-14 12:21:58 +03:00
Alexander Dudinsky
36dd883768 Update testData of testKt28385 for 202 version 2020-10-14 12:15:07 +03:00
Roman Artemev
9ef7273641 Unmute stdlib tests after bootstrap advance. 2020-10-14 12:06:02 +03:00
Dmitriy Dolovov
3d8b614778 [Commonizer] Allow debugging through "runCommonizer" Gradle task 2020-10-14 09:33:12 +03:00
Dmitriy Dolovov
f49f5cb3d5 [Commonizer] Fix classpath for "runCommonizer" Gradle task 2020-10-14 09:33:06 +03:00
Ilya Kirillov
f27bf04911 Perf test: remove info markers in testdata before test 2020-10-14 02:04:10 +03:00
Pavel Punegov
4b3455dfa1 Set backend for the test 2020-10-13 22:02:16 +03:00
nataliya.valtman
58ed1bbb64 Can't use configure action from Immutable state
#KT-42413 Fixed
2020-10-13 21:02:00 +03:00
Dmitriy Novozhilov
9147aa76b5 Advance bootstrap to 1.4.30-dev-1423 2020-10-13 20:50:10 +03:00
Dmitry Petrov
052f345a17 JVM_IR no generic signatures for abstract stubs KT-42609 2020-10-13 19:20:29 +03:00
Dmitry Petrov
c8bf74c7d5 Bytecode listing test fails if JVM and JVM_IR have same testData 2020-10-13 19:20:29 +03:00
Nikolay Krasko
51e2b9d33d Enable signing using gpg in KotlinBuildPublishingPlugin (KTI-355)
Add skip for generated Sign task because otherwise added
 signatory is forcing task activation.

```Execution failed for task ':kotlin-allopen:signMainPublication'.
org.gradle.api.InvalidUserDataException: Cannot perform signing task
':kotlin-allopen:signMainPublication' because it has no configured
signatory```

 #KTI-355 Fixed
2020-10-13 18:29:32 +03:00
Alexander Udalov
1b39a235d8 JVM IR: sort multifile part names in metadata 2020-10-13 16:40:53 +02:00
Alexander Udalov
b257b03152 JVM IR: do not generate JvmName on multifile parts
#KT-36970 Fixed
2020-10-13 16:40:52 +02:00
Alexander Udalov
0eccb9661f JVM IR: simplify staticDefaultFunctionPhase
Also fix quadratic complexity similar to the previous commit.
2020-10-13 16:11:17 +02:00
Alexander Udalov
1859d4d340 JVM IR: avoid quadratic complexity in InheritedDefaultMethodsOnClassesLowering
Visiting all children and not stopping on classes made
`ClassLoweringPass.runOnFilePostfix` perform with the complexity of the
square of the amount of class nesting levels.
2020-10-13 16:11:17 +02:00
Vladimir Dolzhenko
5ca4c2ce1a Use camelCase propNames in ide perf tests json stats; report hasError 2020-10-13 15:17:45 +02:00
Jinseong Jeon
bc6693fa6e FIR2IR: element-wise SAM conversion for vararg 2020-10-13 15:40:06 +03:00
Nikolay Krasko
5d394528f6 Fix double publication of javadoc in kotlin-osgi-bundle (KTI-356)
There's a common place with generating empty javadoc:
635ffcd53b/libraries/pom.xml (L187)

 #KTI-356 Fixed
2020-10-13 15:16:14 +03:00
Dmitry Savvinov
e06ae01c0c Restore nullability after type refinement along with annotations
See the issue for details

^KT-42546 Fixed
2020-10-13 13:48:43 +03:00
Ilya Kirillov
ee794f8664 FIR IDE: add check canceled between diagnostics 2020-10-13 12:03:06 +03:00
Pavel Kirpichenkov
9dd3d8fb14 [NI] Fix extension function check after commonization
`isExtensionFunction` property is false for suspend functions
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
c53011dd04 [FIR] mute builder inference test
^KT-42591 Open
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
39a87435ee [FIR/NI] Refactor type variable gathering from lambda types
Motivation:
- drop getArguments from type context as a duplicate of getArgumentList
- reduce the number of collection allocations in getAllDeeplyRelatedTypeVariables

Additional minor improvements, test data fixes
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
ef44077cb7 [FIR] Restore variable fixation direction in call completion
Several tests are affected by the usage of fixation direction calculator in FIR.
Restored to mimimize test data changes.

It is unnecessary in FE10 because a type variable with unknown type
is inferred into an error type, but affects test data in FIR where
Nothing/Any is selected by direction (as a temporary measure).

CR candidate in spec test is Unresolved in FIR because top-level CRs are resolved as call arguments.
Resolution ambiguity is also present in FE10 when CR is wrapped into an id call.
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
712a2ce1ab [FIR] Improved lambda completion: initial implementation
Repeat the logic of KotlinConstraintSystemCompleter in ConstraintSystemCompleter.
Implement additional context operations required for updated lambda completion algorithm.
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
5eae6f2f4e [FIR] Move PostponedArgumentInputTypesResolver to resolution.common 2020-10-13 11:00:20 +03:00
Pavel Kirpichenkov
3822a32fce [FIR] Prepare commonization of PostponedArgumentInputTypesResolver 2020-10-13 11:00:20 +03:00
Victor Petukhov
0685beb765 NI: do substitution type variables during updating trace for lambda (these type variables can appear after the builder inference)
^KT-42450 Fixed
2020-10-13 10:21:55 +03:00
dependabot[bot]
1ca5bef7e6 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-12 22:18:57 +00:00
Alexander Udalov
e399b4cd12 JVM IR: minor, sort ElementType fields as in the old backend
In the old backend, targets are generated in the order of their
declaration in the ElementType enum, see AnnotationCodegen.java:306
(EnumSet guarantees such iteration ordering).

This has no effect other than reducing non-essential differences when
comparing ABI of JVM vs JVM_IR.
2020-10-12 21:38:09 +02:00
Alexander Udalov
1daeebcdd3 Minor, add regression test
#KT-42562
2020-10-12 21:37:37 +02:00
pyos
2ff011af17 JVM_IR: add an assertion and a comment about property references
I once again forgot why we don't cache property reference classes and
had to refer to the internal chat.
2020-10-12 21:14:00 +02:00
pyos
1663619606 JVM_IR: add local delegated property metadata to non-synthetic classes
Otherwise kotlin-reflect won't find it (and it won't even be serialized
anyway).

 #KT-42562 Fixed
2020-10-12 21:14:00 +02:00
pyos
2974004de4 JVM_IR: make PropertyReferenceLowering less quadratic
ClassLoweringPass creates a visitor and calls lower() on each class,
which then creates another visitor that does not override `visitClass`
to ignore the nested classes. This is generally not a good idea.
2020-10-12 21:14:00 +02:00
Ilmir Usmanov
d7b9920eba Treat field initializer as class initializer
when checking for allowance of other field initialization in lambda
with EXACTLY_ONCE contract.
 #KT-40948 Fixed
2020-10-12 20:16:21 +02:00
Ilmir Usmanov
3b5706972e Extract effect from lambda argument if it is in parentheses
Otherwise, contracts on the parameter have no effect.
 #KT-42044 Fixed
 #KT-26229 Fixed
2020-10-12 20:16:19 +02:00
Dmitry Petrov
df64bb3eb7 JVM_IR emulate JVM hack for generic signatures in KT-18189
KT-40307

See also KT-42609
2020-10-12 21:14:48 +03:00
Steven Schäfer
f20a695c0e Minor: Rebase testGenericConstructorCallWithTypeArguments 2020-10-12 17:34:34 +02:00
Victor Petukhov
c89461e654 JSpecify: add gradle task to download JSpecify test suite 2020-10-12 17:33:35 +03:00
Victor Petukhov
d0cd7a4008 JSpecify: exclude test running from the common test task 2020-10-12 17:33:35 +03:00
Victor Petukhov
9dab052266 JSpecify: implement tests generator and test runner with checking compliance of kotlin diagnostics and jspecify marks 2020-10-12 17:33:35 +03:00
Victor Petukhov
f39e2d4a2d JSpecify: convert java use sites for existing tests to kotlin ones 2020-10-12 17:24:35 +03:00
Victor Petukhov
ce44f7d4d3 JSpecify: implement kotlin use sites to java ones converter 2020-10-12 17:24:31 +03:00
Victor Petukhov
520e35baaf JSpecify: rework tests – replace kotlin use sites to java ones with future j2k conversion 2020-10-12 17:24:29 +03:00
Victor Petukhov
8974128be4 JSpecify: remove annotations unsupported yet 2020-10-12 17:24:27 +03:00
Victor Petukhov
fb8bba4dfb Include kotlin reflect test runtime dependency for tests-java8 module to make jps tests running work 2020-10-12 17:24:26 +03:00
Vladimir Dolzhenko
677f5ca4e3 Don't keep ref to ABSENT_KOTLIN_INJECTION in companion object
As it prevents from dynamic reloading of plugin

^KT-39958 Fixed
2020-10-12 13:09:18 +00:00
Vladimir Dolzhenko
7c2112d014 Prepare for KT dynamic plugin: make EP dynamic
Relates to ^KT-38518
2020-10-12 13:09:17 +00:00
Vladimir Dolzhenko
0e7e24c498 Add more diagnostics to address invalid module
Relates to ^KT-42274
2020-10-12 13:03:22 +00:00
Roman Artemev
fa7104213c Temporary disable test until bootstrap is updated 2020-10-12 15:22:44 +03:00
Roman Artemev
f824bb6987 [JS BE] Merge Legacy and IR BE exceptions-related test data
- regenerate tests
 - add consistency test
2020-10-12 15:22:44 +03:00
Roman Artemev
c16b11a124 [JS IR BE] Fix throwable stuff to make exceptions similar to JVM 2020-10-12 15:22:43 +03:00
Roman Artemev
ff093d363a [JS IR BE] Fix Throwable ancestor transformation
Make sure that `message` and `cause` are properly configured

 - synchronize IR BE and Legacy behaviour
 - fix corresponding IR lowering
 - fix JS IR core runtime
 - add test
 - fix KT-39964
2020-10-12 15:22:43 +03:00
Roman Artemev
383146f836 [JS IR BE] Add compiler instrinsic to express undefined value in BE 2020-10-12 15:22:43 +03:00
Dmitriy Novozhilov
f794ced888 [FIR] Fix incorrect cluster creating in CFG dumps 2020-10-12 11:55:05 +03:00
Dmitriy Dolovov
3495ec198d Minor. Small clean-up in KLIB decompiler 2020-10-12 10:24:18 +03:00
Vladimir Dolzhenko
3eeaa07e0c Sync up plugin.xml AS42 with 202
Relates to #KT-42274
2020-10-12 06:49:43 +00:00
Mads Ager
f941733f13 [JVM_IR] Rebase init blocks stepping test that is working as intended. 2020-10-12 08:36:17 +02:00
Vladimir Dolzhenko
a9bc63dece Drop redundant legacy_name from ide perf tests json stats 2020-10-10 23:57:39 +02:00
Alexander Udalov
a4fb2a445f Minor, add spaces to diagnostic message 2020-10-09 22:11:37 +02:00
Alexander Udalov
ac39e4d89c Minor, add regression test
#KT-42554
2020-10-09 22:11:37 +02:00
pyos
6f9f437f15 IR: refuse to copy classes in InitializersLowering 2020-10-09 22:11:00 +02:00
pyos
e6c0575d3a JVM_IR: do not deep-copy suspend lambdas in initializers
This loses reflection metadata (and also sometimes fails). Which was
missing anyway - this is also fixed now.

 #KT-42554 Fixed
2020-10-09 22:11:00 +02:00
Mark Punzalan
8bc7370b92 ForLoopsLowering: Add PLUSEQ origin to increment to use IINC
instructions if possible.
2020-10-09 21:34:56 +02:00
Mark Punzalan
14137cb013 ForLoopsLowering: Remove additionalNotEmptyCondition as it is no
longer used in UntilHandler.
2020-10-09 21:34:56 +02:00
Mark Punzalan
ccbf7cc2ee ForLoopsLowering: Use last-exclusive for-loops for optimized until
progressions instead of decrementing "last".

#KT-41352 Fixed
2020-10-09 21:34:56 +02:00
Mark Punzalan
1adb130509 ForLoopsLowering: Move isLastInclusive to HeaderInfo. 2020-10-09 21:34:56 +02:00
Mark Punzalan
a093efde11 Add blackbox test for KT-42533. 2020-10-09 21:34:56 +02:00
Ilmir Usmanov
375d92cf67 Merge two consequent records in LVT
Otherwise, atomicfu will be unable to transform atomic variable usages.
2020-10-09 18:36:37 +02:00
Dmitry Petrov
91b8e32d43 Add ABI tests for classes extending Number and CharSequence 2020-10-09 16:36:35 +03:00
Dmitry Petrov
6dd2d8bbdb JVM_IR drop 'SpecialMethodWithDefaultInfo#needsArgumentBoxing' 2020-10-09 16:06:09 +03:00
Dmitry Petrov
a412596d8e JVM_IR emulate old back-end behavior in special bridges + inline classes
KT-42491 KT-42539
2020-10-09 16:06:08 +03:00
Dmitry Petrov
92fa13cbab Workaround for a possible compiler bug in object literals 2020-10-09 16:06:08 +03:00
Dmitry Gridin
23beaa5883 [formatter] add tests for line indent after properties
^KT-42560
2020-10-09 20:03:48 +07:00
Dmitry Gridin
434139d986 Revert "Add indent before accessor for extension property (KT-33131)"
This reverts commit ab34f8c7

^KT-42560 Fixed
2020-10-09 19:44:50 +07:00
Ilya Kirillov
852d705c71 FIR: optimize converting string expressions in raw FIR builder
Do get ASTNode for every string template entry as it is expensive operation
2020-10-09 15:00:56 +03:00
Ilya Kirillov
5937ffae4d FIR: optimize checking if placeholder projection for raw FIR builder 2020-10-09 15:00:55 +03:00
Ilya Kirillov
bbc641b390 FIR: do not get statement text for every statement in raw FIR builder
PsiElement.getText This is rather expensive operation
2020-10-09 15:00:55 +03:00
Ilya Goncharov
b1768d805f [Gradle, JS] Rename dukatMode to externalsOutputFormat
^KT-42339 fixed
2020-10-09 13:58:34 +03:00
Ilya Goncharov
3ad6d58153 [Gradle, JS] Execute dukat on import in both mode
^KT-42339 fixed

[Gradle, JS] Fix tests for dukat

^KT-42339 fixed

[Gradle, JS] Add tests on binaries-both mode

^KT-42339 fixed

[Gradle, JS] Remove snapshot versions

^KT-42339 fixed

[Gradle, JS] Fix file dependency resolution into imported package

^KT-42339 fixed
2020-10-09 13:58:34 +03:00
Ilya Goncharov
0a86beeb64 [Gradle, JS] Add descriptors to dependencies in configurations phase
- Add file collection dependencies to gradle node module building

^KT-42339 fixed
2020-10-09 13:58:34 +03:00
Ilya Goncharov
af65365d6a [Gradle, JS] Move gradle post processing after executing of dukat
^KT-42339 fixed

[Gradle, JS] Use 2 integrated tasks for dukat in both mode

^KT-42339 fixed

[Gradle, JS] Dukat into jar

^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
4eea52e4e7 [Gradle, JS] Add TaskAction on overriden method for integrated task
^KT-42339 fixed

[Gradle, JS] Temporarily used next version of dukat

^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
b37414ae0b [Gradle, JS] Add test on compilation with dukat binaries
^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
c1fe8defd2 [Gradle, JS] Dukat descriptors
^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
500fceb438 [Gradle, JS] Add binary dukat mode
^KT-42339 fixed

[Gradle, JS] Prepare sources and binary modes for dukat

^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Dmitry Savvinov
f50851a982 Fix testdata after migrating to NewKotlinTypeCheckerImpl in OverrideResolver
- In kt10409 both 'pipe'-declarations contain error type.
NewKotlinTypeChecker in OverrideResolver considers error types as equal,
thus they are matched as bound declarations, thus 'IterablePipeline'
isn't considered to contain abstract member, thus no suggestion to add
abstract modifier.
Because initially test was covering purely technical issue of working
with error types, instead of removing it completely the additional
abstract member has been added

- in kt10808 we don't add explicit type anymore because
'noTypeInference' is false, because both expected type and actual type
are error-types, and KotlinIntroduceVariableHandler explicitly uses type
checker with 'errorTypesEqualToAnything=false'.
Also, this change might be ultimately seen as small improvement, because
if one extracts something with error type, they would certainly prefer
it to have a proper type as soon as errors are resolved (i.e. additional
code/imports written), rather than having a useless Any-type.
2020-10-09 13:44:06 +03:00
Dmitry Savvinov
f02593074f Drop isEqualTypeConstructor in favour of areEqualTypeConstructors 2020-10-09 13:44:06 +03:00
Dmitry Savvinov
fc4b488d43 Use NewKotlinTypeChecker in OverridingUtil
This allows to use deep type refinement in OverridingUtil, fixing issues
with expect/actuals in composite types
2020-10-09 13:44:06 +03:00
Dmitry Savvinov
01d6181050 Add test on overriding declaration with a composite type with expect declaration 2020-10-09 13:44:06 +03:00
Dmitry Savvinov
f8b9011667 Minor: unify error reporting for fun/properties overriding 2020-10-09 13:44:05 +03:00
Dmitry Savvinov
ac63d8b3bf Unify code for checking return type on override for fun/property
This fixes issues with the refinement of property' return type because
for functions' return type we already perform refinement properly
2020-10-09 13:44:05 +03:00
Dmitry Savvinov
736ecf3e9f Add test case on overriding property of expect-type
Current behaviour is undesired, the fix is in the next commit
2020-10-09 13:44:05 +03:00
Dmitry Savvinov
ac107f362e Refine types of type parameters before checking their equality in OverridingUtil 2020-10-09 13:44:05 +03:00
Dmitry Savvinov
80f4061a3d Add test on override with expect in return type 2020-10-09 13:44:04 +03:00
Vladimir Dolzhenko
f8b8f94040 Adjust vega IDE performance test charts 2020-10-09 11:03:26 +02:00
Mikhail Glukhikh
a6efaf440a FIR supertypes: replace class phase even if it hasn't unresolved supers 2020-10-09 09:45:46 +03:00
Mikhail Glukhikh
94302614cd [FIR] Add forgotten resolving status of enum entries (by Dmitry) 2020-10-09 09:45:45 +03:00
Dmitriy Novozhilov
5fbe715871 [FIR] Add forgotten replacing resolve phase during type resolve 2020-10-09 09:45:45 +03:00
Mikhail Glukhikh
1f5797e929 Don't resolve annotation arguments in FirTypeResolveTransformer 2020-10-09 09:45:45 +03:00
Mikhail Glukhikh
6f89385aec Transform forgotten property annotations in FirTypeResolveTransformer 2020-10-09 09:45:44 +03:00
Mikhail Glukhikh
e5463be6ba Don't transform parameter default values in FirTypeResolveTransformer 2020-10-09 09:45:44 +03:00
Mikhail Glukhikh
bdec245424 Don't transform enum entry initializer in FirTypeResolveTransformer 2020-10-09 09:45:44 +03:00
Mikhail Glukhikh
880eb6da6c Don't transform delegated constructor args in FirTypeResolveTransformer 2020-10-09 09:45:43 +03:00
Alexander Udalov
949952e766 kotlinx-metadata: minor, remove incorrect ReplaceWith from IS_PRIMARY deprecation 2020-10-08 17:44:35 +02:00
Mads Ager
afd710292a [JVM_IR] Fix mangling of default argument stubs for internal methods.
The MethodSignatureMapper expected to be able to look at the body
of the default argument stub. That is of course not possible when
it is from an external dependency.

Instead, we go through the attribute owner to get to the method
the stub is a default argument adapter for.
2020-10-08 17:43:24 +02:00
Jinseong Jeon
8c88670185 FIR: copy constructor for typealias'ed inner/nested class 2020-10-08 16:33:13 +03:00
Svyatoslav Kuzmich
5e5712afbb [JS IR] Make JsExport not fail on companion objects (KT-37829) 2020-10-08 14:07:50 +03:00
Victor Petukhov
9f716ba37c Jspecify: Rename DefaultNotNull to DefaultNonNull 2020-10-08 14:00:10 +03:00
Victor Petukhov
c3bada44cf Jspecify: Rename NullnessUnknown to NullnessUnspecified 2020-10-08 14:00:10 +03:00
Victor Petukhov
2685c7efce Jspecify: Rename codeanalysis annotations to jspecify ones 2020-10-08 14:00:10 +03:00
Denis Zharkov
59bd7364ab Enhance bounds for type parameters after loops disconnection
Otherwise behavior might change because enhancement may force computation
for other type parameters in cases like:
class A<X extends Y, Y extends X> {}

See the test:
org.jetbrains.kotlin.checkers.DiagnosticsTestGenerated.Tests.J_k#testRecursiveRawUpperBound3
2020-10-08 14:00:10 +03:00
Denis Zharkov
6661814e40 Do not enhance star projections for bounds of raw types
We have an invariant that their lower bound is always
SomeType<Any?> and their upper bound is SomeType<*>.
Ehancing the latter to SomeType<out Any> making
lower bound not being a subtype of upper bound that breaks contract
for flexible types (fails with exception)
2020-10-08 14:00:10 +03:00
Denis Zharkov
16b4a2c465 Do not enhance type parameter bounds if they contain a raw type
Otherwise enhancement algorithm starts forcing lazy mutually recursive
computations that leads to RECURSION_IN_SUPERTYPES in complex cases
2020-10-08 14:00:09 +03:00
Denis Zharkov
c1b34a83e9 Fix enhancement behavior in case of error-typed upper bounds 2020-10-08 14:00:09 +03:00
Denis Zharkov
2964d52640 Add test case for codeanalysis annotation 2020-10-08 14:00:09 +03:00
Denis Zharkov
dfb1cb8642 Minor. Rename UnknownNullness -> NullnessUnknown 2020-10-08 14:00:09 +03:00
Denis Zharkov
0b958c8ac5 Fix annotation name in test data to DefaultNullnessUnknown 2020-10-08 14:00:09 +03:00
Denis Zharkov
f3a490ee16 Support compiler flag -Xcodeanalysis-annotations 2020-10-08 14:00:09 +03:00
Denis Zharkov
c734bac676 Minor. Reformat JavaNullabilityChecker.kt 2020-10-08 14:00:08 +03:00
Denis Zharkov
ce2b7bded6 Minor. Reformat AbstractForeignAnnotationsTest.kt 2020-10-08 14:00:08 +03:00
Denis Zharkov
90a9ca6cb3 Minor. Rename flag in JvmAnalysisFlags: jsr305 -> javaTypeEnhancementState 2020-10-08 14:00:08 +03:00
Denis Zharkov
93d9301847 Minor. Extract JavaTypeEnhancementStateParser::parseJsr305State 2020-10-08 14:00:08 +03:00
Denis Zharkov
e7208f0c05 Rename Jsr305Parser -> JavaTypeEnhancementStateParser 2020-10-08 14:00:08 +03:00
Denis Zharkov
6c37574fce Rename Jsr305State -> JavaTypeEnhancementState
Also, rename some of the properties
It's needed to store status for codeanalysis annotation in that class
2020-10-08 14:00:08 +03:00
Denis Zharkov
2f04a1505d Support enhancement for unbounded wildcards from codeanalysis annotations 2020-10-08 14:00:07 +03:00
Denis Zharkov
392ef9aa2b Support type arguments enhancement from type parameters bounds
Currently, only works for codeanalysis annotations because
type parameters bounds are enhanced only for them
2020-10-08 14:00:07 +03:00
Denis Zharkov
e9e05c53e1 Support enhancement for type parameter based types
Load them as non-flexible when a relevant type parameter has non-flexible upper bound
(Currently, it only works for case of codeanalysis annotations)
2020-10-08 14:00:07 +03:00
Denis Zharkov
fa2578c795 Prepare type enhancement for codeanalysis annotations
- Rename NullabilityQualifierWithApplicability -> JavaDefaultQualifiers
- Use JavaDefaultQualifiers instead of JavaTypeQualifiers for default qualifiers

This change is intended to make code more clear and to allow add some additional
parameters specific for default qualifiers needed for codeanalysis annotations
2020-10-08 14:00:07 +03:00
Denis Zharkov
e27501497b Support codeanalysis annotations on type parameters bounds 2020-10-08 14:00:06 +03:00
Denis Zharkov
82d39dd86a Add basic support for default codeanalysis annotations 2020-10-08 14:00:06 +03:00
Denis Zharkov
517cc84f4d Add initial support for codeanalysis annotations 2020-10-08 14:00:06 +03:00
Vladimir Dolzhenko
165a147dd8 Improved IDE performance tests vega specs 2020-10-08 12:26:45 +02:00
Roman Golyshev
0682084ca3 [FIR Completion] Generate part of performance tests for FIR completion 2020-10-08 11:10:50 +03:00
Mikhail Glukhikh
beac3757bc [IR text test] Minor: add forgotten .fir.txt file 2020-10-08 10:33:58 +03:00
Vladimir Dolzhenko
46535bbd9d Add IDE performance tests vega specs 2020-10-08 00:07:17 +02:00
Dmitriy Dolovov
280fcb5c4b IDE: IndexNotReadyException while creating new Kotlin file in Dumb mode
^KT-42518
2020-10-07 22:36:52 +03:00
Alexander Udalov
2f003bdcb5 Minor, add regression test
#KT-42527
2020-10-07 21:31:43 +02:00
pyos
af98720720 JVM_IR: move MoveOrCopyCompanionObjectFields down a bit
More specifically, it should be done *just before*
JvmPropertiesLowering, as walking the IR tree between them will result
in visiting the moved backing fields twice (once via the companion's
parent, once via the IrProperty).

Ideally, this group of 3 lowerings should be merged into 1 as they are
completely inseparable, but this is slightly harder to do properly.

 #KT-42527 Fixed
2020-10-07 21:31:19 +02:00
pyos
dd1682510f JVM_IR: generate accessors for inherited abstract members too
#KT-41468 Fixed
2020-10-07 21:23:18 +02:00
Alexander Udalov
68157f09fa Minor, add temporary workaround for KT-42492 2020-10-07 19:33:40 +02:00
Roman Golyshev
7833698038 [FIR IDE] Fix idea-fir-performance-tests module references 2020-10-07 19:45:03 +03:00
Ilya Kirillov
efef18c2ca FIR IDE: mute not passing highlighting test 2020-10-07 19:45:02 +03:00
Ilya Kirillov
96422ea3fe FIR IDE: introduce highlighting performance test 2020-10-07 19:45:01 +03:00
Denis Zharkov
5cc12b49fc Hide java.lang.CharSequence::isEmpty from Kotlin built-in class
Also, prohibit using it as a synthetic property

^KT-42467 In progress
2020-10-07 17:48:19 +03:00
Denis Zharkov
90044f9672 Use correct naming for additional built-in member lists 2020-10-07 17:48:19 +03:00
pyos
98088f739d PSI2IR: do not generate when subjects multiple times
`in x` is represented as `<subject expression> in x` in psi, so
generating the entire call and then replacing the argument with a read
of a temporary results in redundant regenerations of the subject.

 #KT-42054 Fixed
 #KT-42455 Fixed
2020-10-07 17:22:25 +03:00
Alexander Udalov
e280416fe2 Minor, add regression test 2020-10-07 14:31:01 +02:00
pyos
8ef0fdf021 JVM_IR: remove two outdated comments 2020-10-07 14:30:36 +02:00
pyos
f7441813a9 JVM_IR: move SuspendLambdaLowering to a separate file 2020-10-07 14:30:36 +02:00
pyos
a6c62d3339 JVM_IR: do not inherit delegated property trackers
This is no longer needed now that lambdas are generated before
`$$delegatedProperties`.
2020-10-07 14:30:36 +02:00
pyos
05c856f1f7 JVM_IR: move SuspendLambdaLowering next to FunctionReferenceLowering
#KT-42253 Fixed
 #KT-39434 Fixed
2020-10-07 14:30:36 +02:00
pyos
44e0bfe90b JVM_IR: split AddContinuationLowering
One half handles suspend lambdas, the other - named functions.
2020-10-07 14:30:36 +02:00
pyos
4f171a9eb5 JVM_IR: move FunctionReference lowering before PropertyReference
so that `$$delegatedProperties` are generated in the lambdas' classes.
2020-10-07 14:30:36 +02:00
pyos
1190457759 JVM_IR: fix copying of receivers when unboxing inline class parameters
If an extension receiver is copied into a normal parameter, this may
later cause default argument masks to be shifted.
2020-10-07 13:21:50 +02:00
pyos
adcbfc7b4c IR: add an emptiness check to all unsigned until loops
Unlike signed integers, a larger unsigned type does not mean a lower
minimum value, so `x - 1` can overflow even if `x` is casted to a larger
type.

 #KT-42186 Fixed
2020-10-07 12:53:00 +02:00
pyos
4a03006162 Generate min/max constants as non-const in ranges tests
in order to make them appear as unknown values to codegen.
2020-10-07 12:53:00 +02:00
Pavel Punegov
260f66183c Don't ignore the test on JS backend as it doesn't fail any more. 2020-10-07 12:22:49 +03:00
Pavel Punegov
93b2ea2feb Regenerate tests 2020-10-07 12:18:12 +03:00
Pavel Punegov
a439860e12 Replace IGNORE_BACKENDs to TARGET_BACKEND for the Java test 2020-10-07 12:18:09 +03:00
Pavel Punegov
4d8ca074bc Ignore test for the full reflection in Native 2020-10-07 12:18:09 +03:00
Pavel Punegov
33d28b44fa Unmute typeOf tests in Native backend 2020-10-07 12:18:09 +03:00
Igor Yakovlev
d92aa94c6d [Usages] Provide BWC change for 1.4.20 and mark it as deprecated
Fixed #KT-42406
2020-10-07 12:09:59 +03:00
Vladimir Dolzhenko
23d33f51a2 Open build tool window on Gradle DSL errors
^EA-236697 Fixed
2020-10-07 10:46:52 +02:00
KotlinIsland
0e29f6f48b DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE: is -> are 2020-10-07 10:41:43 +02:00
Dmitry Gridin
9a0c3c47c8 [inspections] fix false positive "Redundant Unit" inspection in lambda with dynamic return type
^KT-40700 Fixed
2020-10-07 08:38:28 +00:00
Yaroslav Chernyshev
26d03295cf [Cocoapods] Remove hierarchical PodInstall dependsOn to Podspecs
#KT-41844 Fixed
2020-10-07 11:05:25 +03:00
Mikhail Glukhikh
e49f881e7f [FIR2IR] Add more clear exception about absent setter (see KT-42496) 2020-10-07 10:43:46 +03:00
Mikhail Glukhikh
aa4a042612 [FIR2IR] Use deepest matching symbol also for synthetic properties
#KT-42359 Fixed
2020-10-07 10:43:43 +03:00
Mikhail Glukhikh
fb4f27e136 [FIR2IR] Add test for problematic KT-42359 2020-10-07 10:43:38 +03:00
Jinseong Jeon
49307e243c FIR deserializer: load annotations on default accessors 2020-10-07 09:46:40 +03:00
Dmitriy Dolovov
c25742c91a kotlinx-metadata: Fix tests for Flag.Constructor.IS_SECONDARY flag
^KT-42429
2020-10-07 09:43:23 +03:00
Dmitriy Dolovov
52e56ca070 kotlinx-metadata: Wrong interpretation of Flag.Constructor.IS_PRIMARY
^KT-42429
2020-10-07 09:43:14 +03:00
Sergey Igushkin
3a5ffe479e General fixes for composite builds in HMPP
* Register project structure metadata providers globally, so included
  builds can access it from the root build.

* Rework some dependency management logic so that it doesn't assume that
  dependencies resolved to projects are safe to access – it is so only
  if the project is in the same build; also, in dependency handling, use
  proper keys which distinguish project with same ID in different
  builds.

* Add a separate implementation of `MppDependencyMetadataExtractor` that
  reads the project structure metadata from the mentioned global storage
  (as we can't read it from artifacts – those are not yet build at the
  project configuration phase) but when it comes to artifacts
  processing, takes real artifacts rather than introspect the project
  structure.

* Register the Kotlin/Native host-specific metadata artifact
  configurations as consumable, so that a consumer from a different
  build can properly resolve a dependency to such a configuration and
  get the artifact.
2020-10-06 23:26:17 +03:00
Sergey Igushkin
7d1a3a137b Publish MPP -metadata artifact in the root module, drop separate module
Until now, there was a separate module foo-metadata that contained the
Kotlin metadata artifacts. The reasons for this were only historical,
namely the platform modules used to depend on the metadata module and
expect it to bring the common sources to the IDE.

Now we don't really need the -metadata module, and it's now more harm
from it than good, as users never need to specify it as a dependency.

We fix this by removing the -metadata module from the default publishing
layout and putting the -metadata artifact(-s) directly to the root
module.
2020-10-06 23:26:17 +03:00
Sergey Igushkin
a0fbf54d11 Simplify matching of Kotlin variant name and Gradle configuration name
Earlier, the matching was non-trivial and required the consumer to look
through all of the producer's targets to find the Kotlin variant given
the name of the configuration that Gradle chose during variant-aware
dependency resolution. This is not feasible in composite builds as we
can't look into a project model of an included build.

To fix this, simplify the matching of the Gradle configuration name and
the Kotlin variant name by just using a suffix for the published
configurations.

Namely, instead of names like `jvm-api`, use the original configuration
name `jvmApiElements` for Kotlin variant names. To avoid ambiguity with
Gradle configurations (which we might want to customize for publishing,
like by altering the attributes or the published artifacts compared to
the configuration exposed for inter-project dependencies), create
publishing configurations
2020-10-06 23:26:16 +03:00
Sergey Igushkin
16d493558e HMPP resolution fixes
While we already had the associateWith relationship
that established additional visibility between such
source sets as fooMain and fooTest, this
relationship was not used properly when requested
dependencies were built for source set visibility
inference in HMPP. Instead, an old workaround was
used that just added dependencies of commonMain to
commonTest.

Fix this by using the associateWith relationship in
the preparation logic of source sets visibiltiy.

ALso, make the artifact view used in source sets visibility inference
lenient, so that a host-specific module that has not yet been published
won't lead to fail in source sets visibility and will instead be
ingored.
2020-10-06 23:08:01 +03:00
Sergey Igushkin
5963b07987 Use JSON as the format for the Kotlin project structure metadata 2020-10-06 23:08:01 +03:00
Sergey Igushkin
f19ef0184c Cleanup GranularMetadataTransformation after refactoring 2020-10-06 23:08:00 +03:00
Mads Ager
3817aa32a1 [IR] Move isAssignable to IrValueDeclaration. 2020-10-06 21:47:29 +02:00
Mads Ager
af0999ec6f [IR] Support isAssignable in builders and serialization. 2020-10-06 21:47:29 +02:00
Mads Ager
37145fb055 [JS_IR] Fix exponential behavior accidentally introduced. 2020-10-06 21:47:29 +02:00
Mads Ager
1f2ca606a5 [IR] Add isAssignable property to IrValueParameter.
Use it to check that only the value parameters that are explicitly
marked assignable are assigned.

Currently, the only parameters marked assignable are those for
default argument stubs.
2020-10-06 21:47:29 +02:00
Mads Ager
8d791ca98e [IR] Update naming, but not binary format for IrSetValue. 2020-10-06 21:47:29 +02:00
Mads Ager
33ab2299f9 [IR] Fix the type of the default argument mask condition.
On JVM and JS we can get away with using an Int but it really
should be a Boolean and Native reasonably insists on that.
2020-10-06 21:47:29 +02:00
Mads Ager
87f17dec4a [JS_IR] Use IrSetValue for default argument handling for JS backend.
Fix a couple of parameter remappings that now have to take IrSetValue
into account as well as IrGetValue.
2020-10-06 21:47:29 +02:00
Mads Ager
9a93bb3f09 [IR] Add IR support for setting parameters.
Use it in the JVM_IR backend for default values code. The parameter
local has to be overwritten for the inliner to work.
2020-10-06 21:47:29 +02:00
Ilya Chernikov
db23460fd5 Implement proper script runtime exception rendering with tests
#KT-42335 fixed
2020-10-06 21:43:11 +02:00
Ilya Kirillov
d5ad424e8f FIR: introduce source element mappings tests for raw FIR 2020-10-06 22:24:01 +03:00
Ilya Kirillov
a8ca2f8065 FIR IDE: fix diagnostics collection 2020-10-06 22:24:00 +03:00
Ilya Kirillov
551864d8c1 FIR: fix source element of FirQualifiedAccessExpression 2020-10-06 22:24:00 +03:00
Yan Zhulanow
c6de983476 Keep class members of the ExtensionPoint interface instead of its implementation for easier usage 2020-10-07 04:11:02 +09:00
Yan Zhulanow
0dc243d74c Parcelize: Don't activate both 'kotlin-parcelize' and 'kotlin-android-extensions' in IDE (KT-42267)
The actual problem is a lack of plugin activation check in ParcelableUltraLightClassModifierExtension (see how it should be done in ParcelizeUltraLightClassModifierExtension). However, ParcelableUltraLightClassModifierExtension lays inside ADT sources, and it's impossible to make an fast&easy fix from our side. However, we control the compiler plugin on which the IDE support is based, so the check is added there.

There should be no troubles if the application with 'kotlin-android-extensions' includes an Android library with 'kotlin-parcelize' or vise-versa, as runtime libraries of both plugins are attached to the 'implementation' Gradle configuration since AGP 2.5.
2020-10-07 04:11:02 +09:00
Yan Zhulanow
4c540152fe Parcelize: Forbid applying both 'kotlin-parcelize' and 'kotlin-android-extensions' (KT-42342) 2020-10-07 04:11:02 +09:00
Mads Ager
a37f16d7a2 [IR] Do not generate line numbers for synthesized data class members.
Fixes KT-41903.
2020-10-06 19:53:47 +02:00
Mikhael Bogdanov
5048471835 Properly check default kind on inheriting from old DefaultImpls scheme 2020-10-06 18:10:44 +02:00
Steven Schäfer
714d17ac63 Parcelize, JVM IR: Handle star projected and nullable arrays. 2020-10-06 17:42:35 +02:00
pyos
a6d5c02d9b JVM_IR: add a transformChildren call to PropertyReferenceLowering
#KT-42354 Fixed
2020-10-06 17:06:34 +02:00
Dmitry Petrov
b1bd138afb JVM_IR fix inline class <-> collection stubs issues
Move collectionStubMethodLowering before jvmInlineClassPhase, and make
them interact properly.

Note that some issues still remain in inline class <-> special bridges
interaction.

KT-40187 KT-42469
2020-10-06 17:08:24 +03:00
Alexander Udalov
2573eaa77f IR: do not crash renderer on functions with uninitialized return type
This is a follow-up to b497f39c29. It
turns out that it didn't help because `IrFunction.returnType` throws
exception, and checking for `IrUninitializedType` in `IrType.render` was
already too late. Throw and catch specific exception instead.

Also add function name into the exception message for better diagnostics
elsewhere (can't compute the full FQ name because in cases like
KT-42020, the parent is also uninitialized).
2020-10-06 14:23:34 +02:00
Alexander Udalov
06f1bd6101 Reformat IR tree declarations and implementations
Most of the changes are to the incorrect formatting introduced in
d1fd1da56f.
2020-10-06 14:21:40 +02:00
Mads Ager
b47e0e861b [PSI2IR] Use SYNTHETIC_OFFSET for delegated brigdes.
This allows kotlin-native to generate code in debug mode.
LLVM requires debug attributes for this code and SYNTHETIC_OFFSET
makes kotlin-native generate dummy debug attributes.
2020-10-06 13:32:55 +02:00
Mikhael Bogdanov
ed5c2b0565 Add tests for data class runtime string concatenation
#KT-35176
2020-10-06 13:20:41 +02:00
Mikhael Bogdanov
eb32a6ddbd Add test for for kt42457 wrong behaviour. Align runtime concatenation with it
#KT-42457
2020-10-06 13:20:40 +02:00
Mikhail Glukhikh
64fb114c30 FIR Java annotations: create vararg or Array depending on parameter name
#KT-42346 Fixed
2020-10-06 12:13:58 +03:00
Mikhail Glukhikh
f6b49a2c9a FirAnnotationArgumentChecker: handle conversion calls properly 2020-10-06 12:13:58 +03:00
Mikhail Glukhikh
6f432ea5dd [FIR] Add problematic test for KT-42346 (double vararg in annotation) 2020-10-06 12:13:57 +03:00
Mikhail Glukhikh
862fb6a405 FIR Java: make annotation parameters not-null 2020-10-06 12:13:57 +03:00
Ilya Goncharov
bcdc53d1c4 [Gradle, JS] Consider GString in npm dependencies parse in root dependencies
^KT-42462 fixed
2020-10-06 11:32:59 +03:00
Mikhael Bogdanov
39cde978d0 Minor. Rename test folder 2020-10-06 07:14:39 +02:00
Mikhael Bogdanov
d2c4be18a0 Rename runtime-string-concat option into 'string-concat' 2020-10-06 07:14:39 +02:00
LepilkinaElena
402f7df0d4 [IR] Save several last calculated line numbers not to recalculate them several times during code and debug info generation (#3792) 2020-10-06 08:03:50 +03:00
Roman Artemev
a52e045c91 [IR BE] Remap references in default arg value in inner class constructor
Make sure that there is no reference into zombie declarations.

 - fix KT-40771
 - add test
2020-10-06 00:06:47 +03:00
Roman Artemev
f597585ffb [IR BE] Refactor DefaultArgumentStubGenerator a bit 2020-10-06 00:06:46 +03:00
Ilya Chernikov
d7e0649d93 Automatically add -- after script/expression in kotlin runner
#KT-37987 fixed
2020-10-05 22:35:58 +02:00
Vladimir Dolzhenko
153217ae2e Clean up muted tests 2020-10-05 21:34:39 +02:00
Mikhael Bogdanov
b27955d268 Wrong specialization diagnostic is reported on java default inheritance 2020-10-05 20:09:21 +02:00
Jinseong Jeon
2d001a46fc FIR CFG traverser: do not skip graph enter node
#KT-42348 fixed
2020-10-05 19:48:12 +03:00
Jinseong Jeon
a154cf4c45 FIR checker: reproduce KT-42348 2020-10-05 19:48:11 +03:00
Vladimir Dolzhenko
be84110ada Clean up muted tests
Muted tests failed with `Range must be inside element being annotated` is fixed

Relates to ^KT-38959
2020-10-05 18:09:45 +02:00
Vladimir Dolzhenko
71d76bdb4b Revert "Perform shorten references under modal dialog"
This reverts commit 0b822aa4
2020-10-05 18:00:46 +02:00
Yaroslav Chernyshev
dcf18ec500 [Gradle, Cocoapods] Fix false-negative testCinteropExtraOpts failing 2020-10-05 16:40:32 +03:00
Ilya Gorbunov
76c5d036a8 Do not pack source of invisible runtime helpers to stdlib-js
Use reference sources of built-in Enum and Comparable instead.

KT-42318
2020-10-05 16:07:05 +03:00
Vyacheslav Gerasimov
4a9819bf9e Build: Upgrade gradle-enterprise plugin to 3.4.1 2020-10-05 15:57:10 +03:00
Vladimir Dolzhenko
0b822aa492 Perform shorten references under modal dialog
To prevent freezes and show progress to user shorten references has to be performed in a background thread

^KT-42170 Fixed
2020-10-05 11:41:56 +00:00
Vladimir Dolzhenko
36b3a8e0e3 Revert "Open build tool window on Gradle DSL errors"
This reverts commit 741df42c
2020-10-05 12:57:35 +02:00
Vladimir Dolzhenko
5eac949b43 Report EXPLICIT_DELEGATION_CALL_REQUIRED on relevant element
^KT-38959 Fixed
2020-10-05 09:43:05 +00:00
Jinseong Jeon
7af564c9f2 FIR: fix vararg remapping that merged named vararg 2020-10-05 12:33:03 +03:00
Vladimir Dolzhenko
29b23e79f3 Register EXPRESSION_CODE_FRAGMENT, BLOCK_CODE_FRAGMENT in KtStubElementTypes
Stubbed type has to be register earlier (see IStubFileElementType#checkNotInstantiatedTooLate)

Relates to ^KT-28732
2020-10-05 11:10:06 +02:00
Mikhail Glukhikh
3cd552cb43 [FIR2IR] Process anonymous object nested classes correctly
#KT-42373 Fixed
2020-10-05 12:06:53 +03:00
Mikhail Glukhikh
76cdf97b6d [FIR2IR] Set facade class for backing field properly #KT-42384 Fixed 2020-10-05 12:06:52 +03:00
Yaroslav Chernyshev
ad7ad98738 [Gradle, Cocoapods] Custom packageName and extraOpts for pods cinterop
#KT-40999 Fixed
2020-10-05 11:59:30 +03:00
Georgy Bronnikov
b0b971cd0a IR: Remove unused class 2020-10-05 11:02:12 +03:00
Georgy Bronnikov
80b7194799 IR: remove KotlinType usage from Ir.kt 2020-10-05 11:02:12 +03:00
Georgy Bronnikov
7afad9a91d Use wrapped descriptors in IrReturnableBlock 2020-10-05 11:02:12 +03:00
Georgy Bronnikov
38ee182f51 IR: remove unused AbstractClosureAnnotator 2020-10-05 11:02:11 +03:00
Ilmir Usmanov
5e02a4efd7 Mark implicit receiver as captured if the function is expression
#KT-40260 Fixed
 #KT-42280 Fixed
2020-10-05 09:36:54 +02:00
Dmitry Gridin
3078bd7b67 [formatter] line indent provider: fix indent for empty braces
^KT-42411 Fixed
2020-10-05 07:27:53 +00:00
Jinseong Jeon
380226cba0 FIR2IR: correct dispatch receiver inside inner class constructor 2020-10-05 09:12:19 +03:00
Jinseong Jeon
aa488eabc9 FIR2IR: distinguish constructor when picking return target 2020-10-05 09:09:39 +03:00
Ilya Chernikov
5ab822be36 Import scope of the imported script
#KT-34178
2020-10-02 18:53:31 +02:00
Ilya Chernikov
a71eab89e7 Remove unused code...
left after "Optimize scopes handling inside LexicalChainedScope"
refactoring commit.
2020-10-02 18:53:31 +02:00
Leonid Startsev
bdbf8d7980 Use correct class type when creating class references
(for e.g. PolymorphicSerializer)

Former class reference may had type arguments in it, which lead to bugs
in JS IR.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1072
2020-10-02 19:11:25 +03:00
Leonid Startsev
d4bdb0eedc Remove requirement on 'Serializable class must have single primary constructor'
#KT-38868 Fixed
 #KT-41627 Fixed
 Fixes https://github.com/Kotlin/kotlinx.serialization/issues/396
 Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1049
2020-10-02 19:11:25 +03:00
Ilya Goncharov
de8776ec1d [Gradle, JS] Support for groovy dsl and Pair in kotlin dsl
[Gradle, JS] Use package json custom fields as inputs

^KT-42400 fixed
2020-10-02 18:42:33 +03:00
Victor Petukhov
6c1dc43d25 Add check already fixed variables in PostponedArgumentInputTypesResolver during adding constraints on them and using inside a functional type
^KT-42374 Fixed
2020-10-02 18:31:54 +03:00
Ilya Goncharov
96ccf03794 [Gradle, JS] Test: Add yarn resolution by version shortcut
^KT-42420 fixed
2020-10-02 18:14:53 +03:00
Ilya Goncharov
18ec9f10f9 [Gradle, JS] Add yarn resolution by version shortcut
^KT-42420 fixed
2020-10-02 18:14:42 +03:00
Dmitriy Dolovov
07f78f5ab8 [Commonizer] Drop "kind" from CirClassConstructor
... as it is always CallableMemberDescriptor.Kind.DECLARATION
for serialized constructor declarations
2020-10-02 16:47:29 +03:00
Vladimir Dolzhenko
abc4aef403 Store kotlin-script-cache-dependencies as project file attribute
To avoid extra root project scan we need to store already processed script cache dependencies

^KT-41640 Fixed
2020-10-02 13:23:43 +00:00
Dmitry Petrov
941a506885 Add test for inline classes implementing collection interfaces
KT-40186
2020-10-02 14:06:07 +03:00
Ilya Chernikov
2828f0a814 Fix restoring script configuration from file attributes
#KT-41622 fixed
2020-10-02 12:38:22 +02:00
Ilya Chernikov
d88e87aaac Fix ScriptDefinition subtyping after earlier refactorings
#KT-41905 fixed
(may also fix other yet undetected or not analyzed problems with script
definitions)
2020-10-02 12:38:21 +02:00
Ilya Chernikov
adcfca3f98 Treat classpath extraction problems on script definition loading as warnings
#KT-44206 fixed
2020-10-02 12:38:21 +02:00
Vladimir Dolzhenko
741df42c18 Open build tool window on Gradle DSL errors
^EA-236697 Fixed
2020-10-02 10:08:49 +00:00
Dmitry Petrov
e018f2bd3e JVM_IR more precise check for special bridges in super class
KT-41123
2020-10-02 12:51:49 +03:00
Mikhael Bogdanov
cf5bd38bec JVM_IR. Support runtime string concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov
1938f9459f Support indy concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov
942e1962d9 Properly process constants 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
8a1f7c5859 Add TODO 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
c329c22630 Add runtime string concat options. Some renaming 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
04012951c1 Basic invokedynamic string concatenation support 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
88892ec65d Introduce StringAppendGenerator 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
bf35818438 Minor. Reformat 2020-10-02 11:47:27 +02:00
Mark Punzalan
b58d75440b [FIR] Fix tests for vararg execution order after rebase. 2020-10-02 12:08:07 +03:00
Mark Punzalan
e175e87225 [FIR] Change type of argumentMapping properties and parameters from Map
to LinkedHashMap, to signify that the order is important and we don't
assume that mutableMapOf() will always return a LinkedHashMap.
2020-10-02 12:08:06 +03:00
Mark Punzalan
6b83f2d70e [FIR] Remove Candidate.oldToNewArgumentMapping and use
Candidate.argumentMapping instead of the Fir*Call's argumentList to
remap vararg arguments to a FirVarargArgumentExpression.

The argumentList was used to preserve the order, but we can rely on
Candidate.argumentMapping to have its keys in order.
2020-10-02 12:08:05 +03:00
Mark Punzalan
a2a4d94834 [FIR] Capture array and indices for postfix/prefix increment/decrement
of array element (including overloaded indexed access operators, e.g.,
`a[b, c]++`).

This prevents double-evaluation of the array and indices expressions,
which may have side-effects.
2020-10-02 12:08:03 +03:00
Mark Punzalan
eb631bc429 [FIR] Keep vararg argument order in resolved calls (KT-17691). 2020-10-02 12:08:02 +03:00
Mark Punzalan
f6ce2d893c [FIR] Handle varargs in overloaded indexed access operator. 2020-10-02 12:08:01 +03:00
Yan Zhulanow
c471a7735e Keep all variants of ExtensionPointImpl.registerExtension() in the pro-guarded compiler (KT-42103) 2020-10-02 17:50:23 +09:00
Toshiaki Kameyama
bcbb90dd81 "Receiver parameter is never used" inspection: don't report it when anonymous function is called with receiver
#KT-41246 Fixed
2020-10-02 13:32:31 +07:00
Mikhail Glukhikh
112e07814e [FIR] Mute test after rebase 2020-10-02 08:58:01 +03:00
Mikhail Glukhikh
cc88374fd7 [FIR] Add compile Kotlin against Kotlin test group 2020-10-02 08:57:55 +03:00
Mikhail Glukhikh
582f8fe287 FIR: recursive transform annotation if it has annotation as argument
#KT-42344 Fixed
2020-10-02 08:57:49 +03:00
Mikhail Glukhikh
2fd752f8f6 IR interpreter: fix calculation of constant Java fields
#KT-42117 Fixed
2020-10-02 08:57:44 +03:00
Mikhail Glukhikh
44ebec05bb FIR Java: support read of field constant initializers 2020-10-02 08:57:39 +03:00
Ilya Gorbunov
fafb4a7914 Use regex for case-insensitive String.replace
KT-41799
2020-10-02 00:29:26 +03:00
Francesco Vasco
4a0109cf44 Use StringBuilder in String.replace (2x faster)
KT-41799
2020-10-02 00:28:53 +03:00
Vladimir Ilmov
51a37bffff Incorrect package name for multipart classes 2020-10-01 23:06:17 +03:00
LepilkinaElena
dc2845df10 [IR] Avoid extra lists creation during getting explicit/all parameters (#3769) 2020-10-01 21:19:40 +03:00
Denis Zharkov
6d7744a921 FIR2IR: Use correct origin for lazily created fake overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
26a43b253f FIR2IR: Avoid recreation of declarations
They may be previously created for fake overrides
2020-10-01 17:49:02 +03:00
Denis Zharkov
ff4b6a0bf9 FIR: Fix modality computation for corner cases in FirTypeIntersectionScope
See org.jetbrains.kotlin.resolve.OverridingUtil#determineModalityForFakeOverride
2020-10-01 17:49:02 +03:00
Denis Zharkov
de3df799bc FIR: Fix implicit return type computation for synthetic property+intersection 2020-10-01 17:49:02 +03:00
Denis Zharkov
754e17a28f FIR2IR: Fix checking if accessor is allowed to have fake override 2020-10-01 17:49:02 +03:00
Denis Zharkov
70bf7063c9 FIR2IR: Add hack for delegate combinated with intersection 2020-10-01 17:49:02 +03:00
Denis Zharkov
85b8673434 FIR: Fix overload resolution with defaults 2020-10-01 17:49:02 +03:00
Denis Zharkov
4964ff0019 FIR2IR: Refine definition if we need a fake override
`realDeclarationSymbols` that was used before is built from klass.declarations that doesn't
contain e.g. declarations from enhancement
Next time, we should get rid of `realDeclarationSymbols` and use only
originalDeclaration.origin.fromSupertypes, but originalSymbol.callableId.classId == classId
doesn't work correctly
2020-10-01 17:49:02 +03:00
Denis Zharkov
3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Denis Zharkov
be6bef13d3 FIR2IR: Drop some unused declarations 2020-10-01 17:49:02 +03:00
Denis Zharkov
5c9187b270 FIR2IR: Rework fake overrides generation
- To discriminate what's already been generated, use the set of declaration
instead of names (it's obviously more correct)
- Make it possible to set more then one overridden (base)
2020-10-01 17:49:02 +03:00
Denis Zharkov
b241161c35 FIR2IR: Rework DelegatedMemberGenerator
Use scope content instead of manual traversing of declarations
2020-10-01 17:49:02 +03:00
Denis Zharkov
e311a60055 FIR: Refine FirDelegatedMemberScope
- Use an attribute instead of overriddenSymbol
- Use createCopyForFir because it copies type parameters
2020-10-01 17:49:02 +03:00
Denis Zharkov
28c536e511 FIR: Add temporary workaround to avoid changes in test data
CallableId for intersection overrides has been changed in previous commits
and many rendered FIR test data needs to be changed
But, we're going to get rid of callableId's/or fix them back for intersection overrides soon
2020-10-01 17:49:02 +03:00
Denis Zharkov
ff83555729 Minor. Optimize imports 2020-10-01 17:49:02 +03:00
Denis Zharkov
fd9c6479bf FIR: Do not call withReplacedConeType if type is unresolved 2020-10-01 17:49:02 +03:00
Denis Zharkov
cb07ffc4fd FIR: Clarify contracts for two versions FirClass<*>::scope
- One of them really creates a scope a specific type
- Another one is used for supertypes and includes creation of FirDelegatedMemberScope wrapper
2020-10-01 17:49:02 +03:00
Denis Zharkov
1adf731fc5 FIR: Minor. Use buildValueParameterCopy 2020-10-01 17:49:02 +03:00
Denis Zharkov
9696fecab5 FIR: Use refined visibility/modality for intersection overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
20bf238c27 FIR2IR: Fix signature computed for fake-overrides
Take into account _new owner_ of the function
Namely, if there's a substitution override from a class A<T> in its subtype B,
it will refer `B` as its owner in the signature
2020-10-01 17:49:02 +03:00
Denis Zharkov
9914b487b7 FIR: Do not load hashCode/toString/equals methods from Java interface
As it's done in FE 1.0, and there are subtle semantics in the language that depends on it
2020-10-01 17:49:02 +03:00
Denis Zharkov
7c7c5336f9 FIR: Reuse callables copying parts in FirClassSubstitutionScope
It changes the behavior in FirTypeIntersectionScope:
- now type parameters are also get copied
- value parameters are being copied unchanged
2020-10-01 17:49:02 +03:00
Denis Zharkov
0297be1fa8 FIR: Replace callableId for intersection overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
11bc0e3225 FIR: Extract FirTypeScope.getDirectOverridden* 2020-10-01 17:49:02 +03:00
Denis Zharkov
73c6eb2793 FIR2IR: Extract common parts in FakeOverrideGenerator 2020-10-01 17:49:02 +03:00
Denis Zharkov
d67a1f9123 FIR: Rework default parameters propagation through overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
ac666187b0 FIR: Use correct session in FirJvmMangleComputer 2020-10-01 17:49:02 +03:00
Denis Zharkov
c8afa8f715 FIR2IR: Remove unused FakeOverrideMode 2020-10-01 17:49:02 +03:00
Roman Golyshev
2b76fe8a72 [FIR Completion] Enable basic insertion handler tests for FIR completion
Enable tests that are passing
2020-10-01 15:42:50 +03:00
Steven Schäfer
39736868bf JVM IR: Allow debugger to evaluate expressions involving IR dependencies 2020-10-01 14:35:05 +02:00
Steven Schäfer
48b736e551 JVM IR: Enable evaluate expression tests for the JVM IR backend 2020-10-01 14:35:05 +02:00
Toshiaki Kameyama
33969c5f9a Redundant semicolon: fix false negative on start of line
^KT-40704 Fixed
2020-10-01 14:31:59 +02:00
Nikita Skvortsov
02c31a711c Avoid iterating over all idea modules.
Use hash table to quickly lookup idea module by gradle project path
2020-10-01 14:09:34 +02:00
Florian Kistner
713f6e1ed3 Load artifactory in root script to workaround conflicts 2020-10-01 13:46:01 +02:00
Yaroslav Chernyshev
4c9d3b4668 [Gradle, Cocoapods] Add Podfile missing info to podInstall error report
#KT-42243 Fixed
2020-10-01 14:30:19 +03:00
Roman Golyshev
6c79040cfb [FIR Completion] Enable passing tests 2020-10-01 13:07:20 +03:00
Roman Golyshev
12cd5fb43a [FIR Completion] Refactor FIR completion tests
Extract logic about checking the directive and catching the exception
2020-10-01 13:07:20 +03:00
anastasiia.spaseeva
31de584d14 [Spec tests] Generate sections json map 2020-10-01 12:32:22 +03:00
Victor Petukhov
d02432cf93 Introduce warning for the changing arguments execution order for named varargs (KT-17691) 2020-10-01 12:15:13 +03:00
Victor Petukhov
d62c665e99 Introduce language feature to enable the correct arguments execution order for named varargs (KT-17691) 2020-10-01 12:14:49 +03:00
Bart van Helvert
485ada7b90 Move getColon from KtClass to KtClassOrObject
Makes it possible to retrieve the colon from a KtObjectDeclaration.
2020-10-01 10:20:20 +03:00
Vladimir Dolzhenko
4d5b32b140 Clean up perf tests TC stats output 2020-10-01 07:52:01 +02:00
Victor Petukhov
986ee11aab Fix failing spec test 2020-09-30 22:14:11 +03:00
Kirill Shmakov
4f51367196 Remove build settings of CLion plugin 2020-09-30 19:56:49 +03:00
Vyacheslav Gerasimov
f03b957812 Build: Check ivy repository by empty marker file instead of directory
Should fix situations when directory exists but contents are invalid
which happens when unpacking process is interrupted.
2020-09-30 17:51:22 +03:00
Victor Petukhov
d0a1f18c7d Fix failing test after fcfabb70d5 2020-09-30 17:37:20 +03:00
Bingran
60cf3b5740 Upgradle agp version for ConfigurationCacheForAndroidIT
The new agp version contains the fix regarding build listeners which
will allow kgp run config caching test without warnings.

Fixes: n/a
Test: existing
2020-09-30 16:06:35 +03:00
Dmitry Petrov
af86c52101 JVM_IR merge annotations when substituting types
Otherwise special annotations such as @EnhancedNullability are lost,
which affects JVM signatures.

KT-42330
2020-09-30 15:44:54 +03:00
sebastian.sellmair
4b152a635e multiplatformUtil; Module.implementedModules: Extend Android M2 fallback to also include M3 relevant modules
Port of `kotlin-ide` commit: 9053046ad5731b7aca73e2f74b93e8bd8251f507
2020-09-30 12:34:26 +00:00
sebastian.sellmair
f9b8bc0edb Move KotlinAndroidDependsOnEdgesTest.kt to new functionalTest source set 2020-09-30 12:26:49 +00:00
sebastian.sellmair
1173c4380a KotlinPlugin: Setup default 'dependsOn' edges for Android source sets 2020-09-30 12:26:48 +00:00
Dmitriy Novozhilov
dbf34205ff Advance bootstrap to 1.4.30-dev-738 2020-09-30 15:00:44 +03:00
Victor Petukhov
fcfabb70d5 Report invisible setter error if it's resolved to synthetic property of base class with public getter and protected setter
^KT-11713 Fixed
2020-09-30 14:35:43 +03:00
Denis Zharkov
fdd71c0bce Fix incorrect NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER
^KT-42257 Fixed
2020-09-30 14:10:53 +03:00
Jinseong Jeon
d09ccdbe3c FIR serializer: distinguish typealias classifier 2020-09-30 12:21:57 +03:00
Jinseong Jeon
b4ac2f5b55 FIR serializer: special handling of Continuation 2020-09-30 12:21:57 +03:00
Konstantin Tskhovrebov
5d2adce7ab as42: Add lost project parameter to CliLightClassGenerationSupport. 2020-09-30 11:38:18 +03:00
Vladimir Dolzhenko
3212df6183 Reverted back occasional commenting of perf runs 2020-09-30 09:41:21 +02:00
Konstantin Tskhovrebov
803463ac11 Revert "as42: Fix override."
This reverts commit d33391f4
2020-09-30 10:28:38 +03:00
Nikolay Krasko
646e6446f7 as41: Fix compile error in :compiler:tests-common:compileTestJava 2020-09-30 10:05:57 +03:00
Nikolay Krasko
6d2647c681 Clean .bunch file
No need to pass base branch in the rule
2020-09-30 10:05:56 +03:00
Vladimir Dolzhenko
ce1b388668 Add registry key kotlin.resolve.forceFullResolveOnHighlighting
Relates to ^KT-41195
Relates to ^KT-38687
2020-09-30 05:56:46 +00:00
Vladimir Dolzhenko
50a16aa9bc Do not print metadata for perf tests 2020-09-29 23:48:16 +02:00
Dmitry Petrov
f79afd67f4 Add more tests for collections implemented by delegation 2020-09-29 22:44:00 +03:00
Vladimir Dolzhenko
3c380faeb5 Added deprecated PackageFragmentProvider#getPackageFragments for BWC
Relates to ^KT-33394
^KT-42259 Fixed
2020-09-29 19:14:44 +00:00
Mikhael Bogdanov
a228206cf5 Minor. Regenerate tests 2020-09-29 20:29:40 +02:00
Dmitry Petrov
79a2d9858c JVM_IR emulate JVM stub generation scheme
KT-42114
KT-42115
2020-09-29 21:06:30 +03:00
pyos
6dc08cb2fd Add a bytecode test that checks inlining of adapted references 2020-09-29 19:49:46 +02:00
pyos
9a3507af59 JVM_IR: treat adapted references as lambdas for inlining
#KT-38536 Fixed
 #KT-38535 Fixed
2020-09-29 19:49:46 +02:00
pyos
0e8a664c9b JVM_IR: fix bound suspend-converted references
Note: inlining of adapted callable references is still suboptimal.

 #KT-42021 Fixed
2020-09-29 19:49:46 +02:00
Mikhail Glukhikh
ac50433e17 Fix failing bytecode text test
In this commit I moved IGNORE_BACKEND_FIR to the end or deleted it
when it was applicable, to preserve correct line numbers
2020-09-29 19:16:42 +03:00
Yan Zhulanow
cfd90c85cb Kapt: Re-enable JDK 9/11 tests disabled by occasion 2020-09-30 00:31:08 +09:00
Pavel Kirpichenkov
b39af51390 [FIR] Extract language settings into a dedicated component
^KT-42080 Fixed
2020-09-29 18:22:56 +03:00
Pavel Kirpichenkov
8f31b1ca83 [FIR] Use default language settings in inference components
Without settings common inference components require additional parameters
to be passed explicitly from components not shared between FIR and FE10.
Proper configuration can be postponed in FIR, defaults are good enough for now.

^KT-42080 In progress
2020-09-29 18:22:56 +03:00
Yan Zhulanow
dba1b50aed Parcelize: Don't write Parcelize model if the Parcelize plugin is disabled 2020-09-29 23:58:30 +09:00
Yan Zhulanow
9cdd6e9a8f Kapt: Support new @JvmDefault functionality (KT-25960) 2020-09-29 23:58:30 +09:00
Yan Zhulanow
a44fd964cf Kapt: Don't convert field initializers for enum fields inside companion objects (KT-37732)
For classes with companion objects, Kotlin compiler generates a 'Companion' static accessor field.
Java prioritizes fields over inner types (apparently, Scala does this as well, KT-29864), so the generated initializer doesn't compile.
As a workaround, initializer generatation is disabled for enum fields inside companion objects. Certainly, it's not a proper fix, however it does fix the regression.
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
86ac44c23e "Replace 'if' with elvis operator": don't suggest if val initializer is a complex expression
#KT-35165 Fixed
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
653e20dcba Convert put to assignment: don't report when receiver object has custom 'set' method
#KT-33212 Fixed
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
5abb6bc7a5 Add quickfix for SENSELESS_NULL_IN_WHEN to remove redundant when branch
#KT-24556 Fixed
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
668473c337 Add quickfix for CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT to remove const modifier
#KT-35215 Fixed
2020-09-29 23:58:28 +09:00
Toshiaki Kameyama
5a3c6def8f Join with assignment: fix false negative when local variable are used
#KT-34270 Fixed
2020-09-29 23:58:28 +09:00
Toshiaki Kameyama
b56272dc64 Add name to argument: do not remove necessary backticks
#KT-30894 Fixed
2020-09-29 23:58:28 +09:00
Toshiaki Kameyama
a492fe7757 "Put arguments/parameters on separate lines": respect code style settings
#KT-20420 Fixed
2020-09-29 23:58:27 +09:00
Toshiaki Kameyama
74ee68e57b Remove redundant backticks: do not report if variable inside the string and isn't followed by space
#KT-35051 Fixed
2020-09-29 23:58:27 +09:00
Toshiaki Kameyama
ad3ea9a36a Replace with binary operator: don't highlight when receiver is platform type
#KT-35097 Fixed
2020-09-29 23:58:27 +09:00
Toshiaki Kameyama
93db78e7ac JavaMapForEachInspection: report for expression with implicit receiver
#KT-31833 Fixed
2020-09-29 23:58:27 +09:00
Yan Zhulanow
85e8b56a02 Minor: Simplify code 2020-09-29 23:58:26 +09:00
Toshiaki Kameyama
75e8849c94 Add quick fix for INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER
#KT-34533 Fixed
2020-09-29 23:58:26 +09:00
Yan Zhulanow
9f192ba85e Fix false positive in +0.0 == -0.0 comparison simplification (KT-17735) 2020-09-29 23:58:26 +09:00
Toshiaki Kameyama
915dc6ce91 FoldInitializerAndIfToElvisInspection: don't report when 'var' variable has no explicit type and it's used as not nullable type
#KT-38349 Fixed
2020-09-29 23:58:26 +09:00
Yan Zhulanow
db140b2815 Fix Pill debug IDEA run configurations 2020-09-29 23:58:25 +09:00
Yan Zhulanow
7b5fc19156 Minor: Simplify replacement check logic in ReplaceJavaStaticMethodWithKotlinAnalogInspection 2020-09-29 23:58:25 +09:00
Yan Zhulanow
ed2b547973 Minor: Extract suspend call check to a separate function 2020-09-29 23:58:25 +09:00
Toshiaki Kameyama
ef5335ba99 ReplaceJavaStaticMethodWithKotlinAnalogInspection: don't report for Character.toString(int)
#KT-34859 Fixed
2020-09-29 23:58:25 +09:00
Toshiaki Kameyama
b008e6c9be SimplifiableCallChainInspection: don't report if suspend function cannot be called correctly
#KT-23934 Fixed
2020-09-29 23:58:24 +09:00
Yan Zhulanow
1e9bb00744 Debugger: Disable "missing dependency superclass" diagnostic in evaluator (KT-38659) 2020-09-29 23:58:24 +09:00
Yan Zhulanow
62affd8e0d Kapt: Allow to strip @Metadata annotation from stubs (KT-36667) 2020-09-29 23:58:24 +09:00
Ilya Goncharov
da16b8e527 [Gradle, JS] Add includedRange with version only 2020-09-29 16:29:01 +03:00
Kirill Shmakov
3075de917b Add useAndroidX property into mobile library template KT-42123 2020-09-29 16:22:56 +03:00
Kirill Shmakov
ac9b5dabfc Clarify test names to avoid clashes in resolve
This is to workaround problem described in #KT-41342
2020-09-29 16:22:54 +03:00
Ilya Goncharov
31e7dd5fcc [Gradle, JS] Fix escaped characters in package.json
^KT-40202 fixed
2020-09-29 15:46:16 +03:00
Ilya Goncharov
337a66f906 [Gradle, JS] Fix NpmRange string representation with concrete version
^KT-42222 fixed
^KT-40986 fixed
^KT-39838 fixed
2020-09-29 15:46:16 +03:00
Ilya Goncharov
0fa4f0572b [Gradle, JS] Add test for duplicated dependency with range version
^KT-42222 fixed
^KT-40986 fixed
^KT-39838 fixed
2020-09-29 15:46:16 +03:00
Ilya Goncharov
024771028c [Gradle, JS] Fix yarn.lock resolution in case of duplicated dependencies
^KT-42222 fixed
^KT-40986 fixed
^KT-39838 fixed
2020-09-29 15:46:16 +03:00
Konstantin Tskhovrebov
34b6003371 as42: remove unused bunch files 2020-09-29 15:32:35 +03:00
Konstantin Tskhovrebov
c8def4543d Bump AS versions. 2020-09-29 15:32:35 +03:00
Konstantin Tskhovrebov
8a4aac53d8 as42: Fix override. 2020-09-29 15:32:34 +03:00
Andrei Klunnyi
ddfb86c839 KT-42014 ClassNotFoundException in Android Studio 4.2
KotlinCodeHintsPass was removed in 5fe1eaea but later a reference to
it appeared by accident in 50461e61.
2020-09-29 15:32:34 +03:00
Mikhail Zarechenskiy
8ff141357e as42: move plugin.xml to appropriate resource directy
#KT-41930 Fixed
2020-09-29 15:32:34 +03:00
Mikhail Zarechenskiy
11ac5bd32a as42: Fix test about forgotten bunches 2020-09-29 15:32:34 +03:00
Mikhail Zarechenskiy
929fb1f178 as42: Fix compilation of tests 2020-09-29 15:32:34 +03:00
Nikolay Krasko
99b9bc83a1 as42: Fix assertEqualsToFile usage 2020-09-29 15:32:34 +03:00
Nikolay Krasko
d83355e4c4 as42: Remove setupGradleSettings usage 2020-09-29 15:32:34 +03:00
Nikolay Krasko
fa9368125f as42: Remove clearing scratchesMapping in tests 2020-09-29 15:32:33 +03:00
Nikolay Krasko
c5b70797e2 as42: Fix compilation errors in AbstractJavaToKotlinConverterForWebDemoTest 2020-09-29 15:32:33 +03:00
Nikolay Krasko
1dc3cb5978 as42: Fix compilation errors caused by 202 platform 2020-09-29 15:32:33 +03:00
Nikolay Krasko
ecff2816ac as42: Fix duplication registration for com.intellij.psi.classFileDecompiler in plugin 2020-09-29 15:32:33 +03:00
Nikolay Krasko
a3bef10b97 as42: Add fastutil library to dependency to make KtUsefulTestCase.<clinit> work
java.lang.NoClassDefFoundError: it/unimi/dsi/fastutil/objects/Object2FloatMap
  at com.intellij.configurationStore.MyXmlSerializer$bindingProducer$1.createRootBinding(xmlSerializer.kt:172)
  at com.intellij.configurationStore.MyXmlSerializer$bindingProducer$1.createRootBinding(xmlSerializer.kt:170)
  at com.intellij.configurationStore.OldBindingProducer.getRootBinding(xmlSerializer.kt:154)
  at com.intellij.configurationStore.MyXmlSerializer.getRootBinding(xmlSerializer.kt:186)
  at com.intellij.util.xmlb.Serializer.getRootBinding(Serializer.java:18)
  at com.intellij.configurationStore.JdomSerializerImpl.serializeObjectInto(xmlSerializer.kt:78)
  at com.intellij.configurationStore.XmlSerializer.serializeObjectInto(xmlSerializer.kt:39)
  at com.intellij.configurationStore.XmlSerializer.serializeObjectInto$default(xmlSerializer.kt:38)
  at com.intellij.configurationStore.XmlSerializer.serializeObjectInto(xmlSerializer.kt)
  at com.intellij.codeInsight.CodeInsightSettings.writeExternal(CodeInsightSettings.java:231)
  at org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase.<clinit>(KtUsefulTestCase.java:123)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at junit.framework.TestSuite.createTest(TestSuite.java:60)
  at junit.framework.TestSuite.addTestMethod(TestSuite.java:307)
  at junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150)
  at junit.framework.TestSuite.<init>(TestSuite.java:129)
2020-09-29 15:32:33 +03:00
Nikolay Krasko
1f3602c4b7 as42: Register DumbUtil service as it required in PsiElementFinderImpl 2020-09-29 15:32:33 +03:00
Nikolay Krasko
1b97511248 as42: Register classFileDecompiler through xml
It doesn't work otherwise. It's expected that extension point is registered
at the moment of ClassFileDecompilers instatiation or it fails.
2020-09-29 15:32:32 +03:00
Nikolay Krasko
5ba70b2cbb as42: Additional fixes for AS42 and 202 platform 2020-09-29 15:32:32 +03:00
Nikolay Krasko
2df030f583 as42: Apply 201 <-> AS41 diff 2020-09-29 15:32:32 +03:00
Nikolay Krasko
17e43aadaa Introduce AS42 bunch 2020-09-29 15:32:32 +03:00
Dmitry Petrov
1fc459ab4c JVM_IR KT-42260 add abstract overrides for generated stubs 2020-09-29 14:06:12 +03:00
Alexander Udalov
445b2d6eb1 JVM IR: minor, unmute bytecode text test
Also fix typo in the name
2020-09-29 12:38:54 +02:00
Alexander Udalov
b497f39c29 IR: do not try to render IrUninitializedType
This will improve exception messages in case some error happens on a
function whose return type is uninitialized, as in KT-41401.
2020-09-29 12:32:45 +02:00
Ilya Goncharov
522fdb3e59 [Gradle, JS] Empty compiler plugin classpath for KotlinJsIrLink
^KT-42245 fixed
2020-09-29 12:17:38 +03:00
Mikhail Glukhikh
cebbd21a1e FIR2IR: simplify analysis of companion' callable references 2020-09-29 11:51:21 +03:00
Jinseong Jeon
3151fc8577 FIR2IR: set dispatch receiver for companion member reference
#KT-42132 fixed
2020-09-29 11:51:21 +03:00
Jinseong Jeon
01d852c006 FIR: carry annotations on delegated property accessors 2020-09-29 11:35:19 +03:00
Aleksei Cherepanov
f1aa75fdf8 [JPS] Fix startup environment for Android Studio 2020-09-29 11:30:14 +03:00
Ilmir Usmanov
6ae2951850 Minor. Do not check suffix of function for tail-call optimization hit 2020-09-29 10:04:03 +02:00
Dmitriy Novozhilov
7d277b907f [FIR] Add new backend tests to "[JPS] Run fast FIR tests" configuration 2020-09-29 10:45:16 +03:00
Victor Petukhov
8f333aef3a Introduce warning about forbidden referencing to underscore named parameter of the catch block in a future release (KT-31567) 2020-09-29 10:23:45 +03:00
Victor Petukhov
09f1764f82 Introduce warning for private inline functions which return anonymous objects without specified supertypes (KT-33917) 2020-09-29 10:23:45 +03:00
Victor Petukhov
63d825fa24 Introduce warning for secondary constructor in enums without delegation to primary constructors (KT-35870) 2020-09-29 10:23:45 +03:00
Mikhail Glukhikh
416874f9d0 [FIR] Update BB test license comments 2020-09-29 10:21:22 +03:00
Mark Punzalan
238cc7c257 [FIR] Enable BytecodeText tests for FIR.
143 out of 767 tests (18.6%) are currently failing.
2020-09-29 10:21:21 +03:00
Mark Punzalan
69cd729506 [FIR] Enable BlackBoxAgainstJavaCodegen tests for FIR.
23 out of 156 tests (14.7%) are currently failing.
2020-09-29 10:21:21 +03:00
Mark Punzalan
348ba3e08c [FIR] Enable BlackBoxInlineCodegen tests for FIR.
16 out of 638 tests (2.5%) are currently failing.
2020-09-29 10:21:21 +03:00
Dmitriy Novozhilov
53a7d69ca6 [FIR] Make FirPropertyAccessor inherits FirCallableMemberDeclaration 2020-09-29 10:17:43 +03:00
Dmitriy Novozhilov
8f1062594f [FIR] Add ability to get scopes for declarations of TYPES resolve phase 2020-09-29 10:17:43 +03:00
Dmitriy Novozhilov
cc4f72e032 [FIR] Capture type from type parameter upper bound when needed 2020-09-29 10:17:43 +03:00
Dmitriy Novozhilov
393688ad82 [FIR] Add extension to FirSession to get ConeTypeCheckerContext 2020-09-29 10:17:42 +03:00
Dmitriy Novozhilov
9e4623c52b [FIR] Fix resolution of calls on super to avoid resolve to interface methods
#KT-38400 Fixed
2020-09-29 10:17:42 +03:00
Dmitriy Novozhilov
fb871a55a3 [FIR] Don't create backing field for property without explicit type
#KT-41977 Fixed
2020-09-29 10:17:42 +03:00
Dmitriy Novozhilov
0c0a8f9849 [FIR] Properly pass type attributes for inference of lambda with type variable as expected type
#KT-41989 Fixed
#KT-37317 Fixed
2020-09-29 10:17:42 +03:00
Dmitry Petrov
d9906ae8da Minor: unmute some bytecode listing tests in JVM_IR 2020-09-28 21:48:14 +03:00
Dmitry Petrov
565c156ddb Minor: reformat and cleanup warnings in CollectionStubMethodGenerator.kt 2020-09-28 21:48:14 +03:00
Yan Zhulanow
af1ed77d15 Parcelize: Fix NPE on availability check 2020-09-29 02:37:44 +09:00
pyos
8c423729e4 JVM_IR: slightly refactor ClassCodegen
* reduce code duplication for constructing JvmDeclarationOrigin;
 * move all `visitor.visitInnerClass` calls to before `visitor.done`;
 * make the order of members more strict & remove 3 mutable fields, as
   order-dependent mutation can lead to differences with incremental
   compilation due to inline calls (thus keeping mutable state in
   ClassCodegen is in general unsafe).
2020-09-28 17:08:01 +02:00
Andrei Klunnyi
79e5177126 [KTIJ-145] Memory leak detected 2020-09-28 15:21:21 +02:00
Yaroslav Chernyshev
819e83b68b [Gradle, Cocoapods] Complete logging for corner-case pod configurations 2020-09-28 16:09:36 +03:00
Yaroslav Chernyshev
5f4aa4db27 [Gradle, Cocoapods] Improve logging when deprecated podspec path is used
#KT-41948 Fixed
2020-09-28 16:09:36 +03:00
Toshiaki Kameyama
330502a0a6 KT-22665 "Create object" quick fix produce wrong code for enum (#2883)
* "Create object" quick fix: do not suggest for enum

#KT-22665 Fixed
2020-09-28 14:02:10 +02:00
Victor Petukhov
076eacb3d1 Check implicitly inferred Nothing inside special calls properly: compare constructors instead of types
^KT-41176 Open
2020-09-28 13:27:02 +03:00
Dmitriy Novozhilov
051d64742c Make SpaceBootstrap as default bootstrap source 2020-09-28 12:45:36 +03:00
Dmitriy Novozhilov
f39adfdf15 Update version of kotlin-build-gradle-plugin dependency 2020-09-28 12:43:10 +03:00
Dmitriy Novozhilov
7aef253a36 Add SpaceBootstrap option to kotlin-build-gradle-plugin 2020-09-28 12:43:10 +03:00
Vladimir Dolzhenko
a149d38c98 Register TYPE_CODE_FRAGMENT in KtStubElementTypes
Stubbed type has to be register earlier (see IStubFileElementType#checkNotInstantiatedTooLate)

^KT-28732 Fixed
2020-09-28 11:15:04 +02:00
Alexander Udalov
243db689af Build: fix "unknown enum constant" warning on Nls.Capitalization
#KTI-88 Fixed
2020-09-25 22:17:10 +02:00
Alexander Udalov
cb5c317f91 Gradle: support moduleName option in KotlinJvmOptions
#KT-42058 Fixed
2020-09-25 22:15:55 +02:00
Ilya Kirillov
0edbdaf0c7 Wizard: use EAP Kotlin versions for running import tests 2020-09-25 21:38:36 +03:00
Toshiaki Kameyama
bc580d2fd9 Introduce "Unused result of data class copy" inspection
#KT-34121 Fixed
2020-09-25 17:18:41 +02:00
Alexander Udalov
ae6d89b100 Minor, mute new test for FIR 2020-09-25 16:50:58 +02:00
pyos
bd6ead0467 JVM_IR: check for null when converting unboxed inline classes to strings
`C?` can be unboxed into `T?` if if wraps a reference type `T!!`, but in
this case `null` is not a valid value to pass to `toString-impl`.

 #KT-42005 Fixed
2020-09-25 16:50:34 +02:00
Igor Yakovlev
d2bdab2ef5 [FIR IDE] Add find usages tests for FIR plugin 2020-09-25 17:26:22 +03:00
Igor Yakovlev
d534d92123 [FIR IDE] Implement FIR for KotlinUsageTypeProvider 2020-09-25 17:26:22 +03:00
Toshiaki Kameyama
37ba9eccc4 KT-31553 Complete Statement: Wrong auto-insertion of closing curly brace for a code block (#2378)
* Complete statement: wrap property initializer by run/when block

#KT-31553 Fixed
2020-09-25 16:04:03 +02:00
Toshiaki Kameyama
14bdcb1e26 "Create enum constant" quick fix: suggest if expected type is Any
#KT-22666 Fixed
2020-09-25 15:57:11 +02:00
Mikhael Bogdanov
31ed5430ee Minor. Update test data 2020-09-25 15:45:56 +02:00
Alexander Udalov
f8f2be3d9f Minor, improve test on suspend invoke function reference
Add WITH_RUNTIME to enable it for the old backend, check the generated
function reference methods by starting the coroutine.
2020-09-25 14:52:46 +02:00
Steven Schäfer
20a5c44e41 JVM IR: Fix types in generated function reference constructor
For references to suspend functions this fixes an IllegalStateException
in the type mapper, which is what the "suspendFunctionMethodReference"
test is about.
2020-09-25 14:52:19 +02:00
Jinseong Jeon
f3db113a82 FIR2IR: use @Target to put annotations on either property or backing field 2020-09-25 14:45:49 +03:00
Jinseong Jeon
b59832c5fd FIR: refactor annotation-related utils 2020-09-25 14:45:48 +03:00
Jinseong Jeon
c8170702c6 FIR serializer: special version requirement for @JvmField property in interface companion 2020-09-25 14:45:48 +03:00
Jinseong Jeon
dc2226b42f FIR2IR: put @JvmField on field, not property
#KT-42118 fixed
2020-09-25 14:45:48 +03:00
Mikhail Glukhikh
ae23adb6f5 FIR Java: fix exception during synthetic property enhancement 2020-09-25 14:44:13 +03:00
Mikhail Glukhikh
368de43623 FIR Java: support Java setters more properly in use-site scope 2020-09-25 14:44:11 +03:00
Mikhail Glukhikh
873ea560a9 [FIR2IR] Fix conversion of flexible class reference 2020-09-25 14:44:10 +03:00
Mikhail Glukhikh
fe8e3e99ab [FIR Java] Hide function in scope in case it's an accessor by fact
#KT-42116 Fixed
2020-09-25 14:44:09 +03:00
Dmitry Petrov
70095712eb Minor: drop new bytecode listing test that passes only in JVM_IR
Unfortunately, there's no way to mute it in JVM right now.
Corresponding case is tracked as KT-42179, anyway.
2020-09-25 13:49:53 +03:00
Toshiaki Kameyama
a2f70dfc3d KT-41298 "Remove redundant 'with' call" intention works incorrectly with non-local returns and single-expression functions (#3713)
* Remove redundant 'with' call: remove redundant 'return' keyword

#KT-41298 Fixed
2020-09-25 12:48:31 +02:00
Konstantin Tskhovrebov
8a58ada4cd Fix version parser for versions without status "1.4-M1-42-IJ2020.1-1". 2020-09-25 12:17:17 +03:00
Roman Golyshev
945edfe987 KT-41859 Place classes after typealiases in DeserializedMemberScope
This way, the order in stubs and in deserialized text would be the same

On the next stub version bump, this fix should be reworked: the order
in the `DeserializedMemberScope` should be restored, and the order in
the stubs should be fixed to match the order in `MemberComparator`

^KT-41859 Fixed
2020-09-25 09:03:12 +00:00
Dmitry Petrov
cfd62c15bf JVM_IR KT-36994 don't generate stub if present in superclass 2020-09-25 11:57:33 +03:00
Dmitry Petrov
1adce11257 Add tests for KT-40191 2020-09-25 11:57:32 +03:00
Dmitry Petrov
a45b409e23 Minor: update generated JS tests 2020-09-25 11:57:32 +03:00
Mads Ager
4e518e77ca [JVM_IR] Fix expectations for parcelize tests.
The generated bridges now have line numbers as for the JVM
backend. There are some extra (irrelevant) labels in the JVM_IR
bytecode listing compared to JVM so expectations can still not
be shared even though they are closer.
2020-09-24 20:52:22 +02:00
Alexander Udalov
6d13fe8213 Minor, add explicit type argument to workaround KT-42175 2020-09-24 19:38:26 +02:00
pyos
f30e564c90 JVM_IR: do not use fields' superQualifierSymbol to cast the receiver
It's only for computing the field owner.

 #KT-42131 Fixed
2020-09-24 18:28:23 +02:00
anastasiia.spaseeva
a57c95624d Add changelog for 1.4.20-M1 2020-09-24 18:59:56 +03:00
Dmitriy Novozhilov
0d954f1190 Change module :core:compiler.backend.common.jvm to :compiler:backend.common.jvm 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
b343d05e14 [FIR] Implement JvmTypeMapper based on cone types 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
a28d0e0b7f Make IrTypeMapper delegate to AbstractTypeMapper 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
86d4d320c4 Introduce AbstractTypeMapper based on type markers 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
7380abac13 Split AsmUtils to descriptors dependent and independent parts 2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
54a5a066e8 Introduce new module for common parts of backend utils
Mainly it needed for abstract jvm type mapper for different type systems:
  IrTypes and ConeKotlinTypes
2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
c3a89e2507 Move common part of typeSignatureMapping.kt to :core:compiler.common.jvm 2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
d215c413cc Move TypeMappingMode to :core:compiler.common.jvm 2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
4ef57c120f [FIR] Consider variance of type parameters during java type enhancement
#KT-41940 Fixed
2020-09-24 15:43:20 +03:00
Dmitriy Novozhilov
a0db510e49 [FIR] Split creating fir for java declarations to separate methods 2020-09-24 14:59:35 +03:00
Dmitriy Novozhilov
0d29d6d361 [FIR] Transform when conditions with boolean expected type
#KT-42130 Fixed
2020-09-24 14:59:35 +03:00
Dmitriy Novozhilov
68a47d6efb [FIR] Add helpers for creating diagnostics on nullable source 2020-09-24 14:59:34 +03:00
Svyatoslav Kuzmich
162d9744ff [JS IR] Fix export of constructor with default argument (KT-41275) 2020-09-24 14:58:14 +03:00
Jinseong Jeon
5b136516c4 FIR: utilize checking subtype of functional type and finding invoke symbol 2020-09-24 14:05:52 +03:00
Jinseong Jeon
b10466f6a2 FIR: extend suspend conversion to subtype of functional type 2020-09-24 14:05:52 +03:00
Toshiaki Kameyama
17176c00ae Move lambda out: don't remove block comments
#KT-35357 Fixed
2020-09-24 12:05:43 +02:00
Roman Artemev
6670e4b21d [JS IR] Fix callable reference to generic constructor
- add tests
 - fix KT-42025
2020-09-24 12:50:47 +03:00
Ilmir Usmanov
4da67bf013 Minor. Unmute tests 2020-09-24 10:08:43 +02:00
Ilmir Usmanov
f22f10febb JVM_IR: Unbox inline classes in suspend functions
if the function can be verified to safely returning unboxed
inline class.
Box the return value on resume path.
2020-09-24 10:08:41 +02:00
Victor Petukhov
ccc9b757c0 Fix failing MPP tests after 25ea3df5ca through registering InferenceCompatibilityCheckerImpl instance 2020-09-24 10:49:33 +03:00
Mads Ager
ac742123fd [JVM_IR] Generate line numbers in synthetic bridges.
The current backend does that for some bridges. We do it consistently
for all bridges.

The line number used differs. For the JVM_IR backend, we use the
line number of the class to which the bridge is added. For the
JVM backend, that does not appear to be the case for bridges
in lambdas. I prefer the line number for a lambda invoke bridge
to be the line for the lambda instead os some surrounding class.
2020-09-24 08:59:48 +02:00
Yan Zhulanow
acf1a15f3e Parcelize: Add integration test for the new kotlin-parcelize plugin 2020-09-24 15:51:00 +09:00
Yan Zhulanow
2d158ffebd Parcelize: Add tests for deprecated (kotlinx.android.parcel) annotations 2020-09-24 15:50:59 +09:00
Yan Zhulanow
1d5ab192f5 Parcelize: Support old (kotlinx.android.parcel) annotations in Parcelize plugin 2020-09-24 15:50:59 +09:00
Yan Zhulanow
f0b93bf352 Parcelize: Move back annotations from kotlinx.android.parcel, deprecate them 2020-09-24 15:50:59 +09:00
Yan Zhulanow
75a1323974 Parcelize: Add deprecation warning to Android Extensions Gradle plugin (KT-42121) 2020-09-24 15:50:58 +09:00
Yan Zhulanow
419c88d1f2 Parcelize: Publish Parcelize compiler plugin to IDE dependencies repository 2020-09-24 15:50:58 +09:00
Yan Zhulanow
0ce9003ef7 Parcelize: Add missing dependencies to Parcelize components in tests 2020-09-24 15:50:58 +09:00
Yan Zhulanow
4bd8e2f78c Parcelize: Support the new Parcelize plugin in Gradle (KT-40030) 2020-09-24 15:50:57 +09:00
Yan Zhulanow
15b2850ee0 Parcelize: Add IDE support for the Parcelize compiler plugin with sources extracted from Android Extensions plugin (KT-40030) 2020-09-24 15:50:57 +09:00
Yan Zhulanow
b7796d63d8 Parcelize: Add the Parcelize compiler plugin with sources extracted from Android Extensions plugin (KT-40030) 2020-09-24 15:50:57 +09:00
Yan Zhulanow
c9bca165bc Update generated tests in android-extension-compiler 2020-09-24 15:50:57 +09:00
Steven Schäfer
aca9478998 Parcelize: Recognize (suspend) function types as serializable 2020-09-24 15:50:56 +09:00
Steven Schäfer
a2418484bb Parcelize: More robust code for locating layoutlib.jar 2020-09-24 15:50:56 +09:00
Steven Schäfer
9bf3f105d9 Parcelize: Add a test for sealed Parcelable classes 2020-09-24 15:50:56 +09:00
Steven Schäfer
77fb0ddd32 Parcelize: Update test expectations 2020-09-24 15:50:55 +09:00
rbares
9d000529e7 Fix JVM Parcelize use of Parceler 2020-09-24 15:50:55 +09:00
Steven Schäfer
8ab6411b93 Parcelize, JVM IR: Fix types in nested containers 2020-09-24 15:50:55 +09:00
Yan Zhulanow
eaa5d08736 Move all sources for android-tests to the 'test' source set 2020-09-24 15:50:55 +09:00
Steven Schäfer
3a7cc93c4e JVM IR: More precise check for calls to the implementation method in a default stub 2020-09-24 07:53:31 +02:00
Steven Schäfer
648bc9b1c4 JVM IR: Check for cycles when inlining into default stubs 2020-09-24 07:53:31 +02:00
Steven Schäfer
111c550f3c JVM IR: More tests for inlining in $default stubs 2020-09-24 07:53:31 +02:00
Steven Schäfer
5e27d9b089 JVM IR: Make inlining in $default stubs compatible with the JVM BE
The JVM BE inlines calls to the underlying function in a $default stub
verbatim, e.g., without renaming LVT entries or regenerating anonymous
objects. This commit introduces the same behavior in the JVM IR BE.

Fixes KT-36769.
2020-09-24 07:53:31 +02:00
Steven Schäfer
bef0437edb JVM IR: Generate LVT entries for parameters in inline $default methods 2020-09-24 07:53:31 +02:00
Ilya Kirillov
347a984ce0 FIR IDE: fix tests compilation 2020-09-23 21:43:58 +03:00
Ilya Kirillov
f36cd28696 FIR IDE: introduce withFir function 2020-09-23 21:43:58 +03:00
Ilya Kirillov
a516264923 FIR IDE: introduce withFirDeclaration function 2020-09-23 21:43:57 +03:00
Ilya Kirillov
ebc2ea59cd FIR IDE: introduce WeakFirRef for low level 2020-09-23 21:43:57 +03:00
Ilya Kirillov
8ee4c4e047 FIR IDE: introduce scoped fir functions 2020-09-23 21:43:57 +03:00
Ilya Kirillov
e19d2ecc73 FIR IDE: make FirModuleResolveState functions to be internal 2020-09-23 21:43:57 +03:00
Ilya Kirillov
8e41384f6d FIR IDE: separate LowLevelFirApiFacade from completion 2020-09-23 21:43:56 +03:00
Ilya Kirillov
7cc714c598 FIR IDE: move all public low level api to separate package 2020-09-23 21:43:56 +03:00
Ilya Kirillov
a0337ec10d FIR: fix invalid increasing inner array size in ArrayMapImpl 2020-09-23 21:43:56 +03:00
Ilya Kirillov
4238fd3842 FIR IDE: fix compilation after rename registerJavaSpecificComponents -> registerJavaSpecificResolveComponents 2020-09-23 21:43:55 +03:00
Ilya Kirillov
65ef629ca7 FIR: add ensureResolved to processConstructors 2020-09-23 21:43:55 +03:00
Ilya Kirillov
a570be4e76 FIR IDE: fix compilation of AbstractFirIdeDiagnosticsCollector.kt 2020-09-23 21:43:55 +03:00
Ilya Kirillov
fa570710ee FIR IDE: move diagnostic highlighting to separate
pass
2020-09-23 21:41:54 +03:00
Ilya Kirillov
1f4aff9643 FIR: add ensureResolved to FirSealedClassInheritorsTransformer 2020-09-23 21:41:53 +03:00
Ilya Kirillov
1c0bbaf225 FIR: add ensureResolved to FirExposedVisibilityDeclarationChecker 2020-09-23 21:41:53 +03:00
Ilya Kirillov
04fca93b1e FIR IDE: fix completion on parenthesized expression 2020-09-23 21:41:52 +03:00
Ilya Kirillov
879cf3b049 FIR IDE: do not fail whole completion on exception in lookup element creation 2020-09-23 21:41:52 +03:00
Ilya Kirillov
e9fb79741a FIR IDE: fix completion in initializer 2020-09-23 21:41:51 +03:00
Roman Golyshev
1ab6595ae2 FIR Completion: Use name filtering in completion contributor 2020-09-23 21:41:51 +03:00
Roman Golyshev
75d8710bf6 FIR IDE: Add name filtering to scope KtScope and implementations 2020-09-23 21:41:50 +03:00
Roman Golyshev
dc600e3caf FIR IDE: Fix buildKtType for ConeDefinitelyNotNullType 2020-09-23 21:41:49 +03:00
Ilya Kirillov
74298aae32 FIR IDE: invalidate sessions on exception 2020-09-23 21:41:48 +03:00
Ilya Kirillov
a743b80d17 FIR IDE: reuse up-to-date fir sessions 2020-09-23 21:41:47 +03:00
Ilya Kirillov
22c2d34b14 FIR IDE: add debug info when can not build KtType 2020-09-23 21:41:46 +03:00
Ilya Kirillov
a52262bf97 FIR IDE: run completion resolve under lock 2020-09-23 21:41:45 +03:00
Ilya Kirillov
f1c808384e FIR IDE: do not resolve symbols by transitive module dependencies 2020-09-23 21:41:44 +03:00
Ilya Kirillov
01875635db FIR IDE: do not resolve whole firFile in completion 2020-09-23 21:41:44 +03:00
Ilya Kirillov
2cfbfabe04 FIR IDE: do not recreate transformer phases & ScopeSession 2020-09-23 21:41:42 +03:00
Ilya Kirillov
9a99703f24 FIR IDE: implement incremental function analysis 2020-09-23 21:41:41 +03:00
Ilya Kirillov
8bcba00bb7 FIR IDE: do not resolve declarations if they are already resolved when we are inside lock 2020-09-23 21:41:40 +03:00
Ilya Kirillov
fc64d8d5e8 FIR IDE: reanalyse dependent modules only then they change 2020-09-23 21:41:40 +03:00
Ilya Kirillov
07be30c5db FIR IDE: separate fir session for current module from dependent modules session 2020-09-23 21:41:39 +03:00
Ilya Kirillov
ab897752de FIR IDE: remove invalid comments from FirIdeSessionFactory 2020-09-23 21:41:39 +03:00
Ilya Kirillov
4045c8fbf4 FIR IDE: fix invalid order of classes in classIdIfNonLocal 2020-09-23 21:41:38 +03:00
Ilya Kirillov
766063ba77 FIR IDE: optimize search for FirDeclaration by KtDeclaration 2020-09-23 21:41:37 +03:00
Ilya Kirillov
36e57545e8 FIR IDE: simplify psiModificationTrackerBasedCachedValue 2020-09-23 21:41:36 +03:00
Ilya Kirillov
73451b1616 FIR IDE: reresolve libraries only when they change 2020-09-23 21:41:35 +03:00
Ilya Kirillov
c48cc615dd FIR IDE: use KtAnalysisSession as receiver 2020-09-23 21:41:35 +03:00
Ilya Kirillov
d4786e06a9 FIR IDE: ignore PCE when running lazy resolve phase 2020-09-23 21:41:34 +03:00
Ilya Kirillov
9130392eb9 FIR IDE: resolve symbol to status to get it modality 2020-09-23 21:41:34 +03:00
Ilya Kirillov
0c47d42659 FIR IDE: add failing multiModuleLazyResolve test 2020-09-23 21:41:33 +03:00
Ilya Kirillov
a3a59131b5 FIR IDE: fix passing whenWithHeiarchy test 2020-09-23 21:41:32 +03:00
Roman Golyshev
6d0a5a0bb2 KT-41346 Implement NoReorderImplementation without reordering
- See the documentation for `DeserializedMemberScopeHelper` for the full
info about the fix and the issue
- Add `preserveDeclarationsOrdering` setting to
`DeserializationConfiguration`
- Enable this setting in `DeserializerForClassfileDecompiler`
- Also, use `List` instead of `Collection` to pass members to
`DeserializedMemberScope`. It is done to emphasize that the order of
the members is important and may be used
- Review: https://jetbrains.team/p/kt/review/1627
- ^KT-41346 Fixed
2020-09-23 15:27:51 +00:00
Roman Golyshev
bf371ff98a KT-41346 Refactor computeNonDeclared*
Change the signature of the `computeNonDeclared*` methods so they expect
mutable lists - it better suits their contracts. Also, add a little
documentations about the contract

Also, change `Collection` to `List` for incoming protos to `emphasize`
that their order might be used
2020-09-23 15:27:50 +00:00
Roman Golyshev
b1097c49d3 KT-41346 Move Implementation to DeserializedMemberScope 2020-09-23 15:27:49 +00:00
Roman Golyshev
5596bf33d8 KT-41346 Move related code to OptimizedImplementation
This does not change any semantics, only moves the code around
2020-09-23 15:27:49 +00:00
Roman Golyshev
c8878f862d KT-41346 Introduce inner OptimizedImplementation class
Make it implement `Implementation` and move definitions
there
2020-09-23 15:27:48 +00:00
Roman Golyshev
683dd57f24 KT-41346 Extract Implementation interface
This is a temporary interface to make refactoring easier
2020-09-23 15:27:47 +00:00
Roman Golyshev
341a7478ed KT-41346 Move removing non-available functions to protected method
This would allow to stricten contract on `computeNonDeclaredFunctions`
2020-09-23 15:27:47 +00:00
Roman Golyshev
4f4c25ca5e KT-41346 Cleanup DeserializedMemberScope 2020-09-23 15:27:46 +00:00
Ilya Kirillov
622f71bd65 Fix binary compatibility with AS
#KT-42061 fixed
2020-09-23 18:25:07 +03:00
Dmitry Petrov
1c4567c999 Add tests for KT-40152 2020-09-23 18:14:21 +03:00
Dmitry Petrov
cd37301ea2 Minor: TARGET_BACKEND=JVM in JVM-specific tests 2020-09-23 18:14:21 +03:00
Dmitry Petrov
99dbeecc40 Some more bytecode listing tests for JVM_IR 2020-09-23 18:14:20 +03:00
Victor Petukhov
25ea3df5ca Put fix in 9123c4f73baf77f8a50dede6c890c46f5ffafd6c under the inference compatibility flag 2020-09-23 17:15:58 +03:00
Victor Petukhov
bfb46befa5 Mark projection of a nullable captured type as not null during simplification constrains with it and a nullable type variable
^KT-41913 Fixed
2020-09-23 17:15:57 +03:00
Dmitriy Novozhilov
0f868ff83f [TEST] Regenerate tests 2020-09-23 17:12:14 +03:00
Alexander Udalov
84df996204 JVM IR: fix "step over" for inline function calls in conditions
Reimplement the same hacky approach used in the old backend (see
cc2fe6b0c6).

Previously, the debugger incorrectly stepped into Collections.kt on
"step over" inline function calls from stdlib like 'any'.

Since `if` and `when` expressions are represented the same way in IR,
the behavior is fixed for both of them. It's not the case in the old JVM
backend, where stepping over `when` conditions still suffers from the
same problem, which the newly added test checks.
2020-09-23 15:54:15 +02:00
Toshiaki Kameyama
4144adf4ee Make internal: don't suggest in interface
#KT-35346 Fixed
2020-09-23 15:34:09 +02:00
Toshiaki Kameyama
6e8565917e MapGetWithNotNullAssertionOperatorInspection: decrease severity to INFORMATION
#KT-33096 Fixed
2020-09-23 14:52:14 +02:00
Dmitriy Novozhilov
5e73e28695 [FIR-TEST] Fix psi consistency test due to 5efd533f 2020-09-23 15:32:09 +03:00
Dmitriy Novozhilov
10e7c0f1b2 [TEST] Fix long literal in testdata broken in 4374c06 2020-09-23 15:22:03 +03:00
Toshiaki Kameyama
a2bde2ffb2 Redundant overriding method: do not report when super method is not called
#KT-34959 Fixed
2020-09-23 14:12:06 +02:00
Roman Artemev
76ed09482f [IR BE] Fix inline class lowering
- provide additional type parameters from context when transforming
 constructor into static function.
 - fix KT-41771
 - add test
2020-09-23 14:49:38 +03:00
pyos
5954db18cb JVM_IR: fix lifting of arguments to object super constructors
If the arguments are reordered, they can not only be reads of temporary
variables, but also implicit type casts of said reads.

Fixes #KT-42002
2020-09-23 13:49:16 +02:00
Dmitriy Novozhilov
4d5e54cab6 [FIR] Unwrap definitely not null when matching overrides
#KT-41984 Fixed
2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
08b5f3ddde [FIR] Remove unused list with java.lang.Object member names 2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
896103b94b [FIR] Properly resolve implicit invoke calls
#KT-41990 Fixed
2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
a8e81e9ad1 [FIR] Add special node for implicit invoke calls 2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
696c8f07b4 [FIR] Add pretty toString to CallKind 2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
40a9bb6eac [FIR] Assume nullable types as good types for ILT approximation
#KT-41982 Fixed
2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
f069857492 [FIR] Cleanup annotations transform in FirExpressionsResolveTransformer 2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
0e91c8f048 [FIR] Create synthetic properties for members of java annotations
#KT-41939 Fixed
2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
da3a676c2a [FIR] Get rid of FirIntegerLiteralTypeScope and corresponding stuff 2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
4374c06537 [FIR] Approximate all integer literals which resolved in independent mode
#KT-42016
2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
5efd533f55 [FIR] Desugar unary plus and minus as part of integer literal
#KT-42016
2020-09-23 14:05:09 +03:00
Dmitriy Novozhilov
a018847f85 [FIR] Properly deserialize type attributes for type arguments
#KT-41991 Fixed
2020-09-23 14:05:09 +03:00
Dmitriy Novozhilov
a274216f14 [FIR] Check that expected lambda type is extension function using cone expected type
#KT-41991 In progress
2020-09-23 14:05:09 +03:00
Dmitriy Novozhilov
57a57d10da [FIR] Add rendering for attribites of cone types 2020-09-23 14:05:07 +03:00
Alexander Udalov
d48307ec34 JVM IR: do not copy type parameters into suspend lambda classes
Declarations inside that class are referencing the type parameters of
the containing function anyway, since we don't do any remapping. So the
resulting IR is slightly more correct, and doesn't lead to type
parameter/argument size mismatch error on IrBased/Wrapped-descriptors.

This reverts a part of 01da7f289b, which looks like it was no longer
necessary after 8d0ffa1444.

 #KT-42028 Fixed
2020-09-23 12:21:37 +02:00
Toshiaki Kameyama
bdf502edef Override/Implement members: don't add 'external' modifier
#KT-33466 Fixed
2020-09-23 11:51:08 +02:00
Vladimir Dolzhenko
4e5c61cd2f Notify if gradle points to invalid JDK
^KT-41141 Fixed
2020-09-23 09:44:07 +00:00
Vladimir Dolzhenko
be20a8bd80 Configure modules Kotlin language settings in a background with a progress
^KT-41936 Fixed
2020-09-23 09:18:52 +00:00
Dmitriy Dolovov
f0cbd6b1a5 HMPP: Avoid NPE during Kotlin facet serialization
^KT-42029
2020-09-23 10:39:11 +03:00
Mikhail Glukhikh
4653a16450 [FIR2IR] Add problematic test with in/out clash during approximation 2020-09-23 09:01:45 +03:00
Mikhail Glukhikh
3a57a541f4 FIR mangler: support captured types 2020-09-23 09:01:42 +03:00
Mikhail Glukhikh
b64b32e06b FIR: keep captured types in substitution scope 2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
b7059a3eeb FIR: perform type approximation when completion isn't required 2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
0310272738 FIR: perform more proper type approximation in completion
Note: test data change is questionable here
2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
14cfc62745 FIR: fix calculation of type arguments for bare types 2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
3c3aa3210e FIR: use FROM_EXPRESSION, not FOR_SUBTYPING capt. types in substitution 2020-09-23 09:00:56 +03:00
Mikhail Glukhikh
86d1a3be37 FIR serializer: throw exception on getting ConeIntegerLiteralType
This commit assumes that ILTs are forbidden
at the end of resolve, at least in public API
2020-09-23 09:00:56 +03:00
Mikhail Glukhikh
5a919cc827 FIR element serializer: drop duplicated approximation code 2020-09-23 09:00:56 +03:00
Mikhail Glukhikh
104f088d4e FIR serializer: throw exception on getting ConeCapturedType
This commit assumes that captured types are forbidden
at the end of resolve, at least in public API
2020-09-23 09:00:56 +03:00
Georgy Bronnikov
83ee705c0a IR: make IrClassReference.classType mutable 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
9d22ef948c IR: rework ScopeValidator 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
377940a6ea IR: handle IrVararg.varargElementType in RemapTypes 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
a542bb6af7 IR: check IrClassReference.classType in ScopeValidator 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
728c55973a IR: handle MemberAccessExpression type parameters in RemapTypes 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
3041a2815c IR: handle varargElementType in LocalDeclarationsLowering 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
8990344bb2 Varargs: add test 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
67d7bf3269 IR: take care of supertypes when copying IrTypeParameters 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
916d66c220 IR: add ScopeValidator 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
382f423ab9 Mute a test under DCE 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
33a2c69122 IR: remap types in LocalDeclarationsLowering 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
1f3d344835 IR: add RemapTypes.kt 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
df1d9a0113 IR: make IrTypeParameter.superTypes persistent mutable field 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
a409976d28 IR: make IrValueParameter.varargElementType mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
a3763e8276 IR: make IrTypeAlias.expandedType mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
78fc690f29 IR: make IrLocaldelegatedProperty.type mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
09a906cc9a IR: make IrTypeOperatorCall.typeOperand mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
d9681e535d IR: make IrField.type mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
5065b1a4c6 Make IrValueDeclaration.type mutable 2020-09-22 23:53:38 +03:00
Georgy Bronnikov
1f37795e08 IR: make IrExpression.type mutable 2020-09-22 23:53:38 +03:00
Alexander Udalov
fde7fc6951 JVM IR: use correct file for final test output check in debugger tests
Before this change, a test with incorrect .ir.out could pass if the test
execution result was equivalent to the main .out file, which was a bit
confusing.
2020-09-22 19:15:35 +02:00
Mads Ager
78483930bc [JVM_IR] Fix offsets in constant propagation optimization.
Loads of temporary variables that contain constants are replaced
with a copy of the constant. This avoids locals loads and stores.
However, the copy of the constant needs to have the offset of
the load and not of the original constant.

Fixes KT-41963.
2020-09-22 19:12:06 +02:00
Alexander Udalov
f273edeb8e Build: upgrade language to 1.3 in cli, compiler plugins and Gradle plugin
The language/API version restriction here is to make sure the code works
with Gradle of earlier versions, but all versions of Gradle that we
support already depend on Kotlin 1.3+.
2020-09-22 19:10:58 +02:00
Alexander Udalov
5755c32c84 Minor, fix appendln deprecation warnings in cli
Can't use appendLine yet because this module is compiled with API
version 1.3.
2020-09-22 19:10:58 +02:00
Toshiaki Kameyama
f20a6b7fe1 Change function signature: add/change receiver type
#KT-21799 Fixed
2020-09-22 18:07:24 +02:00
Mads Ager
9f3ce099ee [JVM_IR] Fix line numbers for function reference invoke methods. 2020-09-22 16:59:46 +02:00
Ilya Goncharov
16b2379cd7 [Gradle, JS] Use new npm versions 2020-09-22 16:57:21 +03:00
Ilya Goncharov
9f9cb4f57e [Gradle, JS] Parallelize requests 2020-09-22 16:57:21 +03:00
Ilya Goncharov
a86dd8b5ba [Gradle, JS] Refactor with coroutines 2020-09-22 16:57:21 +03:00
Ilya Goncharov
4986e8c9cc [Gradle, JS] Fetch NPM package versions in separate module 2020-09-22 16:57:21 +03:00
Ilya Goncharov
db90c9cc88 [Gradle, JS] Move from NpmVersions 2020-09-22 16:57:21 +03:00
Mikhael Bogdanov
7d4a734791 Fix nullability of typePath parameter
#KT-41484 Fixed
2020-09-22 15:37:02 +02:00
Dmitry Petrov
0539b2b389 Mute some FIR->JVM_IR box tests
FIR generates delegated class members incorrectly (with non-substituted
signatures).
2020-09-22 16:32:27 +03:00
Dmitry Petrov
c03573fc18 JVM_IR fix override equivalence check for collection stub generation
KT-42043 KT-42033
2020-09-22 15:26:34 +03:00
Pavel Kirpichenkov
fdc134ff66 [NI] Use compatibility mode for KT-41934 2020-09-22 15:06:12 +03:00
Pavel Kirpichenkov
1465e10f12 Add language feature for inference compatibility mode
The feature is intended for updates in the inference algorithm
that change behaviour compared to the previous stable version.
2020-09-22 15:06:12 +03:00
Pavel Kirpichenkov
896fbbd1a3 [NI] Add extra ordering for ready-for-fixation variables
Helps fixing to more specific type in the following situations:
Type1 <: Var1
Var2 <: Var1
Var2 <: Type2

Type1 and Type2 may also be nullable and non-nullable versions of the same type.
Note that no additional constraints can be inferred from such constraints before fixation.
Resulting types for variables will always Type1 and Type2 may also be nullable and non-nullable versions of the same type.
Fixing Var1 first will make Var2's type more specific while fixing Var2 first
will make Var1's type less specific. The first is preferrable in general.
2020-09-22 15:06:12 +03:00
Kirill Shmakov
ec8465859c Support rerun of MPP tests for jvm target 2020-09-22 14:44:22 +03:00
Kirill Shmakov
23642d2f86 Support rerun of common MPP tests
This is to fix #KT-36909
2020-09-22 14:44:19 +03:00
Toshiaki Kameyama
c09c0468d4 Replace deprecated symbol usage: move named lambda argument outside parentheses
#KT-31523 Fixed
2020-09-22 10:51:36 +02:00
Toshiaki Kameyama
d9cf4ee732 Add intention to evaluate compile time expression
#KT-40251 Fixed
2020-09-22 10:46:54 +02:00
Mark Punzalan
8cac3f654c [FIR] Handle pre/postfix dec/increment of labeled expression 2020-09-22 11:06:27 +03:00
Mark Punzalan
f55ff8eb1b [FIR] Capture receiver for pre/postfix dec/increment of qualified access
This prevents double-evaluation of the receiver expression, which may
have side-effects. E.g.: a.b++
2020-09-22 10:20:46 +03:00
Mikhail Glukhikh
393189db8d FIR JVM serializer: fix compilation after rebase 2020-09-22 09:54:43 +03:00
pyos
6e143a2656 JVM_IR: collect free type parameters when serializing FIR metadata
The "free" in "createFreeFakeLambdaDescriptor" and such refers to the
fact that there are no references to type parameters from outside the
current declaration. This is necessary because at the point where the
metadata is written, the type parameters may not even be in scope (e.g.
local delegated properties are serialized at class level, but may refer
to function-scope type parameters).
2020-09-22 09:35:50 +03:00
pyos
aa58ed9234 JVM_IR: partially implement FIR local delegated property reflection
Type parameter references are broken, just like for lambdas. Also, the
code is super ugly.
2020-09-22 09:35:45 +03:00
Alexander Udalov
6f622920e7 Minor, deduplicate matching JVM_OLD/JVM_IR duplicateJvmSignature tests 2020-09-21 18:49:36 +02:00
Mads Ager
05c662ec55 [JVM_IR] Remove line numbers from delegated member functions.
This fixes smart step into for delegated member functions.
Additionally, we align on the string "memberFunctionName(...)"
for expression non-null checks for both JVM_IR and JVM
backends.
2020-09-21 18:49:08 +02:00
Leonid Startsev
eea4ff33a0 Adapt serialization exceptions constructor calls to signature change
(see https://github.com/Kotlin/kotlinx.serialization/pull/1054)
2020-09-21 17:10:12 +03:00
Leonid Startsev
fe5dbf75fa Add diagnostic to check whether provided custom serializer matches
type of the property.

Check for serializer type mismatch only when custom serializer is present

Otherwise, there are too many false positives on e.g. PolymorphicSerializer

#KT-36329 Fixed

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/830
2020-09-21 17:10:12 +03:00
Leonid Startsev
bc432ecb85 Improve remove/specify type intentions in Explicit API mode
Do not suggest to remove type for public declarations

 #KT-38915 Fixed

Do not show intention to specify type when corresponding quickfix is available

 #KT-39026 Fixed
2020-09-21 17:10:10 +03:00
Leonid Startsev
5f0e7c3c3f Check return type of internal @PublishedApi functions in Explicit API mode
#KT-38981 Fixed
2020-09-21 17:03:06 +03:00
Mikhail Glukhikh
a9972913a6 [FIR TEST] Add some FIR_IDENTICAL to fix recently changed tests 2020-09-21 16:20:37 +03:00
Andrey Uskov
c9054e7a04 Added possibility to split gradle-integration-tests locally
Added property `gradle.integration.tests.split.tasks` for splitting
gradle-integration-tests into several tasks locally (like it happens
at TeamCity)
2020-09-21 13:34:32 +03:00
Andrey Uskov
d151f0e573 Fixed splitting gradle tests into different tasks 2020-09-21 13:34:25 +03:00
Dmitry Savvinov
769c741d87 Revert "Pack jvm builtins into kotlin-stdlib shipped with idea plugin"
This reverts commit 0b5aedb0a2.
2020-09-18 17:30:44 +03:00
Dmitry Savvinov
6db70bb97d Minor: fix forgotten testdata after 6a55475392 2020-09-18 16:42:49 +03:00
Ilya Gorbunov
0b5aedb0a2 Pack jvm builtins into kotlin-stdlib shipped with idea plugin
This lessens the possibility that kotlin plugin will get different
variants of builtins in the classpath, thus making builtins resources
loading less order-dependent.
2020-09-18 15:11:45 +03:00
Leonid Startsev
f2cf64aec7 Create plugin context before launching actual psi2ir process.
Because IrPluginContextImpl constructor creates new instance of
BuiltinSymbolsBase (with symbols for stdlib declarations like `arrayOf` etc),
there should be at least one pass of `declareUnboundSymbolsAsDependencies`
between creation and usage in plugin. Such pass is located between psi2ir
and compiler plugins application. If plugin context is created inside lambda,
right before plugins are applied, the symbols will remain unbound.

 #KT-41764 Fixed
2020-09-18 14:58:38 +03:00
Dmitry Petrov
ee3ada4e55 JVM_IR KT-40304 KT-41998 special handling for 'removeAt' 2020-09-18 14:27:36 +03:00
Kirill Shmakov
9008944860 Use target of the test in rerun dialog
This is to fix #KT-37799
2020-09-18 13:15:41 +03:00
Ilmir Usmanov
b406022315 Mark Unit unspillable if it is merged with unspillable Unit
#KT-42004: Fixed
2020-09-17 23:23:14 +02:00
Alexander Udalov
f6e4705d9c Regenerate KotlinSteppingTestGenerated 2020-09-17 22:16:47 +02:00
Mads Ager
a62ffbf992 [JVM_IR] Ignore fwBackingField stepping test.
The test relies on fixes not yet landed, so it currently fails.
2020-09-17 22:14:30 +02:00
Georgy Bronnikov
8343ca093c IR: bugfix in wrapped, IR-based descriptors 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
c2bdedfbae JVM_IR: remove descriptor usage from JvmSignatureClashDetector 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
c7f10c272a JVM_IR: remove .toKotlinType() from PromisedValue 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
7c5e255fa3 JVM_IR: remove .toKotlinType() from IrInlineIntrinsicsSupport 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
991a832d8c JVM_IR: remove KotlinType reference from jvm/ir/IrUtils.kt 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
3c0fbd5f45 IR: remove .toKotlinType() usage from coerceToUnit calls in lowerings 2020-09-17 19:16:03 +03:00
Dmitry Savvinov
6a55475392 Dont show warning for KT-21515 with LV>=1.3 2020-09-17 18:33:19 +03:00
Dmitriy Novozhilov
57ceb0fa20 [FIR] Don't create call to this in generated provideDelegate for top-level extension properies 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
a666eee67b [FIR] Properly deserialize annotations on typealias and underlying type 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
748049daa3 [FIR] Don't call inline lambda twice in withFullBodyResolve 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
f9de2621b2 [FIR] Minor, fix TODO in constantValues
KT-8507
2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
535de7bdc8 [FIR] Cleanup code of FirTypeDeserializer.kt 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
8deab3559e [FIR] Get rid of FirDeserializationComponents 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
d4cc98fab1 [FIR] Safe VersionRequirementTable in deserialized declarations 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
7c5160a968 [FIR] Remove meaningless TODO's 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
73c8059884 [FIR] Properly deserialize arrays in annotation arguments 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
ae819ff059 [FIR] Add configurable typeRef to FirArrayOfCallBuilder 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
d4891cb464 [FIR] Move Jsr305State from FirSession to separate component 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
93d63f7c66 [FIR] Get rid of FirResolvedFunctionTypeRef 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
edab50ac61 [FIR] Get rid of FirResolvedTypeRef.isSuspend 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
6c5cf8eda3 [FIR] Cleanup code in body resolve 2020-09-17 17:23:24 +03:00
Dmitriy Novozhilov
d4038f35b6 [FIR] Make BodyResolveComponents an abstract class 2020-09-17 17:23:24 +03:00
Ilmir Usmanov
dfd7f33bd3 Minor. Add test with reified type parameter 2020-09-17 16:14:07 +02:00
Ilmir Usmanov
9ecf5dc9af Support is/as operations on suspend callable reference conversion 2020-09-17 16:14:04 +02:00
Vladimir Dolzhenko
dfe6c42f63 Remove 203 version from idea range for kotlin plugin 1.4.20
^KT-41976 Fixed
2020-09-17 11:58:46 +02:00
Vladimir Dolzhenko
985f2b839c Add regression tests to cover Unused symbol with private anonymous object property
^KT-39454 Fixed
2020-09-17 11:54:53 +02:00
Jinseong Jeon
d1ba69044e FIR: update the type of anonymous function as SAM 2020-09-17 12:45:26 +03:00
Ilmir Usmanov
f960201f52 Ignore type parameters of inline class
when checking whether we can return unboxed inline class
from suspend function
2020-09-17 11:20:48 +02:00
Dmitry Petrov
fbfe56e0cc JVM_IR KT-41915 compare Kotlin signatures when adding collection stubs 2020-09-17 11:37:29 +03:00
Toshiaki Kameyama
0e4bd70c29 Redundant nullable return type: fix false positive with elvis return
#KT-41878 Fixed
2020-09-17 09:49:02 +02:00
Vladimir Dolzhenko
51d405e950 Add json output for IDE performance tests 2020-09-17 08:57:08 +02:00
Jinseong Jeon
72dea05854 FIR2IR: approximate type argument if reified 2020-09-17 09:43:46 +03:00
Jinseong Jeon
721248f883 FIR: migrate type-related utils to relevant file 2020-09-17 09:32:52 +03:00
Mikhail Glukhikh
0436a555d5 [FIR serializer] Support type approximation
Before this commit we relied on a fact that exotic types aren't
possible at serialization stage. However, in non-ABI mode we can get
even a private function (e.g. top-level private), so we have to perform
this approximation.
2020-09-17 09:19:34 +03:00
Mikhail Glukhikh
94a30ff904 [FIR] Drop redundant type check 2020-09-17 09:16:00 +03:00
Roman Artemev
4da7e762fe [IR] Skip hidden parameters in WrappedDescriptors 2020-09-17 00:57:17 +03:00
Roman Artemev
1da2830e2b [IR] Support hidden parameters in ir builder 2020-09-17 00:57:16 +03:00
Roman Artemev
b84084d54e [IR] Support hidden parameters in IrMangler
- make them be skipped in signature
2020-09-17 00:57:16 +03:00
Roman Artemev
8209b70a2f [KLIB] Support isHidden flag in deserialization 2020-09-17 00:57:16 +03:00
Roman Artemev
83d6255294 [KLIB] Support isHidden in proto flags 2020-09-17 00:57:16 +03:00
Roman Artemev
f01941d1dd [IR] Support isHidden is IrFactory API
- add API to create a hidden value parameter
2020-09-17 00:57:16 +03:00
Roman Artemev
79e2886da1 [IR] Add isHidden flag into IrValueParameter 2020-09-17 00:57:15 +03:00
Ilya Kirillov
be16fa76ab Wizard: fix not auto-updated artifactId on project name change
#KT-41695 fixed
2020-09-17 00:29:48 +03:00
Ilya Kirillov
ca3b327592 Wizard: add missing jvm target version for tests in Groovy DSL
#KT-41958 fixed
2020-09-17 00:29:48 +03:00
Ilya Kirillov
ee2f0f45fc Wizard: ignore Kotlin repo in tests
They may differ sometimes as they depend on the latest Kotlin release
2020-09-17 00:29:47 +03:00
pyos
9b157fd291 JVM_IR: remove a descriptor-related hack from InterfaceLowering
It will break with FIR.
2020-09-16 18:58:40 +02:00
pyos
dd913ef450 JVM_IR: move common metadata serialization code to ClassCodegen 2020-09-16 18:58:40 +02:00
pyos
a06181771f IR: make DescriptorMetadataSource a subtype of MetadataSource
FirMetadataSource is a metadata source too.
2020-09-16 18:58:40 +02:00
Alexander Udalov
86cc5840ed JVM IR: unmute stepping test noParameterExtensionLambdaArgumentCallInInline3.kt
Bytecode generated by JVM IR ensures that on multiline expressions,
every call is stepped over, which seems better than in the old backend.

Also remove kt34905.kt since it duplicates this test case.
2020-09-16 17:52:27 +02:00
Alexander Udalov
0cccc61654 JVM IR: unmute stepping test smartStepIntoInterfaceImpl.kt
The only difference seems to be that step into IImpl.fooOverride is
actually supported in JVM_IR. Also fix slightly incorrect line numbers
in the comments.
2020-09-16 17:52:27 +02:00
Mads Ager
e943d76266 [JVM_IR] Rebase fwBackingField stepping test.
The difference is that JVM_IR generates line numbers for the
constructor field initialization.

In this case:

```
29: class B {
30:   // comment
31:   val bPropVal: Int,
32:   // comment
33:   var bProbVar: Int
34: ) {
```

the line numbers for the field initializations are 31 and 33 where
in the current backend the whole constructor has line number 29.
2020-09-16 17:51:22 +02:00
Лихолетов Михаил
cfc1ebb4be [FIR] Support several annotation argument diagnostics 2020-09-16 16:53:31 +03:00
Mikhail Glukhikh
0c13d3197c [FIR] Fix non-serializable type argument at the end of resolve 2020-09-16 16:53:29 +03:00
Dmitry Petrov
54d5494ecd JVM_IR special handling for 'remove' collection method stub 2020-09-16 15:36:16 +03:00
Kirill Shmakov
e6e47f8848 Make watchOS test runnable on another bitness 2020-09-16 14:58:28 +03:00
Alexey Tsvetkov
c56952a01e Provide message collector for Java IC analysis
#KT-37446 Fixed
2020-09-16 14:04:51 +03:00
Victor Petukhov
17db188b0e Add regression test for already fixed issue KT-41396 2020-09-16 14:02:32 +03:00
Alexander Anisimov
5e46e5355d Merge pull request #3706 from 1anisim/patch-2
Update ReadMe.md
2020-09-16 13:59:12 +03:00
Igor Yakovlev
57ebd0e13a [FIR IDE] Remove unused code and add logging to LightClassProvider
Remove not used icons from independed icons provider
Add class logging to KotlinUsageTypeProvider
Remove redundant comments from LightClassProvider
2020-09-16 10:47:47 +03:00
Igor Yakovlev
be4fcd626c [FIR IDE] Separate searchers from descriptor usage
KotlinConstructorDelegationCallReferenceSearcher
KotlinConventionMethodReferencesSearcher
KotlinDefinitionsSearcher
KotlinOverridingMethodReferenceSearcher
KotlinPropertyAccessorsReferenceSearcher
KotlinTodoSearcher
2020-09-16 10:47:47 +03:00
Abduqodiri Qurbonzoda
36e6247125 Add more details about bit shift operations #KT-41112 2020-09-16 04:05:12 +03:00
Abduqodiri Qurbonzoda
1c0ac850e8 Incorrect documentation for rangeTo function #KT-41356 2020-09-16 04:05:12 +03:00
Steven Schäfer
56c4a27887 Android Synthetics: Resolve unbound symbols in the AndroidIrExtension 2020-09-15 22:36:50 +02:00
Steven Schäfer
fe466f3dc6 Android Synthetics: Update test infrastructure 2020-09-15 22:36:50 +02:00
Alexander Udalov
fb183ec3f8 Never use JVM IR to compile coroutines-experimental
JVM IR backend doesn't support old coroutines, so we disable it via
-Xno-use-ir, just as for the main source set. This option has no effect
for the current master builds, but will be necessary once JVM IR is
enabled project-wide.
2020-09-15 19:59:14 +02:00
Alexander Udalov
f6187b9d64 Remove dependency of fir:tree:tree-generator on kotlin-reflect
This dependency was unused. It allows to avoid waiting for compiling
kotlin-reflect (which includes descriptors, deserialization, etc.)
before compiling FIR modules and thus improves total build time.
2020-09-15 19:59:14 +02:00
Ilmir Usmanov
58146c4452 Keep DebugMetadata annotation when regenerate lambda with state-machine
When a suspend lambda does not capture crossinline lambda, it is
generated with as state-machine, since it does not inline anything.
However, when regenerating, the inliner used to remove all DebugMetadata
annotations to avoid duplication. This lead to missing annotation if
the lambda is regenerated, but state-machine is not regenerated.
This change fixes the blind spot by readding the annotation after
regeneration.
 #KT-41789 Fixed
2020-09-15 19:57:02 +02:00
Kirill Shmakov
12489ef1b4 Show run test gutters only when appropriate
This is to fix KT-36370
2020-09-15 19:09:52 +03:00
Victor Petukhov
8cabfda832 Add regression test for already fixed issue KT-41885 2020-09-15 19:03:16 +03:00
Ivan Gavrilovic
7c360c0068 Kotlin Gradle plugin - use build service to share incremental compilation info
For large projects, incremental comilation mapping information may be quite
large. With configuration caching enabled, each task gets its own copy of that
state, and for a project with 1400 subprojects, this resulted in 3.6GB of additional
state stored (once task graph is cached).

This change introduces IncrementalModuleInfoProvider which allows build service
to be used if configuration caching is enabled, and it falls back to static
constant otherwise.
2020-09-15 15:19:56 +03:00
Igor Yakovlev
16d51eb510 [FIR IDE] Add ReadWriteAccessChecker FIR stub 2020-09-15 11:25:07 +03:00
Igor Yakovlev
7a19bc32a7 [FIR IDE] Add base implementation of find usages of overrides 2020-09-15 11:25:07 +03:00
Igor Yakovlev
f05630fcab [FIR IDE] Enabled search services and added services stubs 2020-09-15 11:25:07 +03:00
Igor Yakovlev
1a10275d0d [FIR IDE] Enabled usages services and added services stubs 2020-09-15 11:25:06 +03:00
Igor Yakovlev
75347d06b9 [FIR IDE] Move IconProvider in fir independed module 2020-09-15 11:25:06 +03:00
Igor Yakovlev
e30f09d513 [FIR IDE] Separate find usages logic from descriptors 2020-09-15 11:25:06 +03:00
Pavel Kirpichenkov
b102042dd8 Minor: add regression test for KT-41806 2020-09-15 10:52:47 +03:00
Jinseong Jeon
2fad935ce2 FIR deserializer: load inline/external flags properly 2020-09-15 10:21:35 +03:00
Sergey Bogolepov
2154c94100 [Native] Add tests for resolvable properties 2020-09-15 13:54:10 +07:00
Sergey Bogolepov
5a0a853d9b [Native] Add simple symbol mechanism to konan.properties
Java Properties format is extremely trivial and does not support any
kind of references or variables. It makes konan.properties repetitive.
This commits adds support of perl-like `$` sigil which allows to
reference properties inside values.
2020-09-15 13:54:09 +07:00
Pavel Punegov
fc35b5398c Mute test in Native 2020-09-14 23:41:47 +03:00
Nikita Bobko
0b2d05ee30 Minor: dereference archiveFile when logging it
Previously it was "Plugin artifacts packed to task ':zipPlugin' property 'archiveFile'"
After fix it's    "Plugin artifacts packed to /home/bobko/jb/kotlin/build/kotlin-plugin.zip"

`archiveFile` has type `Provider<RegularFile>`
2020-09-14 21:37:09 +03:00
Aleksei Cherepanov
c64c319231 JPS. Suppress "Add new files to git" during portable artifacts extraction 2020-09-14 19:06:43 +03:00
Roman Golyshev
7e2269a3cf Update completion-ranking-kotlin dependency (0.1.2 -> 0.1.3) 2020-09-14 15:19:36 +00:00
Mikhail Glukhikh
97ebf2867a [FIR] Get rid of type mismatch suppression during diagnostic casting 2020-09-14 18:08:33 +03:00
Mikhail Glukhikh
6fd3b011ca [FIR] Simplify substitution for unsafe-variant type parameter types
#KT-41792 Fixed
2020-09-14 18:08:31 +03:00
Mikhail Glukhikh
e1b4108e4a [FIR2IR] Mute some tests due to captured type problems 2020-09-14 18:08:30 +03:00
Mikhail Glukhikh
aa897db132 [FIR] Introduce UnsafeVariance attribute (see KT-41792) 2020-09-14 18:08:29 +03:00
Mikhail Glukhikh
e4aaae9ae7 FIR call completion: approximate type argument types
This commit removes some captured / ILT types at the end of resolve
2020-09-14 18:08:28 +03:00
Mikhail Glukhikh
3b828ac62b [FIR] Bad test data fixes (around captured types) 2020-09-14 18:08:27 +03:00
Mikhail Glukhikh
cf5480a398 [FIR] Questionable test data fixes (around captured types) 2020-09-14 18:08:26 +03:00
Mikhail Glukhikh
4605a65f41 [FIR] Good test data fixes (around captured types) 2020-09-14 17:56:39 +03:00
Mikhail Glukhikh
c2d9fc469a Get rid of exception at ConeKotlinType.varargElementType 2020-09-14 17:56:37 +03:00
Mikhail Glukhikh
2f61a2f56f [FIR] Provide correct comparison of captured types 2020-09-14 17:56:36 +03:00
Mikhail Glukhikh
b5f8fec213 FIR substitution: use standard approximation to remove captured types 2020-09-14 17:56:35 +03:00
Mikhail Glukhikh
7a73787680 [FIR] Use captureFromArguments in createSubstitution
This commit breaks ~57 resolve tests because captured types
now exists at the end of FIR resolve
2020-09-14 17:56:34 +03:00
Mikhail Glukhikh
e83f3bbf04 Introduce substitution to ConeTypeContext.captureFromArguments
This commit itself does not influence anything
2020-09-14 17:56:33 +03:00
Mikhail Glukhikh
414842343d [FIR2IR] Add another problematic test with captured type argument 2020-09-14 17:56:32 +03:00
Mikhail Glukhikh
267382d86b [FIR2IR] Add problematic test with incorrect type argument
NB: we should not have <E> as AbstractFirBasedSymbol type argument,
because it isn't accessible in the current scope. Star expected instead.
2020-09-14 17:56:30 +03:00
Dmitry Petrov
b395771d01 KT-37050 don't generate redundant special bridges
Loosely based on https://github.com/JetBrains/kotlin/pull/3662
2020-09-14 16:13:34 +03:00
Alexander Udalov
f0282bcfdf JVM IR: add module name for internal functions before "$default"
The change is a bit complicated because the name mapping logic is
refactored so that we would compute the needed suffix first (either
module name, or multifile part class name), and then shove it into the
mangled name between the original function name and "$default", if the
function in question is the default arguments adapter.

The main motivation for this change was to fix KT-41809, but as a side
effect, private functions with default arguments in multifile parts now
also contain the file name, just like normal private functions.

 #KT-41809 Fixed
2020-09-14 13:18:24 +02:00
Alexander Udalov
93f38e1c61 JVM IR: minor, use more specific types in MethodSignatureMapper 2020-09-14 13:18:24 +02:00
Alexander Udalov
2a0f64ebcb JVM IR: do not generate Deprecated(HIDDEN) class as synthetic
#KT-41810 Fixed
2020-09-14 13:18:24 +02:00
Ivan Gavrilovic
162dc3aa0c KT-41295: Friend paths and compiler options compatible with conf caching
This change fixes serialization of friend paths and it uses
a file collection to record all friend paths. Also, when
computing the tested classpath for android projects, we now avoid
resolving the file collection until necessary.

Fixes: KT-41295
Test: ConfigurationCacheForAndroidIT
2020-09-14 13:31:52 +03:00
Dmitriy Novozhilov
be916e556a [FIR] Properly update type of block after postponed analysis of it's content 2020-09-14 11:46:06 +03:00
Dmitriy Novozhilov
535898c8a4 [FIR] Fix processing integer operator calls for not integer types 2020-09-14 10:57:10 +03:00
Dmitriy Novozhilov
def647c094 [FIR] Don't constraints for return expressions of lambda if it has Unit return type 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
8e0d0d2fd8 Remove redundant safe call to fix FIR compilation 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
4929417aea Remove redundant type arguments to fix compilation with FIR
#KT-41835
2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
324aaaddad [FIR] Rename createArrayOf to createArrayType 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
3b941a8f43 [FIR] Complete types of array literals in annotations 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
fbe964c074 [FIR] Transform annotations on safe calls 2020-09-14 10:57:08 +03:00
Jinseong Jeon
0bd7de158c FIR: update suspend lambda type during declaration resolution 2020-09-14 10:20:45 +03:00
Jinseong Jeon
680dd64211 FIR2IR: pick return target based on matched IrFunction 2020-09-14 10:09:51 +03:00
Jinseong Jeon
6ebad9589a FIR2IR: set proper IR origin for iterator in ranges 2020-09-14 10:09:45 +03:00
Mikhail Glukhikh
578e707ab9 FIR2IR: set VARIABLE_AS_FUNCTION origin only for invoke receivers 2020-09-14 10:09:32 +03:00
Mikhail Glukhikh
f0a2a62405 [FIR2IR] Minor: coneTypeSafe -> coneType 2020-09-14 09:18:46 +03:00
Jinseong Jeon
89ffce22d8 FIR2IR: set proper IR origin for variable as function 2020-09-14 09:05:08 +03:00
Andrey Uskov
bf3a7e5fea Add more tasks in Gradle build for running GradleIT in parallel 2020-09-13 22:48:12 +03:00
Nikolay Krasko
a7f57646bf Prevent rebuilding by avoid registering doFirst on source tasks (KTI-324)
Do the check for empty directories at the build end instead.

Registering doFirst makes constant recompile when switching from Kotlin to Kotlin
Native composite with the reason:

```
The task was not up-to-date because of the following reasons:
One or more additional actions for task ':kotlin:kotlin-stdlib-common:compileKotlinCommon' have changed.
```

Exact reason why actions are different is not clear (there's a single
action in both builds in comparison), but probably the reason in
different types due to usage of composite build.

 #KTI-324 Fixed
2020-09-13 19:18:01 +03:00
Alexander Udalov
9250d86915 JVM IR: generate field for private companion object in interface as synthetic 2020-09-13 09:13:27 +02:00
Alexander Udalov
fc141a52da IR: minor, make IrClass.companionObject return IrClass 2020-09-13 09:13:26 +02:00
Alexander Udalov
2f86554d5a IR: don't produce fake overrides for static and private declarations
Note that only irrelevantStaticProperty.kt failed before this change.
Having private declarations caused no problems, but it seems incorrect,
so it's fixed now and irrelevantPrivateDeclarations is added just in
case.

 #KT-41848 Fixed
2020-09-12 20:01:34 +02:00
Roman Golyshev
703150e3ad FIR IDE: Refactor LowLevelFirApiFacade.kt 2020-09-12 11:49:36 +00:00
Roman Golyshev
edb277b30a FIR Completion: Enable passing tests 2020-09-12 11:49:36 +00:00
Roman Golyshev
dcc22d3e5d FIR IDE: Fix completion in property setters
Property consists of getter and setter (both optional). The setter
have a single `value` parameter with type

Because of it, we have to make a separate 'frankenstein setter' with
original resolved header, but with the body of the fake one

It seems that getters does not have such issues
2020-09-12 11:49:35 +00:00
Roman Golyshev
5c1520305b FIR IDE: Build symbols from any FirValueParameter 2020-09-12 11:49:35 +00:00
Roman Golyshev
ae8933dbd2 FIR IDE: Correctly handle properties in KtFirCompletionCandidateChecker
- Introduce `EnclosingDeclarationContext` to remove code duplication
2020-09-12 11:49:34 +00:00
Roman Golyshev
6fd871d0ba FIR IDE: Add building completion context for properties 2020-09-12 11:49:33 +00:00
Roman Golyshev
58965d1e71 FIR IDE: Implement RawFirBuilder::buildPropertyWithBody, add tests 2020-09-12 11:49:33 +00:00
Georgy Bronnikov
5f57311015 JVM_IR: remove .toKotlinType() from intrinsics.Equals 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
2c1735c211 JVM_IR: remove descriptor usage from JvmOptimizationLowering 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
a14c9018b1 JVM_IR: remove descriptor usage from SyntheticAccessorLowering 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
3327524e18 JVM_IR: remove descriptor usage from TypeAliasAnnotationMethodsLowering 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
905978a458 JVM_IR: remove descriptor usage from JvmCachedDeclarations 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
92b03e7ede JVM_IR: Remove descriptor usage from IrSourceCompilerForInline 2020-09-12 12:59:03 +03:00
Georgy Bronnikov
0a66dbf2b5 JVM_IR: remove descriptor usage in CompareTo intrinsic 2020-09-12 12:58:29 +03:00
Toshiaki Kameyama
370622087b Redundant nullable return type: false negative with return expression in local function or lambda
#KT-41817 Fixed
2020-09-11 19:09:57 +02:00
Toshiaki Kameyama
de3907e8cc Redundant nullable return type: fix false positive with non-local return
#KT-41800 Fixed
2020-09-11 19:09:57 +02:00
Ilya Gorbunov
349cad7b9a Minor: migrate remaining scanReduceIndexed usages 2020-09-11 19:08:04 +03:00
Alexander Gorshenev
744f290fc4 A proper modality calculation was missing in IR fake override construction algorithm
#KT-41765 Fixed
2020-09-11 18:56:17 +03:00
Louis CAD
2886f48795 Improve spelling in Kotlin Test module's README.md 2020-09-11 18:45:58 +03:00
Louis CAD
64408c19f8 Add missing "The" article in kotlin.test doc 2020-09-11 18:20:37 +03:00
Andrey Uskov
175a8bec9d Make KotlinCoreEnvironment.disposeApplicationEnvironment() public
The method disposeApplicationEnvironment should be used in Gradle
after the configuration phase. This allows not to recreate the compiler
environment after each kts file compilation and improve overall
performance the evaluation and configuration phases.
2020-09-11 15:13:11 +03:00
Victor Petukhov
fca6436170 Fix IDE test after bcd33da6f8 2020-09-11 13:51:15 +03:00
Igor Yakovlev
e08763f3dd [ULC] Add annotations for PsiTypes in UltraLight classes
WIP on KT-41148, KT-41406, KT-41420
2020-09-11 12:49:05 +03:00
Igor Yakovlev
b82d8cd4f4 [ULC] Fixed invalid access to lightclass infrastructure from UL 2020-09-11 12:49:05 +03:00
Igor Yakovlev
8fc94ddb8c [UCL] Minor fixes 2020-09-11 12:49:05 +03:00
Igor Yakovlev
97ac86273a [ULC] Add support of const fields to multifile facade 2020-09-11 12:49:05 +03:00
Igor Yakovlev
309bf49a83 Update lightclass tests renderer
+mute invalid old light classes tests
2020-09-11 12:49:04 +03:00
Igor Yakovlev
c70383cc70 [ULC] Add compiler flag -Xdisable-ultra-light-classes to fallback to light implementation in CLI 2020-09-11 12:49:04 +03:00
Nicolay Mitropolsky
e53db4c771 Uast: fixing WrappedUAnnotation identifiers 2020-09-11 12:49:04 +03:00
Igor Yakovlev
4b8f1bb362 [ULC] Add LanguageVersionSettings to CliLightClassGenerationSupport
+ refactoring
2020-09-11 12:49:04 +03:00
Igor Yakovlev
31b4a021a9 [ULC] Add JvmDeclarationOriginKind.DELEGATION to DeclarationOriginKindForOrigin of delegated methods 2020-09-11 12:49:03 +03:00
Igor Yakovlev
b263e1c924 [ULC] Remove nullability annotation for UL backing fields of private props 2020-09-11 12:49:03 +03:00
Igor Yakovlev
a36d53e086 [ULC] Skip nullability annotation for backing field of lateinit property 2020-09-11 12:49:03 +03:00
Igor Yakovlev
cd32cf7828 [ULC] Add PsiElement overrides for UL elements with source 2020-09-11 12:49:03 +03:00
Igor Yakovlev
131c14626c [ULC] Fix invalid alias search for UL classes 2020-09-11 12:49:03 +03:00
Igor Yakovlev
2c16ae968d [ULC] Add support @receiver annotation site to UL classes 2020-09-11 12:49:02 +03:00
Igor Yakovlev
dbb4337ac4 [ULC] Fix invalid annotation resolve for KtUltraLightParameterForSetterParameter 2020-09-11 12:49:02 +03:00
Igor Yakovlev
db6aa9140d [ULC] Refactor for lightAnnotations classes 2020-09-11 12:49:02 +03:00
Igor Yakovlev
c4cee35cca [ULC] Fixed invalid UL facade annotations
1) Hide annotations for MultiFile class
2) Remove nullability for private fields
2020-09-11 12:49:01 +03:00
Igor Yakovlev
6542ea9ba1 [ULC] Add constant evaluation to light classes service 2020-09-11 12:49:01 +03:00
Igor Yakovlev
55bb8f24e3 [ULC] Move UltraLightSupport to service provided bridge 2020-09-11 12:49:01 +03:00
Igor Yakovlev
7cb2631991 [ULC] Fix light class Coherence test 2020-09-11 12:49:01 +03:00
Igor Yakovlev
7b0eb51f8d [ULC] Add annotation support for UL facades 2020-09-11 12:49:01 +03:00
Igor Yakovlev
a5e304f520 [ULC] Better nullability annotations for light classes 2020-09-11 12:49:00 +03:00
Igor Yakovlev
c3810dc223 [ULC] Fixed UL backing field initializers 2020-09-11 12:49:00 +03:00
Igor Yakovlev
129979b0ff [ULC] Improve UL facades for private properties without accessors 2020-09-11 12:49:00 +03:00
Igor Yakovlev
025e2f2fe9 [ULC] Better support for UL MultifileFacade classes 2020-09-11 12:49:00 +03:00
Igor Yakovlev
bc12fb0d6b [ULC] Enable UL for script classes 2020-09-11 12:49:00 +03:00
Igor Yakovlev
1d248f1a00 [ULC] Fixed invalid fqName for script inner classes 2020-09-11 12:49:00 +03:00
Igor Yakovlev
236e41e024 [ULC] Fixed invalid super type for UL scripts 2020-09-11 12:48:59 +03:00
Igor Yakovlev
6accc8fcf9 [ULC] Fixed invalid constructor parameter list for UL script 2020-09-11 12:48:59 +03:00
Dmitriy Novozhilov
bf91ada06c [NI] Suppress false positive IDEA warnings in NewConstraintSystemImpl 2020-09-11 12:13:34 +03:00
Dmitriy Novozhilov
178cef5631 [FIR] Don't create synchronized lazy for constraint system in candidate 2020-09-11 12:13:34 +03:00
Dmitriy Novozhilov
a528deef0a [FIR] Update testdata due to previous commit and KT-37638
JavaSymbolProvider looks for available class names using KotlinJavaPsiFacade
  which don't return package private java classes which lays in files
  with names that don't match with class names, so we can not build FIR
  for such classes
2020-09-11 12:13:34 +03:00
Dmitriy Novozhilov
1dc3c93efa [FIR] Don't assume types with not found symbol as error types 2020-09-11 12:13:33 +03:00
Dmitriy Novozhilov
7f692be11e [FIR] Properly detect callable reference type according conversions 2020-09-11 12:13:33 +03:00
Mikhail Glukhikh
ec93e5886a [FIR2IR] Fix generation of accessors' extension receiver (f/o case) 2020-09-11 11:43:00 +03:00
Dmitriy Novozhilov
36d2129fd3 Move common deserialization classes from :core:metadata modules 2020-09-11 10:08:37 +03:00
Dmitriy Novozhilov
07a3009d43 Introduce new modules for common parts of deserialization 2020-09-11 10:08:37 +03:00
Dmitriy Novozhilov
2f4bd626fc [FIR] Make constant values in fir serialization internal
This is needed to avoid possible name clash with ConstantValue from FE 1.0
2020-09-11 10:08:36 +03:00
Dmitriy Novozhilov
9e1e525343 Fix circular dependency between :core:compiler:common.jvm and :core:metadata.jvm 2020-09-11 10:08:36 +03:00
Dmitriy Novozhilov
c82d9ea9f4 Remove dependency on :compiler:frontend.java from :compiler:fir:java 2020-09-11 10:08:36 +03:00
Dmitriy Novozhilov
1417fcecb8 Move more common parts from :compiler:descriptors.jvm 2020-09-11 10:08:36 +03:00
Dmitriy Novozhilov
192e07a07b [FIR] Remove dependency on FE 1.0 modules form :compiler:fir:fir-deserialization 2020-09-11 10:08:35 +03:00
Dmitriy Novozhilov
5d4d07066b Move common deserialization components to :core:metadata and :core:metadata.jvm 2020-09-11 10:08:35 +03:00
Dmitriy Novozhilov
cdab00fdc8 [FIR] Remove dependency on :core:deserialization from :compiler:fir:fir-serialization 2020-09-11 10:08:35 +03:00
Dmitriy Novozhilov
9beeb51227 [FIR] Implement fir-specific contract values and fix annotations serialization 2020-09-11 10:08:35 +03:00
Dmitriy Novozhilov
e1ad1aabc4 Move RequireKotlinConstants to :core:compiler.common 2020-09-11 10:08:34 +03:00
Dmitriy Novozhilov
8d2e89a9ea Move ProtoEnumFlags to :core:metadata 2020-09-11 10:08:34 +03:00
Igor Chevdar
e39ce91253 [IR] Fixed fake override builder for lowerings 2020-09-11 09:35:01 +05:00
Andrey Uskov
7f4bda0d52 Enable FUS internal mode on IDE launching 2020-09-10 21:07:14 +03:00
Alexander Udalov
ae9c1af883 Do not use erroneous unsigned/signed comparison in UnsignedArraysTest
The error SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED is suppressed in this
file, and JVM IR is not able to generate comparisons of UInt and Long
(KT-41780).
2020-09-10 19:27:09 +02:00
Victor Petukhov
bcd33da6f8 Don't check an argument type during passing it to vararg in the named form to avoid false positives if the argument type is type variable yet
^KT-41144 Fixed
2020-09-10 19:38:26 +03:00
Ilya Goncharov
2c4c8cdf01 [Wizard] Update versions in wizard 2020-09-10 19:25:26 +03:00
Vladimir Dolzhenko
38854ce40b Disable profilerConfig for AHeavyInspectionsPerformanceTest 2020-09-10 16:23:51 +02:00
Vyacheslav Gerasimov
e3b07120bb Build: Don't retry tests in local builds 2020-09-10 16:50:43 +03:00
Kirill Shmakov
29f3811bab Update gradle tooling
In response to a766369e72
2020-09-10 16:07:30 +03:00
Kirill Shmakov
60b812f452 Reorder arguments in KotlinNativeTest for better debug
Previously it was broken on Linux and worked poorly on macOS
2020-09-10 16:07:28 +03:00
1anisim
b202cf0f55 Apply suggestions from code review
Co-authored-by: Alexander Udalov <udalov@users.noreply.github.com>
2020-09-10 15:30:33 +03:00
1anisim
33d3e1f13e Update ReadMe.md 2020-09-10 14:13:42 +03:00
Jinseong Jeon
ef58e0cd71 FIR2IR: refactor adapter generation 2020-09-10 11:31:24 +03:00
Jinseong Jeon
5fdd06676f FIR: discriminate candidates with suspend conversion 2020-09-10 11:31:24 +03:00
Jinseong Jeon
6de8ba40c1 FIR: initial support of suspend conversion on arguments 2020-09-10 11:31:24 +03:00
Jinseong Jeon
49679f3145 FIR: map arguments for overloading indexed access operator 2020-09-10 11:25:36 +03:00
Vladimir Dolzhenko
a73856be66 Add warn message to ReplaceWithIgnoreCaseEquals inspection.
Relates to ^KT-40016
2020-09-10 08:20:54 +00:00
Vladimir Dolzhenko
5036673187 Improve package caching in KotlinJavaPsiFacade
^KT-33394 Fixed
2020-09-10 07:38:46 +00:00
Andrey Uskov
05d3e48564 Implemented collecting statistics about JS target mode 2020-09-10 00:39:27 +03:00
Ilya Goncharov
4716228500 Add js generate executable default collecting statistics
#KT-40462 Fixed
2020-09-10 00:39:24 +03:00
Ilya Goncharov
405e271b68 Add js generate externals collecting statistics
#KT-39995 Fixed
2020-09-10 00:39:20 +03:00
Vladimir Dolzhenko
6f03e42ef7 Revert back Inspection: convert initialized val to non-null type
Relates to ^KT-35757
Relates to ^KT-19321
2020-09-09 23:38:21 +02:00
Vladimir Ilmov
12ebd429bc Revert "Light classes support for declarations in multipart classes."
This reverts commit 3ea51a982c.
2020-09-09 19:46:03 +02:00
Vladimir Dolzhenko
d324ae6cda Fix AS 4.0 compilation 2020-09-09 17:59:49 +02:00
Ilmir Usmanov
0492a52a6a Minor. Regenerate tests 2020-09-09 17:43:43 +02:00
Ilmir Usmanov
52f9569d33 Generate CHECKCAST Object inside the markers
otherwise, the unboxing interferes with bytecode analysis.
2020-09-09 17:43:42 +02:00
Ilmir Usmanov
e8a451072e Minor. Add tests with same JvmType in covariant override 2020-09-09 17:43:41 +02:00
Ilmir Usmanov
7cbd067460 Add tests with resume path 2020-09-09 17:43:39 +02:00
Ilmir Usmanov
1c97eafea8 Check for COROUTINE_SUSPENDED inside callable reference
#KT-41429 Fixed
2020-09-09 17:43:37 +02:00
Ilmir Usmanov
4303e8126f Do not generate suspend markers inside callable reference
#KT-41429
 #KT-25519 Fixed
2020-09-09 17:43:36 +02:00
Ilmir Usmanov
ccc5b7afe0 Box inline class in resume path of suspend call
#KT-41429
2020-09-09 17:43:35 +02:00
Ilmir Usmanov
023cdd7cd4 Support not boxing inline class of reference class
even if the class is other than Any.
 #KT-41429 In progress
2020-09-09 17:43:34 +02:00
Toshiaki Kameyama
5c011bc954 Don't report when property is multi-line and action is MOVE 2020-09-09 22:31:56 +07:00
Toshiaki Kameyama
4569b85a16 MoveVariableDeclarationIntoWhenInspection: report it if initializer is single line even if property is multi line
#KT-39467 Fixed
2020-09-09 22:31:56 +07:00
Vladimir Ilmov
75d4c7e91c Find stdlib usages test case
relates to #KT-39196
2020-09-09 17:30:04 +02:00
Vladimir Ilmov
8b239d89b6 SourceNavigationHelper multifile classes support
Use .class files as BINARY instead of .metadata.
 relates to #KT-39196
2020-09-09 17:30:04 +02:00
Vyacheslav Gerasimov
3764eeba25 Build: Setup gradle.test-retry plugin for all test tasks in the project 2020-09-09 18:20:01 +03:00
Alexander Udalov
3d7619421f JVM IR: fix exception on star projection in type parameter upper bound
#KT-41761 Fixed
2020-09-09 17:07:52 +02:00
Victor Petukhov
685d16ec68 NI: don't do substitution for unsupported callable descriptors to use as callable references
^KT-41729 Fixed
2020-09-09 18:00:41 +03:00
Ilya Goncharov
668098f3a8 [Gradle, JS] Add simple files without kotlinx.html
^KT-41696 fixed
2020-09-09 17:24:08 +03:00
Vladimir Ilmov
3ea51a982c Light classes support for declarations in multipart classes.
relates to #KT-39196
2020-09-09 15:01:55 +02:00
Vladimir Ilmov
a5d91339b5 (lightClass) multifile classes facade in libraries added
relates to #KT-39196
2020-09-09 15:01:54 +02:00
Vladimir Dolzhenko
ac22232b8d Register disposable startup items in PluginStartupService 2020-09-09 12:51:19 +00:00
Vladimir Dolzhenko
e5985ad98b Rename PluginStartupService to PluginStartupApplicationService 2020-09-09 12:51:18 +00:00
Victor Petukhov
c1ebd33833 Capture flexible intersection types properly: take into account both bounds and use the same captured arguments for them
^KT-41693 Fixed
2020-09-09 14:52:12 +03:00
Victor Petukhov
140edb2215 Consider intersection with ILT subtype of ILT 2020-09-09 13:55:07 +03:00
Roman Golyshev
7bd9c52732 FIR Completion: Fix completion in function calls (foo.bar<caret>())
In such expressions, `KtCallExpression` wraps `KtSimpleNameExpression`,
so `getQualifiedExpressionForSelector()` returns `null`

Also, enable tests that are fixed by this
2020-09-09 13:14:08 +03:00
Roman Golyshev
2d4d48b401 FIR IDE: Invert the order of the scopes for completion
This way local declarations will be fetched first
2020-09-09 13:14:08 +03:00
Dmitriy Novozhilov
f748d8cf70 [FIR] Extract ResolutionContext to separate file 2020-09-09 12:38:36 +03:00
Dmitriy Novozhilov
1a84ec9677 [FIR] Mark all session components respectively to they have mutable state or not
Also add documentation for all fir annotations
2020-09-09 12:38:35 +03:00
Dmitriy Novozhilov
8686e3779e [FIR] Make all session components abstract classes 2020-09-09 12:38:35 +03:00
Dmitriy Novozhilov
caf325934c [FIR] Unmake FirSamResolver as session component
It can not be stored in session because it depends on scope session
  and have mutable state
2020-09-09 12:38:35 +03:00
Dmitriy Novozhilov
29addd2a2b [FIR] Make InferenceComponents session component 2020-09-09 12:38:35 +03:00
Dmitriy Novozhilov
41b395b0aa [FIR] Extract mutable state from InferenceComponents 2020-09-09 12:38:35 +03:00
Dmitriy Novozhilov
d70858edfa [FIR] Get rid of inference components in CheckerSink 2020-09-09 12:38:35 +03:00
Dmitriy Novozhilov
912676d868 [FIR] Introduce ResolutionContext and get rid of components in Candidate 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov
c53ffca34f [FIR] Extract BodyResolveContext from FirAbstractBodyResolveTransformer 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov
edb1273355 [FIR] Report ResolutionDiagnostics instead of applicability in resolve 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov
a148db9d81 [FIR] Get rid of CandidateApplicability.SYNTHETIC_RESOLVED 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov
19707667fd [FIR] Cleanup detection that applicability is successful 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov
68f3d84e22 [FIR] Use CandidateApplicability from FE 1.0 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov
cd557ad178 Change order of enum entries in CandidateApplicability 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov
d1568c1ce6 Rename ResolutionCandidateApplicability to CandidateApplicability 2020-09-09 12:38:33 +03:00
Mikhail Glukhikh
db2e3f219f [FIR] Keep bare type for type alias case 2020-09-09 12:16:09 +03:00
Alexander Udalov
3a5d0ab427 JVM IR: fix HashCode intrinsic for generics substituted with primitives
The problem here was that although the IR type of the expression was
primitive, the type of the actual expression in the bytecode generated
after type erasure was `Ljava/lang/Object;`, and we were trying to call
a non-existing method `Object.hashCode(Object)`.

 #KT-41669 Fixed
2020-09-08 23:37:00 +02:00
Alexander Udalov
c46c80822c JVM IR: fix enclosing constructor for lambdas in inner classes
Before this change, we stored the enclosing constructor in a map in
JvmBackendContext before moving lambdas and local classes out of
initializer blocks. However, in case the lambda was declared in an inner
class, we stored a reference to the unlowered constructor of the inner
class, whose JVM signature is "()V" instead of the correct "(LOuter;)V".
Java reflection then threw exception if we tried to call
`getEnclosingConstructor()` on such class at runtime. Proguard finished
with errors for the same reason.

It turns out that we can just store the fact that the class has been
moved, and load the matching constructor in codegen, where everything is
already lowered and guaranteed to match with the signatures of the
actual generated declarations.

 #KT-41668 Fixed
2020-09-08 23:37:00 +02:00
Alexander Udalov
228e329d1f JVM IR: generate enclosing constructor only for lambdas in initializers
There was a typo in JvmLocalClassPopupLowering which allowed the
EnclosingMethod for lambdas and anonymous classes in initializers to
become any function in a class, in case when there was no primary
constructor in that class. E.g. in the added test, `getIrrelevantField`
was the EnclosingMethod of the lambda class before this change.
2020-09-08 23:37:00 +02:00
Ilya Kirillov
2ab68b3245 Wizard: move boolean setting description to the bottom 2020-09-09 00:20:58 +03:00
Ilya Kirillov
ce00366c7f Wizard: fix when first selected template cannot be applied 2020-09-09 00:20:58 +03:00
Ilya Kirillov
3a6011fae9 Wizard: always generate android MPP tests
#KT-40940 fixed
2020-09-09 00:20:57 +03:00
Ilya Kirillov
553c525701 Wizard: fix Gradle buildscript formatting
#KT-37965 fixed
2020-09-09 00:20:57 +03:00
Ilya Kirillov
0f799d593d Wizard: specify test platform to use on JVM
#KT-37965 fixed
2020-09-09 00:20:57 +03:00
Ilya Kirillov
7002e86d6b Wizard: fix path & artifactId updating on name update
#KT-41695 fixed
2020-09-09 00:20:56 +03:00
Alexander Udalov
929b5f727d Build: add :compiler:fir:entrypoint to compilerModules
This fixes FIR usage from the CLI compiler.
2020-09-08 20:26:28 +02:00
Alexander Udalov
7fb7dc0210 Fix deprecation warnings related to Project extensions 2020-09-08 20:26:20 +02:00
Alexander Udalov
196893bc4d Build: fix more warnings about deprecated/Alpha MPP plugins
Using the new flags added in KT-41340 and
413d02621b.
2020-09-08 20:26:20 +02:00
Mads Ager
06680452dc [JVM_IR] Always look for default lambdas in the inliner.
This allows compiler plugins such as Compose to do custom
default argument handling in methods that do not have origin
`FUNCTION_FOR_DEFAULT_PARAMETER`.

The code still bails out early is there is not defaults
mask, so there should be no compile-time penalty.
2020-09-08 19:07:31 +02:00
anastasiia.spaseeva
a12e22bba4 [Spec tests] Fix dependencies for spec tests generator 2020-09-08 16:14:47 +03:00
1anisim
cf9f120d55 Update ReadMe.md
Added a section about Multiplatform Capabilities, highlighted KMM
2020-09-08 14:54:47 +03:00
Ilya Goncharov
9d3426486b [Gradle, JS] Support explicitApi in js plugin
^KT-41328 fixed
2020-09-08 12:54:11 +03:00
Dmitriy Novozhilov
28a83b04cd [FIR] Minor. Fix code style 2020-09-08 12:51:13 +03:00
Dmitriy Novozhilov
67604dcb66 [FIR] Add generator for checkers aliases and sets of checkers 2020-09-08 12:51:12 +03:00
Dmitriy Novozhilov
4de57fcac2 [FIR] Initialize module for checkers generator 2020-09-08 12:51:12 +03:00
Dmitriy Novozhilov
6656669551 [FIR] Fix typo 2020-09-08 12:51:12 +03:00
Dmitriy Novozhilov
3b9e86ccbf [FIR] Remove empty file 2020-09-08 12:51:12 +03:00
Dmitriy Novozhilov
a8a5ed3cd3 [FIR] Get rid of runCheck in checkers components 2020-09-08 12:51:11 +03:00
Dmitriy Novozhilov
71a855112e [FIR] Get rid of ParallelDiagnosticsCollector 2020-09-08 12:51:11 +03:00
Ilya Goncharov
20a1ea0413 [Wizard, JS] Change js compiler default
^KT-41656 fixed
2020-09-08 12:48:52 +03:00
Dmitry Petrov
6746bd81d5 PSI2IR tests for KT-41735 2020-09-08 12:34:19 +03:00
Vladimir Ilmov
aa04c0b5df Parent call already on KotlinBuiltInDecompiler.kt:79 2020-09-08 10:59:17 +02:00
Steven Schäfer
44ffb1fb3e Psi2Ir: Fix SAM conversion with new inference 2020-09-08 11:14:14 +03:00
pyos
75891e860b FIR2IR: split getIrPropertyOrFieldSymbol, handle locals there 2020-09-08 08:40:13 +03:00
pyos
f198a19ab0 FIR2IR: add local delegated property generation 2020-09-08 08:40:07 +03:00
Steven Schäfer
4792be2522 JVM IR: Optimize static property references (KT-36975) 2020-09-07 21:01:29 +02:00
Alexander Udalov
669fda6b77 Do not add duplicate $completion when compiling JVM against JVM_IR
This change fixes JvmOldAgainstIrBoxInlineTestGenerated.Suspend and
JvmIrAgainstOldBoxInlineTestGenerated.Suspend tests.
2020-09-07 19:41:38 +02:00
Alexander Udalov
ae448ececb Minor, add compileKotlinAgainstKotlin test case for KT-41374 2020-09-07 19:41:37 +02:00
Alexander Udalov
9e357354fb Add JVM/JVM_IR mixed compilation tests for compileKotlinAgainstKotlin/boxInline 2020-09-07 19:41:37 +02:00
Alexander Udalov
e324733b01 Tests: accept TargetBackend in KotlinBaseTest.createConfiguration 2020-09-07 19:41:37 +02:00
Alexander Udalov
0dea6b94c6 JVM IR: unmute boxInline tests on enclosing method/class
In box tests, only check that Java reflection does not crash on the
EnclosingMethod attribute generated in these classes. If it doesn't
crash, most likely it returns the value that can be read from the class
file by ASM, which is what the newly added bytecode listing tests are
checking now.
2020-09-07 19:41:37 +02:00
Ilya Goncharov
985088a3f1 [Gradle, JS] Add test on dukat with both mode 2020-09-07 19:29:17 +03:00
Ilya Goncharov
b694e3b009 [Gradle, JS] Dukat with both create externals only once 2020-09-07 19:29:17 +03:00
Ilya Goncharov
210cd982f0 [Gradle, JS] Use webpack config's required dependencies in karma
^KT-41663 fixed
^KT-41662 fixed
2020-09-07 18:56:47 +03:00
Pavel Kirpichenkov
b5aca450b1 Make cancellation checks when building resolution anchor caches
^KT-39734
2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov
54811613f4 Minor: drop unnecessary wrapper for utility function
^KT-39734
2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov
1ff064d98d Make Kotlin OOCBM updater for modules internal again
Replace direct API access with dedicated service.
2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov
9d6bdc6fc4 Support modification tracking for source-dependent LibraryInfo
#KT-39734
2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov
6abd708d42 Preserve order entry to module info mapping in IdeaModelInfosCache 2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov
24d8aee2bb Prioritize resolution anchors during resolution
When required dependency is present both in source dependencies and in
library dependencies, the former one should be selected.

#KT-24309
2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov
f8ee976720 Use union of all available descriptors in composite importing scope 2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov
5892bdf3f4 Extend import resolution for library-to-source analysis
Use composite importing scope for references when resolution anchors are enabled.
Composite scope provides additional descriptors from scope of resolution anchor module.
Overriding old importing scope with a new one is not possible as it breaks library
dependencies on other libraries, which are inaccessible in anchor scope (scope for sources).

KT-24309 In Progress
2020-09-07 18:52:10 +03:00
Roman Golyshev
8c876e4621 FIR IDE: Get rid of originalPosition in KtFirCompletionCandidateChecker 2020-09-07 18:46:38 +03:00
Roman Golyshev
828fc2520c FIR IDE: Refactor KtFirCompletionCandidateChecker
- Move searching for the `originalEnclosingFunction`
to the `getImplicitReceivers`
2020-09-07 18:18:02 +03:00
Pavel Kirpichenkov
33ac487a42 [FIR-IDE] Fix leaking KtAnalysisSession 2020-09-07 17:40:18 +03:00
Roman Golyshev
909d418dd1 Improve diagnostics in KtElementImplStub::getContainingKtFile
- If containing file is not a `PsiFileImpl`, `getNode()` will
throw a CCE (which will prevent collecting the diagnostics)
- Relates to #EA-209630
2020-09-07 14:36:09 +00:00
Dmitry Petrov
5b53663eb8 PSI2IR KT-41181 don't generate deep trees in hashCode 2020-09-07 16:09:42 +03:00
Dmitry Petrov
ade1a346e1 JVM: add test for KT-40123 2020-09-07 16:09:42 +03:00
Vladimir Ilmov
45c67a90c2 (CoroutineDebugger) Disposing under IW lock.
#KT-41505 fixed
2020-09-07 14:50:07 +02:00
Sebastian Kaspari
01143f24a4 Add KotlinClassConstructorInfoHandler for showing parameter info of parameterized super class constructor.
^KT-41617 Fixed
2020-09-07 13:23:08 +02:00
Pavel Kirpichenkov
d674f519fd [FIR-IDE] Fix completion check for generic extensions
Generic candidate extensions are completed in partial mode
when there is not enough information for type parameter in return position.
Partial completion mode in single candidate resolver leads to unconditionally failing candidate.
Providing noExpectedType instead of null guarantees full completion.
2020-09-07 13:38:11 +03:00
Vladimir Ilmov
60dfa8cc84 Ignore ProcessCancelledException in VirtualFileKotlinClass 2020-09-07 12:17:06 +02:00
Vladimir Dolzhenko
3de32e13ea Clean up declarationAccessorNames debug check in UnusedSymbolInspection
declarationAccessorNames(KtNamedDeclaration) could be more than declaration.getAccessorNames() as it relies on LC, some of them could be not accessible

^EA-237873 Fixed
2020-09-07 09:36:28 +00:00
Vladimir Dolzhenko
127257aa27 Provide setter-method for LC for private property setter
^KT-41694 Fixed
2020-09-07 09:36:28 +00:00
Vladimir Dolzhenko
b5b319803b Add more diagnostics to tackle exception in KotlinFunctionParameterInfoHandler
Relates to #EA-221900
2020-09-07 09:36:27 +00:00
Vladimir Dolzhenko
87e70cf690 Handle project disposed in ScriptDefinitionsManager
^EA-237136 Fixed
2020-09-07 09:36:26 +00:00
Vladimir Dolzhenko
4e3b1f141e Use runReadActionInSmartMode instead of runReadAction in ConfigureKotlinInProjectUtils
runReadActionInSmartMode has no effect if it is already run under runReadAction - therefore it could lead to IndexNotReadyException

^EA-220414 Fixed
^EA-210940 Fixed
^KT-30929 Fixed
2020-09-07 09:36:26 +00:00
Vladimir Dolzhenko
02be470e91 Check if vFile is still valid in ScriptClassRootsUpdater#updateHighlighting
^EA-218774 Fixed
2020-09-07 09:36:25 +00:00
Vladimir Dolzhenko
ba027a785c Fix NPE in GradleScriptInfo
^EA-237746 Fixed
2020-09-07 09:36:24 +00:00
Vladimir Dolzhenko
698f51079f Perform paste reference resolve in smart mode
^EA-226712 Fixed
2020-09-07 09:36:24 +00:00
Dmitry Petrov
b00ce872ea JVM: record JVM signature for equals/hashCode/toString in inline classes 2020-09-07 12:25:50 +03:00
Lilia
38975e4e7c Add changelog for 1.4.10 2020-09-06 19:10:42 +07:00
cketti
7755d9fe24 Mark used parameters as disabled in parameter info popup
When using named arguments the IDE might be unable to map the current
argument to a parameter. In that case mark already used parameters as
disabled. That way developers can easily see which parameters have not
been used yet.

^KTIJ-128 Fixed
2020-09-05 23:17:46 +02:00
Yaroslav Chernyshev
81339d54eb Added :core:compiler.common.jvm and :compiler:resolution.common.jvm
dependencies to pill importer
2020-09-05 10:56:55 +03:00
Toshiaki Kameyama
3f7aab6fae Redundant 'asSequence' call: don't report when reciever type is Map
#KT-41338 Fixed
2020-09-04 22:10:34 +02:00
cketti
78493395c3 Don't mark signature as inapplicable when argument is empty/incomplete
This will improve the usability when using named arguments where
incomplete arguments can't be mapped to a parameter simply by position.

^KT-24172 Fixed
2020-09-04 13:11:24 +02:00
Toshiaki Kameyama
343010a833 "Unused equals expression" inspection: highlight whole expression with yellow background
^KT-41615 Fixed
2020-09-04 12:55:55 +02:00
Dmitriy Novozhilov
b81ec2c8f0 Fix compilation errors in bunches 2020-09-04 11:42:51 +03:00
Dmitriy Novozhilov
a8c68d9e6f Remove dependency on :compiler:frontend.java from :compiler:fir:jvm 2020-09-04 11:42:51 +03:00
Dmitriy Novozhilov
6906e0d82d Move common jvm classes from :core:descriptors.jvm to :core:compiler.common.jvm 2020-09-04 11:42:51 +03:00
Dmitriy Novozhilov
9806a85cc1 Move Java model classes to :core:compiler.common.jvm 2020-09-04 11:42:51 +03:00
Dmitriy Novozhilov
b81c0e91d5 Replace DescriptorVisibility with Visibility in Java model classes 2020-09-04 11:42:51 +03:00
Dmitriy Novozhilov
696f089b3e Make DescriptorVisibility delegate to Visibility 2020-09-04 11:42:50 +03:00
Dmitriy Novozhilov
a05d6da43b Move descriptor-independent Visibilities to common modules 2020-09-04 11:42:50 +03:00
Dmitriy Novozhilov
d1fd1da56f Rename Visibility to DescriptorVisibility 2020-09-04 11:07:42 +03:00
Dmitriy Novozhilov
2bcd8ee07f Get rid of Visibility.effectiveVisibility member 2020-09-04 11:07:42 +03:00
Dmitriy Novozhilov
7d9b7df3b4 Cleanup code in EffectiveVisibility.kt and extract descriptors related part to separate file 2020-09-04 11:07:42 +03:00
Dmitriy Novozhilov
6346b1b2ab Use type markers instead of class descriptors in effective visibility 2020-09-04 11:07:42 +03:00
Dmitriy Novozhilov
64ec3fc42b Move BuiltinSpecialProperties and JvmAbi to :core:compiler.common.jvm 2020-09-04 11:07:41 +03:00
Dmitriy Novozhilov
10fd164b77 Extract FE 1.0 dependent part from JavaToKotlinClassMap
Also move JavaToKotlinClassMap to :core:compiler.common.jvm
2020-09-04 11:07:41 +03:00
Dmitriy Novozhilov
136435bcc2 Move JvmPrimitiveType to :core:compiler.common 2020-09-04 11:07:41 +03:00
Dmitriy Novozhilov
4d5f28d5c0 Move FunctionInvokeDescriptor.BIG_ARITY to :core:compiler.common 2020-09-04 11:07:41 +03:00
Dmitriy Novozhilov
bf4bf30b4a Move CompanionObjectMapping to :core:compiler.common 2020-09-04 11:07:40 +03:00
Dmitriy Novozhilov
0e04af463d Move JvmTypeSpecificityComparator to :compiler:resolution.common.jvm 2020-09-04 11:07:40 +03:00
Dmitriy Novozhilov
564d382b9d Introduce new modules for common jvm related parts of compiler 2020-09-04 11:07:40 +03:00
Dmitry Petrov
dd016b759e JVM_IR: write raw types as raw in JVM generic signatures 2020-09-04 10:21:49 +03:00
Dmitry Petrov
475522f938 Represent raw types in IR using a special type annotation 2020-09-04 10:21:48 +03:00
Dmitry Petrov
714ab7c37f Handle java raw types in IR
Raw type Q is represented as a flexible type
  Q<B1, ... Bn> .. Q<*, ... *>
where Bi is a representative upper bound of the corresponding ith type
parameter of Q.
When mapping generic signature, JVM takes type arguments of lower bound
(which is 'Q<B1, ..., Bn>').

There is still some difference in how JVM and JVM_IR handle raw type in
signature. It requires additional investigation.
2020-09-04 10:21:48 +03:00
Toshiaki Kameyama
8420c0b7c7 Add "Redundant nullable return type" inspection
^KT-19321 Fixed
2020-09-04 09:07:22 +02:00
Toshiaki Kameyama
d703284d01 Naming convention inspection: don't report for factory functions
#KT-20438 Fixed
2020-09-03 22:25:06 +02:00
Vladimir Dolzhenko
4f4db68a61 I18N fixes after merging convert initialized val to non-null type inspection
Relates to ^KT-35757
2020-09-03 22:01:11 +02:00
Vladimir Dolzhenko
eb3bde1538 Amend test data after adding Convert assignment to assignment expression intention
Relates to #KT-22420
2020-09-03 21:38:46 +02:00
Dmitriy Dolovov
8a7f33f044 [Commonizer] Fix internal error when TAs have different expanded classes
^KT-41643
2020-09-04 01:19:41 +07:00
Vladimir Dolzhenko
d4ef85f6c2 Amend test data after adding Convert assignment to assignment expression intention
Relates to #KT-22420
2020-09-03 18:04:55 +02:00
Mark Punzalan
16ab11289c [JS_IR] Enable RangeContainsLowering optimizations. 2020-09-03 18:42:35 +03:00
Ilya Goncharov
88755a8d20 [Gradle, JS] Use npm project dir as executable
^KT-40812 fixed
2020-09-03 18:31:56 +03:00
Toshiaki Kameyama
6db0785615 Wrap with let: apply to unsafe qualified expression
#KT-18125 Fixed
2020-09-03 17:04:06 +02:00
kvirolainen
18fbf5729d Inspection: convert initialized val to non-null type
^KT-35757 Fixed
2020-09-03 16:30:28 +02:00
Pavel Kirpichenkov
8b28e54584 [FIR-IDE] Update tests 2020-09-03 16:44:57 +03:00
Pavel Kirpichenkov
177fcefa68 [FIR-IDE] Minor: refactor completion contributor 2020-09-03 16:44:41 +03:00
Enteerman
c3aeaa9052 Inspection: Simplify Nested forEach/onEach in also/apply to onEach
^KT-40283 Fixed
2020-09-03 15:29:32 +02:00
Victor Petukhov
85d99612a2 Don't create inconsistent types (with contradictive use site and declaration site variances) for star projections with corresponding contravariant type parameters during substitution
^KT-41388 Fixed
2020-09-03 16:24:28 +03:00
Dereck Bridie
94970e2d1e Intention to replace a = b with b.also { a = it }
^KT-22420 Fixed
2020-09-03 15:11:36 +02:00
Vladimir Dolzhenko
e387d56d93 Drop redundant synchronized from LibraryEffectiveKindProviderImpl
effectiveKindMap is SoftFactoryMap that wraps CHM

^KT-41634 Fixed
2020-09-03 12:25:38 +00:00
Enterman
d09b20f11d Inspection to replace !string.isBlank() with string.isNotBlank()
#KT-40769 Fixed
2020-09-03 14:20:35 +02:00
vldf
f9a2d01d57 [FIR] Add UselessCallOnNotNullChecker 2020-09-03 14:28:57 +03:00
Mikhail Glukhikh
548adc29d0 [FIR] Enter loops in resolve using independent context 2020-09-03 14:24:31 +03:00
Mikhail Glukhikh
a7da0d5080 [FIR] Approximate exotic return types for public declarations 2020-09-03 14:24:31 +03:00
Jinseong Jeon
bf918e6184 FIR: hide local types if needed 2020-09-03 14:24:31 +03:00
Mikhail Glukhikh
9e38e6d051 [FIR2IR] Intercept exceptions in convertToIrCall to provide more info 2020-09-03 14:24:31 +03:00
Mikhail Glukhikh
23e83e8933 FirClassSubstitutionScope: don't recreate type parameters for unbound f/o 2020-09-03 14:24:30 +03:00
Jinseong Jeon
e8157a5488 FIR: introduce & use various comparators to sort members while de/serialization
#KT-41018 fixed
2020-09-03 13:55:52 +03:00
cketti
91c021c699 Add support for mixed named arguments to parameter info popup
Don't display parameter info in square brackets if the caller doesn't
have to use a named argument. This makes the parameter info popup
reflect the new capability introduced with
MixedNamedArgumentsInTheirOwnPosition.

^KT-41645 Fixed
2020-09-03 12:30:27 +02:00
n-p-s
af6e744b65 Allow generate toString(), equals(), and hashCode() to include non-default accessors
^KT-15262 Fixed
2020-09-03 12:12:33 +02:00
KotlinIsland
3bf18343f5 Build: Upgrade gradle to 6.6.1
[We recommend that you use Gradle 6.6.1 over the initial release of Gradle 6.6](https://github.com/gradle/gradle/releases/tag/v6.6.1)
2020-09-03 10:50:22 +02:00
Roman Artemev
685b74769d [JVM IR] Fix lineNumber passing into CoroutineTransformer.
- Get it from `IrFile` & `IrElement.startOffset` instead of descriptor
 - Unmute stepping tests
2020-09-03 11:37:24 +03:00
Alexander Udalov
5aca8ebda8 Minor, add test case on metadata of lambdas in constructors
KT-41465
2020-09-02 20:04:05 +02:00
pyos
6b65a2ea7d JVM_IR: move classes out of lambdas inlined into initializers
Fixes KT-41465
2020-09-02 20:03:38 +02:00
Florian Kistner
9775a2148a 203: Fix compilation 2020-09-02 18:48:57 +02:00
Pavel Kirpichenkov
9d12df28c1 [FIR-IDE] Add idea-fir test runtime dep for fir plugin only
Leads to duplicated bundled resources annotation templates otherwise.
2020-09-02 19:15:07 +03:00
Pavel Kirpichenkov
26982d1b48 [FIR-IDE] Use delegating KtScope for type param scope 2020-09-02 19:15:06 +03:00
Pavel Kirpichenkov
0d3f1af6e4 Fix imports after rebase 2020-09-02 19:15:06 +03:00
Pavel Kirpichenkov
5ddf62b30f [FIR-IDE] Use thread-local cache in completion component 2020-09-02 19:15:06 +03:00
Pavel Kirpichenkov
f229ae413d [FIR-IDE] Ignore FirMemberTypeParameterScope in KtScopes 2020-09-02 19:15:06 +03:00
Pavel Kirpichenkov
dc538d420e [FIR-IDE] Changes after review
Move usage of SingleCandidateResolver into dedicated component from KtFirAnalysisSession.
Add validity assertion, use concurrent map for context cache, provide original PSI when building context.
Update names, make other minor changes.
2020-09-02 19:15:06 +03:00
Pavel Kirpichenkov
ec072798b1 [FIR-IDE] Hack for checking single candidate resolver in tests 2020-09-02 19:15:06 +03:00
Pavel Kirpichenkov
2c816d8911 [FIR-IDE] Introduce resolver for a single candidate
The purpose of this resolver is to reuse parts of tower resolver in IDE tasks.
For now it can run resolution stages to check suitability of extension receiver.
2020-09-02 19:15:06 +03:00
Roman Artemev
c6a338bcdc Mute broken stepping JVM IR tests
They are broken because of c7b57c0fb3.
Current debug info generator in IR uses information from descriptors so
removing that break tests.
2020-09-02 17:52:27 +03:00
Alexander Udalov
b8d16f3d46 Add EnclosingMethod information to bytecode listing tests 2020-09-02 16:46:05 +02:00
Alexander Udalov
d4ecde5cb0 Minor, don't use token COROUTINES_PACKAGE in bytecode listing tests
Most of the tests that are run both for 1.2 and 1.3 coroutines have
different expectation .txt files anyway.
2020-09-02 16:46:05 +02:00
Alexander Udalov
24aee1cce3 JVM IR: unmute tests on anonymous objects in inline lambdas
All tests on anonymous objects should use the NO_CHECK_LAMBDA_INLINING
directive, since the test framework can't tell an anonymous object from
a lambda and checking that anonymous objects are "inlined" makes no
sense.
2020-09-02 16:46:04 +02:00
Alexander Udalov
e7937db8fa Add link to the online docs to kotlinc's help
#KT-35111 Fixed
2020-09-02 16:45:56 +02:00
Alexander Udalov
6b05e1d179 Add warning to 'kotlinc.bat help' that delimiters need to be escaped
Related to KT-41303, KT-41309.
2020-09-02 16:45:40 +02:00
Roman Artemev
2612609664 [JS] Add test for KT-39378 2020-09-02 14:42:17 +03:00
Roman Golyshev
3d5ec8aa10 FIR Completion: Add simple classifiers completion
- This also fixes a few test
2020-09-02 14:32:53 +03:00
Roman Golyshev
64645c5049 FIR Completion: Refactor KotlinAvailableScopesCompletionProvider
- Move different types of completion to separate functions
2020-09-02 14:32:53 +03:00
Roman Golyshev
0375a19e78 FIR Completion: Refactor KotlinAvailableScopesCompletionProvider 2020-09-02 14:32:53 +03:00
Roman Golyshev
1ab246f71e FIR Completion: Drop originalPosition parameter from getScopeContextForPosition
- It is easier to retrieve the original enclosing function by the fake
enclosing function than trying to correct the `originalPosition` in
different situations
2020-09-02 14:32:52 +03:00
Roman Golyshev
ab5059e08e FIR Completion: Rename FIR completion classes to be more uniform 2020-09-02 14:32:52 +03:00
Leonid Startsev
c881347110 Use correct return type for constructor call when creating EnumDescriptor
Previous one was converted using obsolete API, which caused unbound symbols to appear.

#KT-41321 Fixed
2020-09-02 13:22:23 +03:00
Leonid Startsev
8b0bb430e7 Fix multiple serialization plugin problems
Do not use fallback serializer if it is the same (fixes
https://github.com/Kotlin/kotlinx.serialization/issues/957).

Use correct number of serializable KClasses when creating sealed class
serializer (fixes https://github.com/Kotlin/kotlinx.serialization/issues/925).
2020-09-02 13:22:23 +03:00
Ilya Kirillov
106d8e74d4 FIR IDE: unmute passing completion tests 2020-09-02 11:16:20 +03:00
Ilya Kirillov
775dc7b135 FIR IDE: add type parameters support to completion 2020-09-02 11:16:20 +03:00
Ilya Kirillov
6d18bb6ba2 FIR IDE: add type parameters support to scopes 2020-09-02 11:16:19 +03:00
Ilya Kirillov
c0e9f05921 FIR: make FirTypeParameterScope to be name aware 2020-09-02 11:16:18 +03:00
Ilya Kirillov
7a1b1efef3 FIR IDE: register missing Java specific components for libraries session 2020-09-02 11:16:18 +03:00
Ilya Kirillov
162a2ac7b0 FIR IDE: fix lazy resolve for non local declaration without containing class 2020-09-02 11:16:17 +03:00
Ilya Kirillov
87898021a1 FIR IDE: introduce multi module lazy resolve tests 2020-09-02 11:16:17 +03:00
Ilya Kirillov
8714ad575f FIR IDE: move FIR IDE completion tests to idea-fir module 2020-09-02 11:16:16 +03:00
Ilya Kirillov
7cb3f62f51 FIR IDE: remove IGNORE_FIR from passing resolve tests 2020-09-02 11:16:16 +03:00
Ilya Kirillov
31f2c4a857 FIR: add fake source element to implicit function return statement 2020-09-02 11:16:16 +03:00
Ilya Kirillov
1ccf8bfb67 FIR IDE: fix completion in function with expression body 2020-09-02 11:16:15 +03:00
Mikhail Glukhikh
7c0467944d FullPipelineModularizedTest: fix compilation 2020-09-01 21:58:26 +03:00
Mikhail Glukhikh
0324c0d02f FullPipelineModularizedTest: code cleanup 2020-09-01 21:51:49 +03:00
Ilya Goncharov
9f27bc62c0 [Gradle, JS] Args should concat after input file
^KT-41286 fixed
2020-09-01 19:15:13 +03:00
Roman Artemev
fdbc657656 [IR] Fix isFileClass checker 2020-09-01 18:53:17 +03:00
Ivan Gavrilovic
91b99da7a0 KT-41313: Only load .jar files when locating annotation processors
Previously, we'd only check if file exists and try to load it. However,
some compile classpaths may contain .tar.gz files.

Test: ProcessorLoaderTest
2020-09-02 00:48:25 +09:00
Ilya Goncharov
b9bc11d5e0 [Gradle, JS] Consider custom launcher's base
^KT-41475 fixed
2020-09-01 17:47:25 +03:00
Denis Zharkov
02b72e16ef FIR: Temporary weaken required phase in ensureResolvedForCalls
Currently, lazy resolution in IDE immediately starts common body resolution
after STATUS (that lead to loops during recursive resolve)
2020-09-01 17:43:30 +03:00
Denis Zharkov
b0a7960b42 FIR: Call ensureResolved(TYPES) when computing supertypes of a class 2020-09-01 17:43:30 +03:00
Denis Zharkov
8427cc373f FIR: Fix coroutines related IDE exception from TowerResolveManager
Do not try to steal tasks in suspendResolverTask
Otherwise, it might lead to resuming current coroutine through
"resume" methods that is kind of illegal when using suspendCoroutineUninterceptedOrReturn
2020-09-01 17:43:30 +03:00
Denis Zharkov
d532529c30 FIR: Add workaround for recursive contracts in ensureResolvedForCalls 2020-09-01 17:43:30 +03:00
Denis Zharkov
0a1440d80c FIR: Optimize ensureResolvedForCalls for common case 2020-09-01 17:43:30 +03:00
Denis Zharkov
1c0e3b30a2 FIR: Use return type calculator in FirTypeMismatchOnOverrideChecker 2020-09-01 17:43:30 +03:00
Denis Zharkov
992a2d556a FIR: Add ensureResolved calls for types of sub-expressions
These calls resolve a class that a type of expression is built upon
2020-09-01 17:43:30 +03:00
Denis Zharkov
d05e947d25 FIR: Ensure resolved callable symbols came out of the declared scopes
Otherwise, we need to add `ensureResolved` to almost any usage of process*:
- Call resolution need fully resolved callables
- UseSiteScope when binding overrides should ensure resolved for callables from supertypes
- checkers have to make sure they use correct overridden
- SAM resolver
2020-09-01 17:43:30 +03:00
Denis Zharkov
d80caf7dbf FIR: Extract common code in FirPackageMemberScope 2020-09-01 17:43:30 +03:00
Denis Zharkov
b4aef21423 FIR: Simplify API for ensureResolved
Additional `as` casts look redundant, but it's a design issue (see KT-41421)
2020-09-01 17:43:30 +03:00
Denis Zharkov
bb84dc2ed4 FIR: Minor. Extract common parts in FirClassDeclaredMemberScope 2020-09-01 17:43:30 +03:00
Denis Zharkov
1cc68762e1 FIR: Minor. Fix error message 2020-09-01 17:43:30 +03:00
Denis Zharkov
4cdc36abb3 FIR: Drop unused 'phasedFir' callables 2020-09-01 17:43:30 +03:00
Denis Zharkov
c3c8115163 FIR: Use explicit version of 'ensureResolved' 2020-09-01 17:43:30 +03:00
Denis Zharkov
517056e0c6 FIR: Do not require specific phase for super-call receiver class
It's anyway defined in the outer context (outer class) that already
should have proper context
2020-09-01 17:43:30 +03:00
Denis Zharkov
fcc2abcf40 FIR: Fix phase requirement for call resolution 2020-09-01 17:43:30 +03:00
Denis Zharkov
ff182f191e FIR: Fix some contracts resolutions side-effects
- Resolve anonymous objects' contents
- Update phase for constructors
- Do not transform annotations
(while resolving they may refer to other declarations that don't have yet CONTRACTS phase)
2020-09-01 17:43:30 +03:00
Denis Zharkov
67cc85e02b FIR: Avoid redundant calls to ensureResolved during call resolution
Call ensureResolved only once when creating a candidate
2020-09-01 17:43:30 +03:00
Denis Zharkov
bf2fc10cd6 FIR: Extract AbstractFirBasedSymbol::ensureResolved extension 2020-09-01 17:43:30 +03:00
Denis Zharkov
2529f541ba FIR: Prepare refactoring of phasedFir
- Rename PhasedFirFileResolver -> FirPhaseManager
- Move semantically significant parts to a component
2020-09-01 17:43:30 +03:00
Ilya Goncharov
7fe02238ea [Gradle, JS] Add more information on Gradle exception
^KT-41566 fixed
2020-09-01 17:26:02 +03:00
Ilya Goncharov
076045ce54 [Gradle, JS] Add test with library mixed with executable and browser/nodejs
^KT-41566 fixed
2020-09-01 17:26:02 +03:00
Ilya Goncharov
d238483054 [Gradle, JS] Add test with library mixed with executable
^KT-41566 fixed
2020-09-01 17:26:02 +03:00
Ilya Goncharov
4a1bccc1e6 [Gradle, JS] Add test on simple js binary library
^KT-41566 fixed
2020-09-01 17:26:01 +03:00
Ilya Goncharov
9f04d353a0 [Gradle, JS] Fix test for IR browser distribution
^KT-41566 fixed
2020-09-01 17:26:01 +03:00
Ilya Goncharov
134aa6182e [Gradle, JS] Process resources into kotlin folder
^KT-41566 fixed
2020-09-01 17:26:01 +03:00
Ilya Goncharov
06a54c87a0 [Gradle, JS] Compile sync tasks
^KT-41566 fixed
2020-09-01 17:26:01 +03:00
Ilya Goncharov
9729554313 [Gradle, JS] Node run task for all binaries
^KT-41566 fixed
2020-09-01 17:26:01 +03:00
Ilya Goncharov
7dbde459f0 [Gradle, JS] Run task for library
^KT-41566 fixed
2020-09-01 17:26:01 +03:00
Ilya Goncharov
b4baaed87a [Gradle, JS] Different distributions for different binaries
^KT-41566 fixed
2020-09-01 17:26:01 +03:00
Ilya Goncharov
8c74a844f2 [Gradle, JS]] Add custom fields for package.json
^KT-35330 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
2d8b95190e [Gradle, JS] Outputs for distribution tasks as lazy
^KT-41566 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
fe72d46fee [Gradle, JS] Add types into public package json
^KT-40753 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
39059c103a [Gradle, JS] Distribution directory as a lazy
^KT-41566 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
82ea324cc1 [Gradle, JS] DefaultDistribution
^KT-41566 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
53a23169d9 [Gradle, JS] Node js binaries executable filtering
^KT-41566 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
73dbf6b846 [Gradle, JS] Add configureLibrary
^KT-41566 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
1318517155 [Gradle, JS] Add configureLibrary
^KT-41566 fixed
2020-09-01 17:26:00 +03:00
Ilya Goncharov
c9ca05b477 [Gradle, JS] Add distribute resources tasks for all binaries
^KT-41566 fixed
2020-09-01 17:25:59 +03:00
Ilya Goncharov
cc25660d7d [Gradle, JS] Move distributions tasks into abstract subtarget class
^KT-41566 fixed
2020-09-01 17:25:59 +03:00
Roman Artemev
cae29a5d1c [IR] Clean up WrappedDescriptors API 2020-09-01 17:08:11 +03:00
Roman Artemev
c7b57c0fb3 [IR] Use only empty constructor to create WrappedDescriptor 2020-09-01 17:08:11 +03:00
Roman Artemev
fd88914cf9 [IR] Remove some descriptor usage from Common/JS/JVM backends
- replace descriptor-based builders with pure IR ones
 - fix matchers
 - fix Ir2Js
 - rewrite some inliner-helpers to pure-IR implementations
2020-09-01 17:08:11 +03:00
Dmitry Petrov
8cb8284957 EnhancedNullability annotation in IR
Fixes KT-40115 & KT-40117.

Move FlexibleNullability annotation to 'kotlin.internal.ir'.
2020-09-01 16:06:03 +03:00
Roman Artemev
0bff406a12 [JS IR] Add infra to test compilation with error
- add bunch of tests
 - fix help test
2020-09-01 14:53:08 +03:00
Roman Artemev
e592b3af1d [JS IR] Fix CallsLowering's*
- need to fix dev mode since some methods are not handled
 with intrinsic lowering
2020-09-01 14:53:08 +03:00
Roman Artemev
7a6415dc53 [JS IR] Enable IrError element's lowerings in JS 2020-09-01 14:53:08 +03:00
Roman Artemev
4dca3715fa [JS IR | IR] Implement error element lowering to support compilation with errors 2020-09-01 14:53:08 +03:00
Roman Artemev
14b5424583 [JS IR] Support translation of IrError* elements 2020-09-01 14:53:08 +03:00
Roman Artemev
1fd5c1cc65 [IR] Support IrErrorType & IrErrorDeclaration in ir mangler 2020-09-01 14:53:08 +03:00
Roman Artemev
9c36487077 [IR] Disable mangle checker for IrErrorDeclarations 2020-09-01 14:53:07 +03:00
Roman Artemev
563af709a8 [Psi2Ir] Fix generation of IrError* nodes
- Provide detailed description
 - Support syntax-incorrect statements
 - Generate an error declaration if normal generation has failed
2020-09-01 14:53:07 +03:00
Roman Artemev
a60782f3df [JS IR] Add CLI argument to setup error tolerance policy
-  Make sure dev mode is enabled if code with errors is allowed
2020-09-01 14:53:07 +03:00
Roman Artemev
8a810e2a5e [JS IR] Add runtime API to throw ISE in case of compiled code with errors 2020-09-01 14:53:07 +03:00
Roman Golyshev
b3199d14b8 FIR IDE: Use correct property-by-package index in KtFirPackageScope 2020-09-01 14:50:19 +03:00
Roman Golyshev
5180a65f0b FIR Completion: Use proper types rendering 2020-09-01 14:28:59 +03:00
Roman Golyshev
7649043479 FIR IDE: Set correct source for the function built in the air
- This enables the completion to work in the declaration itself, not
only in body
2020-09-01 10:09:46 +00:00
Roman Golyshev
90c89bddc5 FIR IDE: Add collecting scopes for declarations
- They are required to perform completion in default arguments,
return types, and other declaration parts (except for body)
2020-09-01 10:09:46 +00:00
Roman Golyshev
76eb5d46f4 FIR IDE: Add FirTowerDataContextCollector class
- This class just encapsulates the map that is used to collect scopes
2020-09-01 10:09:45 +00:00
Mikhail Zarechenskiy
9c217e3d99 Reuse revised variables during lambda analysis against type variables
#KT-41400 Fixed
2020-09-01 13:04:53 +03:00
Dmitriy Novozhilov
011bb0924a [FIR-IDE] Introduce FirIdeSessionFactory for creating ide sessions 2020-09-01 12:00:13 +03:00
Dmitriy Novozhilov
cb47e631f8 [FIR] Move extended checkers containers to :compiler:fir:entrypoint 2020-09-01 12:00:13 +03:00
Dmitriy Novozhilov
f14efedc3d [FIR] Fix broken gradle compilation 2020-09-01 12:00:13 +03:00
Dmitriy Novozhilov
c250912ee0 [FIR-TEST] Use FirAnalyzerFacade in BB and Fir2IrText tests 2020-09-01 12:00:13 +03:00
Dmitriy Novozhilov
a4e24ca3dc [FIR] Introduce FirAnalyzerFacade which hides implementation details of running FIR compiler 2020-09-01 12:00:13 +03:00
Dmitriy Novozhilov
6db8c28291 [FIR] Refactor session components initialization
From now all customization of session should perform via DSL which
  declared in FirSessionFactory. Registration or mutation session
  services from other places is prohibited
2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
2819bd3aaf [FIR] Get rid of deprecated extension point registration methods usage 2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
cf224b4de9 [FIR] Add createEmptySession to FirSessionFactory for testing purposes 2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
a8d23c36f5 [FIR] Introduce module :fir:entrypoint and FirSessionFactory for creating sessions 2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
94d58c714a [FIR] Cleanup dependencies for fir modules 2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
73e2314f2f [FIR] Get rid of dependency on intellijCore from :compiler:fir:resolve 2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
18ad56f7a8 [FIR] Fix creating fake source elements in declarations resolve 2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
28e6050551 [FIR] Extract java synthetic names calculation to platform specific component 2020-09-01 12:00:12 +03:00
Dmitriy Novozhilov
375140ebcc [FIR] Extract java class mapping to platform specific component 2020-09-01 12:00:11 +03:00
Dmitriy Novozhilov
a0b931792e Move annotationsForResolve.kt to :core:compiler.common 2020-09-01 12:00:11 +03:00
Dmitriy Novozhilov
07c353973d Move requireOrDescribe to :core:compiler.common 2020-09-01 12:00:11 +03:00
Dmitriy Novozhilov
f010dc533c Move Variance.convertVariance to :core:compiler.common 2020-09-01 12:00:11 +03:00
Dmitriy Novozhilov
e164c88a14 Move TypeSystemCommonBackendContext to :core:compiler.common 2020-09-01 12:00:11 +03:00
Dmitriy Novozhilov
3379d9b619 [FIR] Extract java related effective visibility calculation to platform component 2020-09-01 12:00:11 +03:00
Dmitriy Novozhilov
ed4c6a38b6 [FIR] Move deserialization files to module :compiler:fir:fir-deserialization 2020-09-01 12:00:10 +03:00
Dmitriy Novozhilov
ca031f7ace [FIR] Split ResolveUtils.kt from :resolve to separate files 2020-09-01 12:00:10 +03:00
Dmitriy Novozhilov
6ace4164ff [FIR] Split TypeUtils from :resolve to :cones and :tree modules 2020-09-01 12:00:10 +03:00
Dmitriy Novozhilov
92ffa4dea9 [FIR] Replace KotlinScopeProvider with FirScopeProvider in ClassDeserialization
This is needed to remove dependecy on :fir:resolve from serialization
  methods
2020-09-01 12:00:10 +03:00
Mikhail Glukhikh
3aa13362ca [FIR2IR] Replace NPE in setThisReceiver with more detailed exception 2020-09-01 11:40:32 +03:00
Mikhail Glukhikh
65739c50d3 FIR full pipeline test: output build status per-module 2020-09-01 11:40:32 +03:00
Pavel Kirpichenkov
2979c37001 [NI] Fix resolution status for UnstableSmartCastDiagnostic
RESOLVED_WITH_ERROR was initially added for reproducing OI behavior.
The intention was to preserve resolution into unstable smart cast and to keep failing candidate.
However, this idea was abandoned after OI behavior proved inconsistent in cases involving generics.

This commit restores RUNTIME_ERROR status of UnstableSmartCastDiagnostic.

^KT-41357 Fixed
2020-09-01 11:21:13 +03:00
Igor Chevdar
5e71068e61 [IR] Handled degenerate cases of IrStringConcatenation
It is not needed to create StringBuilder if the number of values
being concatenated is 0 or 1
2020-09-01 11:34:17 +05:00
Dmitriy Dolovov
74dce725cc [Commonizer] Tests for missed supertypes in commonized type aliases
^KT-41247
2020-09-01 13:11:33 +07:00
Dmitriy Dolovov
96736b0126 [Commonizer] Add missed supertypes in commonized type aliases
^KT-41247
2020-09-01 13:11:27 +07:00
Dmitriy Dolovov
e21d99334b [Commonizer] Lookup common descriptors that don't participate in commonization (for tests only)
This is necessary to run integration tests with fake declarations from
Kotlin/Native stdlib that are absent in stdlib-common.
2020-09-01 13:11:22 +07:00
Dmitriy Dolovov
ed78169051 [Commonizer] README: Describe the case when target is not available 2020-09-01 13:11:16 +07:00
Nikolay Krasko
56f0fb6c70 Prevent test failures because of Leaked Android SDK
Stop implicit adding additional SDK from environment variables in
GradleSpecificInitializer and AndroidSdkInitializer.
2020-08-31 21:18:26 +03:00
Steven Schäfer
78ab957bfe JVM IR: Fix mangling for suspend functions with inline class params (KT-41374) 2020-08-31 18:43:29 +02:00
Igor Yakovlev
48a3d4b8e0 [ULC] Add recursion guard to getLightClass
Fixed KT-41325
2020-08-31 18:01:37 +03:00
Pavel Kirpichenkov
873224dfbc [NI] Use new type substitutor for known type parameters
Use known type parameters substitutor after substitutor for fresh variables.
The old logic of substituions had the following order:
- replace known type parameters
- replace type parameters with type variables
- complete inference
- replace type variables with inferred types

According to the updated logic, replacement goes as follows:
- replace type parameters with type variables
- replace known type parameters; if they were variables, this will effectively remove them from inference
- complete inference
- replace remaining type variables with inferred types

Support projection substitution in new type substitutor.
It is needed for correct interaction with old type substitutor.
Old type substitutors can contain mappings constructor -> projection
which couldn't be expressed correctly with existing substitutor API in some cases.

^KT-41386 Fixed
2020-08-31 17:53:46 +03:00
Alexander Udalov
c706673de9 Minor, refactor bytecode text tests on when-over-string optimization
- Merge `duplicatingItemsSameHashCode.kt` and
  `duplicatingItemsSameHashCode2.kt` into one test enabled on both
  backends, and rename it to
  `duplicatingItemsSameHashCodeFewBranches.kt`.
- Rename `duplicatingItemsSameHashCode3.kt` to
  `duplicatingItemsSameHashCodeMoreBranches.kt`, and also enable it for
  both backends.
- Use JVM_TEMPLATES/JVM_IR_TEMPLATES to check backend-specific behavior:
    1) JVM IR does not optimize less than 2 branches by design
    2) JVM IR does not generate duplicate branches, also by design

Related to KT-36846.
2020-08-31 16:47:11 +02:00
Alexander Udalov
a639915a34 JVM IR: do not mangle property accessors of unsigned types in annotations
Before this change, we incorrectly mangled the names of annotation
methods (e.g. `getI-pVg5ArA` instead of `i`) because the isSpecial
condition was false.
2020-08-31 14:19:14 +02:00
Mikhail Glukhikh
1e360d9c91 [FIR2IR] Pass type context for type argument conversion properly 2020-08-31 14:31:58 +03:00
Jinseong Jeon
04af6846a7 FIR2IR: handle more vararg spreads for adapted callable references 2020-08-31 14:31:58 +03:00
Mikhail Glukhikh
5efabe063e [FIR] Fix JVM mapped function callable id 2020-08-31 14:31:57 +03:00
Mikhail Glukhikh
db815c96c5 [FIR] Substitute copied type parameters in fake override properties 2020-08-31 14:31:57 +03:00
Mikhail Glukhikh
dc9306367a FirClassSubstitutionScope: reorder companion functions 2020-08-31 14:31:57 +03:00
Mikhail Glukhikh
5ad453d927 [FIR] Substitute copied type parameters in fake override functions 2020-08-31 14:31:57 +03:00
Mikhail Glukhikh
458f89ef33 [FIR] Signature composer: return null signature for local declarations 2020-08-31 14:31:57 +03:00
Mikhail Glukhikh
02b6f34067 [FIR2IR] Add extension receiver parameter to delegated members 2020-08-31 14:31:57 +03:00
Mikhail Glukhikh
22c63c4e80 [FIR2IR] Add supertypes to delegated member type parameters 2020-08-31 14:31:56 +03:00
Mikhail Glukhikh
9ad55a0ee3 [FIR2IR] Don't create list under the hood in DelegatedMemberGenerator 2020-08-31 14:31:56 +03:00
Mikhail Glukhikh
5384ccf02f [FIR] Introduce & use FirDelegatedMemberScope 2020-08-31 14:31:56 +03:00
Mikhail Glukhikh
f0af930288 [FIR] Eliminate unused FirDelegatedTypeRef 2020-08-31 14:31:56 +03:00
Mikhail Glukhikh
ede910065a [FIR] Add problematic resolve test case with delegated super call 2020-08-31 14:31:56 +03:00
Mikhail Glukhikh
3f5beb77e8 [FIR2IR] Cache delegatable members properly 2020-08-31 14:31:55 +03:00
Alexander Udalov
1e712f8398 IR: remove IrElementVisitorVoidWithContext
It was only used as a superclass in IrInlineReferenceLocator and
LocalDeclarationsLowering. In both cases it's clearer and more optimal
to pass the necessary data via the visitor 'data' variable.
2020-08-31 12:47:54 +02:00
Alexander Udalov
5e48be3d11 Add a fallback flag -Xno-unified-null-checks for KT-22275
#KT-41482 Fixed
2020-08-31 12:43:28 +02:00
Ilya Kirillov
40669350f7 Wizard: navigate to wizard help page when clicking help button 2020-08-31 12:50:01 +03:00
Ilya Kirillov
fa847d758d Wizard: use compileKotlin for groovy instead of direct KotlinCompile task access
#KT-38921 fixed
2020-08-31 12:49:48 +03:00
Ilya Goncharov
e672f5f8e3 [Wizard, JS] Remove duplicating descriptions 2020-08-31 12:19:10 +03:00
Ilya Goncharov
554c67cd1d [Wizard, JS] Add descriptions to wizard options 2020-08-31 12:16:54 +03:00
Nicolay Mitropolsky
af35b6c3c8 Provide icons to Kotlin Light-elements (KT-26235) 2020-08-31 10:54:46 +03:00
Igor Chevdar
527de030fc [box-tests] Turned on some tests for K/N 2020-08-31 12:01:31 +05:00
Igor Chevdar
ab54e43b00 [IR] Commonized SAM equals/hashCode builder 2020-08-31 12:01:29 +05:00
Igor Chevdar
12ddd137bc [IR] Moved isLambda to common IR utils 2020-08-31 12:01:29 +05:00
vldf
b050ef9970 [FIR] Remove print in UnusedChecker 2020-08-30 14:18:01 +03:00
Ilya Gorbunov
9c3ff6828a Export kotlin.test packages with annotations and underlying frameworks
- Add exports for jvm package names used in kotlin.test annotations;

- Export transitively underlying test framework modules
Otherwise "This class does not have a constructor" happens when using
an aliased annotation, e.g. kotlin.test.Test aliased to org.junit.test

KT-41320
2020-08-29 03:33:38 +03:00
Andrey.Lozhkin
ef57c62576 [Gradle, Cocoapods] refactor I/O, improve Up-To-Date
all synthetic tasks are per pod
tasks receive parts of extension as inputs
2020-08-29 01:51:20 +03:00
Andrey.Lozhkin
1888462dc0 [Gradle, Cocoapods] move tasks from per target
podGen now per Family
podSetupBuild and podBuild now per sdk
2020-08-29 01:51:20 +03:00
Andrey Lozhkin
fcf5060907 [Gradle, Cocoapods] implement DSL to support Cocoapods Dependencies from Git or Web
Issue #KT-41367 Fixed
2020-08-29 01:51:20 +03:00
Steven Schäfer
b02f0f0a25 JVM IR: Fix compilation of nested inner classes 2020-08-28 20:03:19 +02:00
Steven Schäfer
02e78bcd76 JVM IR: Use package visibility for fields of captured variables 2020-08-28 20:03:19 +02:00
Roman Artemev
443269af0a [IR] Drop irProviders from stub generator 2020-08-28 18:14:05 +03:00
Roman Artemev
39808789c3 [KLIB] Fix SOE in K/N
- fixes KT-41324
2020-08-28 18:14:04 +03:00
Mikhail Zarechenskiy
23f87d413a Use initial system for completion if common one is effectively empty
Otherwise we can get unsubstituted type variables as expected types and
 then write wrong information for assertions

 #KT-41470 Fixed
2020-08-28 17:47:08 +03:00
Nick
bb18203ae6 [FIR] Various checkers performance fixes 2020-08-28 17:07:35 +03:00
Sergey Igushkin
5c88eb722d Fix transitive deps on MPP with host-specific source sets (KT-41083)
A consumer could not resolve the host-specific metadata artifact
of the transitive dependency because the transitive dependency's parent
in the platform dependencies graph did not include the dependency on it
in the variant that is chosen for host-specific source sets metadata:
the dependencies of that variant were empty.

Export the dependencies of the Kotlin/Native target in the host-specific
metadata variant as well.

Issue #KT-41083 Fixed
2020-08-28 11:09:56 +00:00
Zalim Bashorov
9097d0918c [JS BE] Support passing an array as argument of vararg in named form
#KT-38059 fixed
2020-08-28 13:14:23 +03:00
Zalim Bashorov
606232a584 [JS IR] Don't generate "import" statements for external interfaces
#KT-40964 fixed
2020-08-28 13:14:22 +03:00
Zalim Bashorov
ba846830c9 [JS IR] Support nativeGetter, nativeSetter and nativeInvoke
#KT-41081 fixed
2020-08-28 13:04:18 +03:00
Ilya Kirillov
c804319e65 FIR IDE: fix compilation on AS 2020-08-28 12:51:55 +03:00
Ilya Kirillov
36cc73602e FIR IDE: fix testdata of AbstractFirLazyResolveTest 2020-08-28 12:51:55 +03:00
Ilya Kirillov
3cd445563e FIR IDE: implement KotlinExpressionTypeProvider for FIR 2020-08-28 12:51:55 +03:00
Ilya Kirillov
fcc7db5224 FIR IDE: introduce analyseInModalWindow function 2020-08-28 12:51:23 +03:00
Ilya Kirillov
81be230541 FIR IDE: add validity assertion on analysis session access 2020-08-28 12:15:19 +03:00
Ilya Kirillov
db48884a4e FIR IDE: add check canceled check between diagnostics 2020-08-28 12:15:18 +03:00
Ilya Kirillov
95a96f32bf FIR IDE: log errors on diagnostics, not throw them 2020-08-28 12:15:17 +03:00
Ilya Kirillov
ebafd0fb51 FIR IDE: resolve ambiguity & inapplicable references 2020-08-28 12:15:16 +03:00
Ilya Kirillov
4fa2dd85b4 FIR IDE: move lazy resolve to FirLazyDeclarationResolver 2020-08-28 12:15:15 +03:00
Ilya Kirillov
8faaff00fa FIR IDE: run lazy resolve on declaration when getting phased fir 2020-08-28 12:15:14 +03:00
Ilya Kirillov
78bb1f1076 FIR IDE: fix testdata in idea-frontend-fir 2020-08-28 12:15:13 +03:00
Ilya Kirillov
30ac80a506 FIR IDE: introduce property accessor symbols 2020-08-28 12:15:13 +03:00
Ilya Kirillov
aae56cadac FIR IDE: add ModuleInfo for ide sessions as they are used for getting resolve components 2020-08-28 12:15:12 +03:00
Ilya Kirillov
bc3e98b116 FIR IDE: allow PCE between resolve phases, forbid in other cases 2020-08-28 12:15:11 +03:00
Ilya Kirillov
8363c711e6 FIR IDE: fix lazy resolve for local declarations 2020-08-28 12:15:10 +03:00
Ilya Kirillov
9d237033ad FIR IDE: minor, rename FirIdeModuleLibraryDependenciesSession to FirIdeLibrariesSession 2020-08-28 12:15:09 +03:00
Ilya Kirillov
8b782d5954 FIR IDE: fix session provider implementation as it only provides only 2 sessions 2020-08-28 12:15:07 +03:00
Ilya Kirillov
a07d3f2425 FIR IDE: minor: rename FirIdeJavaModuleBasedSession to FirIdeSourcesSession 2020-08-28 12:15:07 +03:00
Ilya Kirillov
f76b5bbf1b FIR IDE: allow KtFirPackageScope to work without providers 2020-08-28 12:15:06 +03:00
Ilya Kirillov
f4c17dadb3 FIR IDE: remove unused FirIdeModuleLibraryDependenciesSymbolProvider 2020-08-28 12:15:05 +03:00
Ilya Kirillov
a156cca02a FIR: make class FirObjectImportedCallableScope to be name aware 2020-08-28 12:15:04 +03:00
Ilya Kirillov
333213bbb9 Wizard: add descriptions for some settings 2020-08-28 11:46:55 +03:00
Ilya Kirillov
37b869ebc5 Wizard: add descriptions for settings 2020-08-28 11:46:55 +03:00
Dmitriy Novozhilov
09ed0c3e82 [FIR-TEST] Update testdata 2020-08-28 10:59:54 +03:00
Dmitriy Novozhilov
e7b5a88cbd [FIR] Remove dependency on :compiler:frontend from :compiler:fir:resolve 2020-08-28 10:59:54 +03:00
Dmitriy Novozhilov
abeb42ca20 [FIR] Don't use ProjectExtensionDescriptor in FirExtensionRegistrar 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov
f09e17a5ae [FIR] Remove unused import 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov
e405a02e8e [FIR] Fix contract serialization 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov
eaf8af919d [FIR] Use PersistentList instead of guava's ImmutableList in SupertypeResolution 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov
148e8fe76e Move FlatSignature to :compiler:resolution.common 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov
64766e125c Move common inference classes to :compiler:resolution.common 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov
068d21635e [NI] Get rid of KotlinType usages in MutableConstraintStorage.kt 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
af0df35623 [NI] Get rid of FE 1.0 types in ConstraintInjector 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
ad039a28bd [NI] Get rid of left FE 1.0 types in NewConstraintSystemImpl 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
6914aba5c2 [NI] Commonize detection of @OnlyInputTypes in NewConstraintSystemImpl 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
64f0ee21c1 Get rid of FE 1.0 classes usage in ConstraintIncorporator 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
1050f7f066 Extract PostponedResolvedAtomMarker to separate file 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
1cadabb099 Extract ResolutionCandidateApplicability to separate file 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
775df6dfc3 [NI] Get rid of FE 1.0 type usages in ResultTypeResolver 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov
aae1681b76 [NI] Get rid of ResolvedAtom usage in ConstraintSystemCompletionContext 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov
11e8552861 [NI] Get rid of PostponedArgumentInputTypesResolver.Context 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov
970a2581a1 [NI] Extract PostponedArgumentsAnalyzerContext from PostponedArgumentsAnalyzer 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov
b15f847943 [NI] Extract common parts from KotlinConstraintSystemCompleter 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov
12fbb93871 [NI] Extract FE 1.0 specific part from NewCommonSuperTypeCalculator 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov
b21a0213df [NI] Get rid of FE 1.0 types in AbstractTypeApproximator 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov
527c5a771d [NI] Get rid of FE 1.0 types in AbstractTypeCheckerContextForConstraintSystem 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov
686c17a234 [NI] Rename NewConstraintSystem.diagnostics to errors 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov
59b2cb6393 [NI] Split KotlinCallDiagnostics and inference errors to different hierarchies 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov
fae21d4db3 Introduce frontend independent constraint positions 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov
e5e3d7cab1 Extract FE 1.0 related parts from NewConstraintSystem 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov
be1033a4a7 [FIR] Implement ConeTypeContext.createTypeWithAlternativeForIntersectionResult 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov
f247cc3165 [NI] Properly detecting suitability of candidate for builder inference
#KT-41430 Fixed
2020-08-28 10:34:18 +03:00
Sergey Bogolepov
b2d9e5be91 [kotlinx-metadata-klib] Drop dependency on descriptors
It's unneeded since all used declarations moved to
:core:compiler.common.
2020-08-28 12:33:46 +07:00
Simon Ogorodnik
7170a23f63 [FIR] Use coroutine intrinsics in tower resolver manager
To remove SafeContinuation overhead
2020-08-28 00:12:17 +03:00
Simon Ogorodnik
7cb5c0a6d8 [FIR] Cleanup hides members condition 2020-08-28 00:12:17 +03:00
Simon Ogorodnik
bf2e17b133 [FIR] Extract invoke processing from TowerLevelHandler 2020-08-28 00:12:17 +03:00
Simon Ogorodnik
96f100381a Use proper manifest for kotlin-reflect in jps build 2020-08-28 00:12:17 +03:00
Simon Ogorodnik
34f5cfbf96 [FIR] Fix integer approximation on safe calls 2020-08-28 00:12:17 +03:00
Simon Ogorodnik
2a4e1a0b99 [FIR] Clarify testData for invokes 2020-08-28 00:12:16 +03:00
Alexander Udalov
74c6d2b951 Do not generate non-standard compareTo as primitive comparison in all backends
Previous changes related to this in the old JVM backend were in
582b1c5e66 and
0482f7e9c5, but they did not affect the
`ProperIeee754Comparisons` mode which became the default in 1.4.0. As a
result, we had a regression here.

Since the `PRIMITIVE_NUMERIC_COMPARISON_INFO` slice is used in psi2ir to
determine how to generate the comparison, this fixes the regression both
in the old JVM backend, and in all IR backends.

 #KT-41426 Fixed
2020-08-27 19:00:11 +02:00
Alexander Udalov
9d81e50128 IR: undeprecate IrUninitializedType
It's no longer a temporary hack, see the comment.
2020-08-27 18:02:04 +02:00
Dmitry Savvinov
5649cbc2e1 Wire KotlinTypeRefiner in areCallableDescriptorsEquivalent
See the issue for details

^KT-41218 Fixed
2020-08-27 18:50:42 +03:00
Dmitry Savvinov
421efaa565 Add test for overload resoultion ambiguity in HMPP
The behaviour is undesired, see the next commit for fix

^KT-41218 In Progress
2020-08-27 18:50:42 +03:00
Dmitry Savvinov
68d931969d Minor: explicitly opt-in for diagnostics messages in MultiplatformAnalysisTests 2020-08-27 18:50:42 +03:00
Dmitriy Novozhilov
9cde42e2bc [NI] Fix shouldRunCompletion for builder inference session
#KT-41308 Fixed
#KT-41363
2020-08-27 16:51:12 +03:00
Dmitriy Novozhilov
e98cbf81cf [NI] Don't always complete builder inference lambda in FULL mode
#KT-41164 Fixed
2020-08-27 16:51:11 +03:00
vldf
6a15e0410f [FIR] Fix CLI tests to prevent non-relevant errors from appearing 2020-08-27 16:07:04 +03:00
vldf
6c2ece9a6e Rename: FirSourceElement.getChildren() -> getChild() + minor fixes 2020-08-27 16:07:04 +03:00
vldf
bf363e8f1a [FIR] Update/add extended checker tests 2020-08-27 16:07:04 +03:00
Oleg Ivanov
acbb67f851 [FIR] Fix collectDataForNode backward traverse 2020-08-27 16:07:03 +03:00
vldf
f9c7cce11d [FIR] Add some helper functions for checkers 2020-08-27 16:07:03 +03:00
vldf
96f24a43be [FIR] Introduce unused variable extended checker 2020-08-27 16:07:03 +03:00
vldf
e718f60833 [FIR] Refactoring extended checkers 2020-08-27 16:07:03 +03:00
vldf
aefb7dc10f [FIR] Add checkerContext parameter to ControlFlowAnalyserCheckers 2020-08-27 16:07:03 +03:00
vldf
14eaa113e0 [FIR] Add new errors for extended checkers (around unused variable) 2020-08-27 16:07:03 +03:00
vldf
58c5d3a6ca [FIR] Fix destructuring declaration creation via light tree 2020-08-27 16:07:03 +03:00
vldf
3428a5434b [FIR] Add methods to access child/children of FirSourceElement 2020-08-27 16:07:02 +03:00
vldf
5e0dc53295 [FIR] Refactor CanBeValChecker 2020-08-27 16:07:02 +03:00
Andrei Klunnyi
5cf76aa950 KT-41425 Project can not be launched with Gradle runner
93a82060 introduced support of "delegate to Gradle" for Gradle-Kotlin.
This commit fixes an issue known as "Could not get unknown property
'sourceSets' for root project".
2020-08-27 14:50:40 +02:00
Nikolay Krasko
f57f920dc0 Mark IdeReplExecutionTest.testOnePlusOne as flaky
Was previously muted on TC.
2020-08-27 14:08:48 +03:00
Nikolay Krasko
866666f3ff Update test data for MultiModuleHighlightingTest.testLanguageVersionsViaFacets
Remove `Reference is not resolved to anything` markers
2020-08-27 14:08:48 +03:00
Nikolay Krasko
4b937f0929 Mute stable CompilerDaemonTest.testParallelDaemonStart
It was previously muted on TC.
2020-08-27 14:08:48 +03:00
Dmitry Gridin
0c0b394cc2 [formatter] fix performance issue
^KT-41314 Fixed
2020-08-27 11:04:34 +00:00
Ilya Goncharov
9818321b46 [JS, Wizard] Use react template in full stack
^KT-41417 fixed
2020-08-27 13:35:17 +03:00
Ilya Goncharov
cd0bdc190b [JS, Wizard] Use IR in gradle.properties and otherwise use as a param
^KT-41418 fixed
2020-08-27 13:34:46 +03:00
Ilya Goncharov
13bf15b403 [JS, Wizard] Set js compiler per module
^KT-41418 fixed
2020-08-27 13:34:46 +03:00
Ilya Kirillov
f824f03fa2 Wizard: fix filtering values in DropDownComponent 2020-08-27 13:34:46 +03:00
Ilya Goncharov
98f98d5856 [JS, Wizard] Add different compilers for JS wizard
^KT-41418 fixed
2020-08-27 13:34:46 +03:00
Ilya Goncharov
c797f3044e [JS, Wizard] Add react template plugin
^KT-41417 fixed
2020-08-27 13:34:45 +03:00
Ilya Goncharov
220ff6c648 [JS, Wizard] Add redux and react router
^KT-41417 fixed
2020-08-27 13:34:30 +03:00
Ilya Goncharov
d5340803bd [JS, Wizard] Add react application template
^KT-41417 fixed
2020-08-27 13:34:15 +03:00
Ilya Goncharov
01064a4e46 [JS, Wizard] Add react application template
^KT-41417 fixed
2020-08-27 13:33:50 +03:00
Ilya Goncharov
96e1b1c0e0 [JS, Wizard] Separate browser application without react
^KT-41417 fixed
2020-08-27 13:33:34 +03:00
Ilya Goncharov
491eb5e366 [JS, Wizard] Move subtarget settings in separate object
^KT-41417 fixed
2020-08-27 13:33:15 +03:00
Ilya Goncharov
94f8a78893 [JS, Wizard] Fix source set name for js wizard
^KT-41417 fixed
2020-08-27 13:30:37 +03:00
Mikhail Zarechenskiy
cba13c3c35 Take into account captured types with variables during fixation
#KT-41202 Fixed
2020-08-27 11:06:14 +03:00
Dmitry Gridin
5dbb6fdf50 [inspections] NamingConversion: add missing space in description
^KT-41395 Fixed
2020-08-27 14:58:33 +07:00
Yunir Salimzyanov
e12c35de5f Traverse all pages of muted tests on Teamcity (KTI-326)
incomplete list of remotely muted tests was causing re-muting of tests
that were not fetched
2020-08-26 19:37:11 +03:00
Mikhail Zarechenskiy
06a592c018 Fix SOE when recursive type argument is used with star projection
#KT-41043 Fixed
2020-08-26 19:23:21 +03:00
Mikhail Zarechenskiy
674e9e455f Fold lower constraints like (T!!..T) and (T..T?) into the latter one
#KT-41149 Fixed
2020-08-26 19:23:20 +03:00
Mikhail Zarechenskiy
e91b378b7d Don't perform unnecessary SAM conversions
#KT-41149 In Progress
2020-08-26 19:23:19 +03:00
Mikhail Zarechenskiy
6a7ed96be5 Consider T <: Nothing! as trivial during constraint incorporation
#KT-41149 In Progress
2020-08-26 19:23:18 +03:00
Mikhail Zarechenskiy
567e6ca9ca Fix OOM when there are several lambdas with extension function types
#KT-41335 Fixed
2020-08-26 19:23:18 +03:00
Jinseong Jeon
085e0dc1de FIR2IR: allow array expression as named argument for vararg 2020-08-26 18:01:21 +03:00
Vladimir Dolzhenko
54d3c5fb0a Pick up script language level from used stdlib in a gradle's classpath
^KT-41283 Fixed
2020-08-26 14:09:58 +00:00
Ilya Kirillov
949c67078d NJ2K: fix testdata of MultiFileTestGenerated.testNullabilityByDFa 2020-08-26 16:17:24 +03:00
Ilya Kirillov
c8ab827fa0 Wizard: fix invalid path in generated buildscript on windows 2020-08-26 16:17:24 +03:00
Nicolay Mitropolsky
c93ae64546 Uast: KotlinClassViaConstructorUSimpleReferenceExpression resolve to PsiClass (KT-41290) 2020-08-26 16:13:13 +03:00
Vladimir Dolzhenko
99924ea5e4 Fix Typo: equals() & hashCode(), toString() are written with the first uppercase letter
^KT-41390 Fixed
2020-08-26 14:59:31 +02:00
Jinseong Jeon
553ae68c96 FIR2IR: convert adapted callable reference with vararg 2020-08-26 14:26:19 +03:00
Igor Yakovlev
48034092e9 Fix SOE on library source based lightclass lookup
Fixed KT-41325
2020-08-26 12:10:09 +03:00
Jinseong Jeon
99286a6ce3 FIR2IR: introduce & use ClassId-based lookup for local class as IrParent 2020-08-26 10:08:16 +03:00
Aurimas Liutikas
777b16e0a3 Fix @Language injection when using named parameters
Start using names of arguments if they are available when fetching
the @Language injection information.

Fixes KT-35859
2020-08-25 23:02:53 +03:00
Alexander Udalov
a9ddf02556 Replace deprecated usages of max/min with maxOrNull/minOrNull 2020-08-25 20:33:59 +02:00
Nikolay Krasko
81dda96ece Mute flaky KotlinFindUsagesWithLibraryTestGenerated.KotlinLibrary 2020-08-25 21:31:11 +03:00
Nikolay Krasko
3a1158b4ef Minor: move mute KotlinFindUsagesWithLibraryTestGenerated to common 2020-08-25 21:31:11 +03:00
Nikolay Krasko
125819f9bf Mute flaky testUsingReadOnlyInterfaces test 2020-08-25 21:31:10 +03:00
Nikolay Krasko
1928390121 Prevent flaky behaviour from MakeOverriddenMemberOpenFix in tests
Several quick fix tests are flaky thanks to MakeOverrideMemberOpenFix
class. Flakiness is probably caused by `myQuickFixInfo: QuickFixInfo`
field. When there's no memory pressure, there's no resolve in dispatch
thread, but value may be invalidated because of soft reference usage
and re-evaluating might cause the test failure.

Caused by: org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException: Kotlin resolution encountered a problem while analyzing KtNamedFunction
  at org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacadeWithDebugInfo.analyze(ResolutionFacadeWithDebugInfo.kt:44)
  at org.jetbrains.kotlin.idea.caches.resolve.ExtendedResolutionApiKt.analyze(extendedResolutionApi.kt:97)
  at org.jetbrains.kotlin.idea.caches.resolve.ExtendedResolutionApiKt.resolveToDescriptorIfAny(extendedResolutionApi.kt:39)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils.resolveToDescriptorIfAny(resolutionApi.kt:60)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.computeInfo(MakeOverriddenMemberOpenFix.kt:54)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.access$computeInfo(MakeOverriddenMemberOpenFix.kt:38)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix$myQuickFixInfo$2.invoke(MakeOverriddenMemberOpenFix.kt:41)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix$myQuickFixInfo$2.invoke(MakeOverriddenMemberOpenFix.kt:38)
  at org.jetbrains.kotlin.idea.core.util.CachedValueHelpersKt$sam$com_intellij_psi_util_CachedValueProvider$0.compute(CachedValueHelpers.kt)
  at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
  at com.intellij.util.CachedValueBase.lambda$getValueWithLock$0(CachedValueBase.java:228)
  at com.intellij.util.IdempotenceChecker.applyForRandomCheck(IdempotenceChecker.java:336)
  at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
  at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
  at org.jetbrains.kotlin.idea.core.util.CachedValueHelpersKt.getValue(CachedValueHelpers.kt:25)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.getMyQuickFixInfo(MakeOverriddenMemberOpenFix.kt)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.getContainingDeclarationsNames(MakeOverriddenMemberOpenFix.kt:45)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.getText(MakeOverriddenMemberOpenFix.kt:89)
  at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.getText(IntentionActionWithTextCaching.java:165)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$invokeIntention$52(CodeInsightTestFixtureImpl.java:1933)
  at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
  at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)
  at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:322)
  at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
  at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:132)
  at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47)
  at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:188)
  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
  at java.awt.EventQueue.access$500(EventQueue.java:97)
  at java.awt.EventQueue$3.run(EventQueue.java:709)
  at java.awt.EventQueue$3.run(EventQueue.java:703)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
  at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:965)
  at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:838)
  at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
  at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:733)
  at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
  at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)
  at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
  at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.util.ui.UIUtil.dispatchAllInvocationEvents(UIUtil.java:1738)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$invokeIntention$53(CodeInsightTestFixtureImpl.java:1939)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.withReadOnlyFile(CodeInsightTestFixtureImpl.java:1960)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.invokeIntention(CodeInsightTestFixtureImpl.java:1929)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$launchAction$14(CodeInsightTestFixtureImpl.java:680)
  at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:18)
  at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:13)
  at com.intellij.testFramework.EdtTestUtilKt.runInEdtAndWait(EdtTestUtil.kt:44)
  at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:18)
  at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.kt)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.launchAction(CodeInsightTestFixtureImpl.java:680)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$stubComparisonFailure$1.invoke(AbstractQuickFixTest.kt:176)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$stubComparisonFailure$1.invoke(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadManager.runWithForceCheckForResolveInDispatchThreadInTests$idea_core(ResolveInDispatchThreadManager.kt:115)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadManagerKt.forceCheckForResolveInDispatchThreadInTests(ResolveInDispatchThreadManager.kt:40)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.applyAction(AbstractQuickFixTest.kt:175)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.access$applyAction(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$doKotlinQuickFixTest$1.run(AbstractQuickFixTest.kt:125)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:167)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:153)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.doKotlinQuickFixTest(AbstractQuickFixTest.kt:96)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.access$doKotlinQuickFixTest(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$doTest$1.invoke(AbstractQuickFixTest.kt:60)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$doTest$1.invoke(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseKt.withCustomCompilerOptions(KotlinLightCodeInsightFixtureTestCase.kt:253)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.doTest(AbstractQuickFixTest.kt:55)
  at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$testWithCustomIgnoreDirective$6(KotlinTestUtils.java:803)
  at org.jetbrains.kotlin.test.MuteWithFileKt$testWithMuteInFile$1.invoke(muteWithFile.kt:41)
  at org.jetbrains.kotlin.test.KotlinTestUtils.runTestImpl(KotlinTestUtils.java:773)
  at org.jetbrains.kotlin.test.KotlinTestUtils.runTest(KotlinTestUtils.java:716)
  at org.jetbrains.kotlin.idea.quickfix.QuickFixTestGenerated$Override.runTest(QuickFixTestGenerated.java:10025)
  at org.jetbrains.kotlin.idea.quickfix.QuickFixTestGenerated$Override.testOverridingDelegatedMethod(QuickFixTestGenerated.java:10074)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at junit.framework.TestCase.runTest(TestCase.java:176)
  at com.intellij.testFramework.UsefulTestCase.lambda$runTest$9(UsefulTestCase.java:327)
  at com.intellij.testFramework.UsefulTestCase.lambda$invokeTestRunnable$10(UsefulTestCase.java:364)
  at com.intellij.testFramework.EdtTestUtilKt.runInEdtAndWait(EdtTestUtil.kt:44)
  at com.intellij.testFramework.UsefulTestCase.invokeTestRunnable(UsefulTestCase.java:363)
  at com.intellij.testFramework.UsefulTestCase.runTest(UsefulTestCase.java:346)
  at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase.lambda$runTest$0(KotlinLightCodeInsightFixtureTestCaseBase.java:92)
  at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$runTestWithThrowable$4(KotlinTestUtils.java:726)
  ... 36 more
Caused by: org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadException: Resolve is not allowed under the write action for `org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix`!
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$writeActionResolveHandler$1.invoke(AbstractQuickFixTest.kt:170)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$writeActionResolveHandler$1.invoke(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadManager.assertNoResolveInDispatchThread$idea_core(ResolveInDispatchThreadManager.kt:73)
  at org.jetbrains.kotlin.idea.caches.resolve.ModuleResolutionFacadeImpl.analyze(ModuleResolutionFacadeImpl.kt:60)
  at org.jetbrains.kotlin.idea.caches.resolve.ModuleResolutionFacadeImpl.analyze(ModuleResolutionFacadeImpl.kt:56)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacadeWithDebugInfo.analyze(ResolutionFacadeWithDebugInfo.kt:45)
  ... 126 more
2020-08-25 21:31:10 +03:00
Mikhail Glukhikh
5702fb3b22 FIR: fix CCE in AttributeArrayOwner 2020-08-25 19:29:59 +03:00
Mikhail Glukhikh
962059a878 Introduce FirProperty.hasBackingField & use it in FIR2IR 2020-08-25 19:29:58 +03:00
Mikhail Glukhikh
c6417696cf FirProperty: return back 'isReferredViaField' attribute 2020-08-25 19:29:58 +03:00
Jinseong Jeon
3e9ac75cfc FIR: record use of backing field symbol to indeed add a backing field 2020-08-25 19:29:58 +03:00
Vyacheslav Gerasimov
0cc3762f9a Build: Fix kotlinx-metadata-klib publication 2020-08-25 17:18:00 +03:00
vldf
36f2f1fcf7 [FIR] Add lightTree support to extended checkers + minor refactorings 2020-08-25 17:08:57 +03:00
vldf
da702992d9 [FIR] Fix null source on destructuring declaration 2020-08-25 16:33:49 +03:00
Ilya Matveev
30d24ed943 Tests, Gradle: Fix broken test for KT-40834 2020-08-25 13:06:40 +00:00
Ilya Matveev
920f1184bd Revert "Revert "CocoaPods: Skip synthetic task on non-mac hosts""
This reverts commit 6040491373.
2020-08-25 13:06:39 +00:00
Nick
fd9bfe44f1 [FIR] Visit class annotations without the class's scope 2020-08-25 15:59:33 +03:00
vldf
3cad88a58c [FIR] Fir Helpers hotfix 2020-08-25 14:49:56 +03:00
vldF
cb627952b2 [FIR] Checkers performance improvement
[FIR] Checkers performance improvement
2020-08-25 14:20:30 +03:00
Ilya Goncharov
d86c81cb38 [JS, Gradle] Fix test on overflow, now throw exception on overflow 2020-08-25 13:44:20 +03:00
Arsen Nagdalian
8b4e8a2c0c Diagnostics: add diagnostic for reporting contract description blocks in old frontend 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
80d7f6b688 Ignore the "contract" keyword in code completion 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
ede1c08a9b [FIR] Add resolution of contracts that are written using the new syntax 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
b8b60864fd [FIR] Add contracts tests and place them in a separate directory 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
86e07cd626 Parser tests: move the contract description blocks tests to a separate folder and add a test for property accessors' contracts 2020-08-25 12:58:38 +03:00
Arsen Nagdalian
66f7250380 [FIR] Add contract description blocks support to "lightTree2FIR" conversion 2020-08-25 12:58:38 +03:00
Arsen Nagdalian
9fd104eec8 [FIR] Add contract description blocks support to RawFirBuilder 2020-08-25 12:58:38 +03:00
Arsen Nagdalian
d53f3b9ba8 [PSI] Add some useful getters to psi nodes 2020-08-25 12:58:37 +03:00
Arsen Nagdalian
a936c6331a [Parser] Add getters' and setters' contracts parsing 2020-08-25 12:58:37 +03:00
Arsen Nagdalian
6c06008b4d [FIR] Add a class representing the old syntax contract description in order to use the previous class for the new syntax 2020-08-25 12:58:37 +03:00
Arsen Nagdalian
b83aa88eff [FIR] Add function for getting ConeEffectDeclaration from FirEffectDeclaration and use it where needed 2020-08-25 12:58:35 +03:00
Arsen Nagdalian
991b18fec4 [FIR] Add a Fir node that wraps a ConeEffectDeclaration 2020-08-25 12:58:35 +03:00
Arsen Nagdalian
32a64b888e [Parser] Add parsing of function's contract either before or after type constraints 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
1b57889773 Clean the code 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
f781a9993b Parser tests: add tests for contract description blocks 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
2e9a898f45 [Parser] Move function's contracts parsing in before type constraints parsing 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
0990434840 [Parser] Modify parser so that it could parse contract description blocks of functions 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
e3fe9c3314 [PSI] Add new Psi nodes representing contract effects list and each individual contract effect in the list 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
4b7d34b537 Add "contract" keyword 2020-08-25 12:58:34 +03:00
Dmitriy Novozhilov
316e0e6609 [FIR] Update testdata 2020-08-25 12:07:59 +03:00
Dmitriy Novozhilov
3ccb72bb1a Shadow :core:compiler.common inside kotlinx.metadata 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
811a2206a5 Fix usages of KotlinBuiltIns after rebase 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
bc1b6d3588 Rename :core:descriptors.common to :core:compiler.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
864cf21f03 Merge :core:type-system into :core:descriptors.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
5fa80a2f8c Merge :core:deserialization:deserialization.common into :core:descriptors.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
bbac270b33 Move OperatorNameConventions to :core.descriptors.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
2760a187a9 Move FunctionClassKind utils to :core.descriptors.common 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
2285d3e3cf Move Variance and AnnotationUseSiteTarget to :core.descriptors.common 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
167f18b738 Move SourceElement and SourceFile to :deserialization.common
Remove dependency on `:core:descriptors` from `:core:deserialization:deserialization.common`
2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
a764732020 Rename KotlinBuiltInsNames to StandardNames 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
d032fdfc44 [FIR] Cleanup dependencies in :compiler:fir:raw-fir modules 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
b6fd6c3a84 [FIR] Remove dependency on descriptors from :compiler:fir:raw-fir.raw-fir.common module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
71a517c686 [FIR] Rename :compiler:fir:raw-fir:fir-common to :compiler:fir:raw-fir:raw-fir.common 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
7d4349edc2 [FIR] Remove dependency on descriptors from :compiler:fir:tree module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
95346f834b [FIR] Fix forgotten dependency to contracts of FE 1.0 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
73ace6d161 Remove dependency to descriptors from :compiler:config module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
82a9b1492b Move RenderingUtils to :core:descriptors.common module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
ba6b1c37d0 Move TargetPlatform to :core:descriptors.common module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
d6d2be8e58 Move incremental components to :core:descriptors.common module 2020-08-25 10:41:31 +03:00
Dmitriy Novozhilov
3a48265077 Move ModuleDescriptor.Capability to :core:descriptors.common module 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
6f0cd14afa Move common classes to new :core:deserialization:deserialization.common module 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
079a2dfe1e Move EventOccurrencesRange class to :core:descriptors.common module 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
f7f489537b [FIR] Remove dependency on :core:descriptors from :compiler:fir:tree 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
e92caae609 [FIR] Remove dependency on :core:descriptors from :compiler:fir:cones 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
45cf221b97 Move util functions from KotlinBuiltIns to :core:descriptors.common module 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
20a2ad8223 Move FunctionClassDescriptor.Kind to :core:descriptors.common module 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
7a7fe77b8e Move static constants with builtin names to :core:descriptors.common module 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
2e92fe9be9 [FIR2IR] Add fir2ir component for converting fir visibility to FE 1.0 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
a02109d857 [FIR] Add FirVisibilityChecker session component
This is needed because we have different visibility rules for different
  platform visibilities (e.g. protected and package private on JVM), so
  we need ability to configure visibility checks for different platforms
2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
18ae593700 [FIR] Rename new visibilities to CamelCase
It's more convenient since they are objects now instead of
  const fields in FE 1.0
2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
43821b681c [FIR] Introduce new Visibility class which not depends on descriptors 2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
9d9f9c52c0 Extract some classes from descriptors module to :core:common
This is needed to remove dependencies from fir modules to
  `:core:descriptors` module

What was extracted:
- Modality
- ClassKind
- org.jetbrains.kotlin.name package
2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
41ba9b0a2d [FIR] Add flag to disable transformers required only for plugins 2020-08-25 10:31:34 +03:00
Mikhail Glukhikh
53ad502d2a [FIR2IR] Generate fake overrides earlier and bind them later
Before this commit, we generated fake overrides at last FIR2IR stage,
after having all functions and classes built. This could lead to a
situation when fake override was called before it was generated.
This commit fixes this situation.
2020-08-25 10:00:26 +03:00
Ilya Chernikov
ee9c597767 Build: Remove exclusion of kotlinx-coroutines-core in scripting-compiler
The previous fix was insufficient to fix gradle substitution in MPP
projects (https://github.com/gradle/gradle/issues/14017)
2020-08-24 19:13:16 +02:00
Nikolay Krasko
741f5de0f9 Clean PSI elements in KotlinExpressionMover
Fix report about leaked projects on build server:

via 'com.intellij.psi.impl.PsiManagerImpl.myProject'; Value: 'Project (name=light_temp, containerState=DISPOSE_COMPLETED, componentStore=/mnt/agent/temp/buildTmp/ideaProject_test_1285163057398451250/testRootGW1/unitTest_addPrimaryConstructorParameter/light_temp....' of class com.intellij.openapi.project.impl.ProjectImpl
      via 'com.intellij.psi.impl.source.PsiFileImpl.myManager'; Value: 'com.intellij.psi.impl.PsiManagerImpl@4ecdfe8' of class com.intellij.psi.impl.PsiManagerImpl
      via 'com.intellij.psi.impl.source.tree.CompositeElement.myWrapper'; Value: 'DummyHolder' of class com.intellij.psi.impl.source.JavaDummyHolder
      via 'com.intellij.psi.impl.source.tree.TreeElement.myParent'; Value: 'Element(DUMMY_HOLDER)' of class com.intellij.psi.impl.source.tree.FileElement
      via 'com.intellij.psi.impl.source.SubstrateRef$2.val$node'; Value: 'Element(VALUE_PARAMETER)' of class com.intellij.psi.impl.source.tree.CompositeElement
      via 'com.intellij.extapi.psi.StubBasedPsiElementBase.mySubstrateRef'; Value: 'com.intellij.psi.impl.source.SubstrateRef$2@5d02fa19' of class com.intellij.psi.impl.source.SubstrateRef$2
      via 'kotlin.Pair.first'; Value: 'VALUE_PARAMETER' of class org.jetbrains.kotlin.psi.KtParameter
      via 'org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover.parametersOrArgsToMove'; Value: '(VALUE_PARAMETER, VALUE_PARAMETER)' of class kotlin.Pair
      via '?'; Value: 'org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover@7a6f128e' of class org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover
      via 'com.intellij.openapi.extensions.impl.ExtensionPointImpl.myExtensionsCacheAsArray'; Value: '[Lcom.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover;@276493b6' of class [Lcom.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover;
      via 'java.util.concurrent.ConcurrentHashMap$Node.val'; Value: 'com.intellij.statementUpDownMover' of class com.intellij.openapi.extensions.impl.InterfaceExtensionPoint
      via '?'; Value: 'com.intellij.statementUpDownMover=com.intellij.statementUpDownMover' of class java.util.concurrent.ConcurrentHashMap$Node
      via 'java.util.concurrent.ConcurrentHashMap.table'; Value: '[Ljava.util.concurrent.ConcurrentHashMap$Node;@724e0cae' of class [Ljava.util.concurrent.ConcurrentHashMap$Node;
      via 'com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.extensionPoints'; Value: '{com.intellij.embeddedTokenHighlighter=com.intellij.embeddedTokenHighlighter, org.intellij.groovy.expectedTypesContributor=org.intellij.groovy.expectedTypesContributor, org.jetbrains.kotlin.resolveSco...' of class java.util.concurrent.ConcurrentHashMap
      via 'com.intellij.serviceContainer.ComponentManagerImpl.extensionArea'; Value: 'Application (containerState=ACTIVE)  (Unit test) (Internal) (Headless) (Command line)' of class com.intellij.openapi.extensions.impl.ExtensionsAreaImpl
      via '?'; Value: 'Application (containerState=ACTIVE)  (Unit test) (Internal) (Headless) (Command line)' of class com.intellij.openapi.application.impl.ApplicationImpl
       (from ApplicationManager.getApplication())
2020-08-24 19:03:03 +03:00
Nikolay Krasko
18195b3296 Rewrite SmartCompletionMultifileHandlerTest to KotlinFixtureCompletionBaseTestCase
Use light projects as an attempt to fight leaking project errors
2020-08-24 19:03:03 +03:00
Nikolay Krasko
e95c3e2905 Rewrite CompletionMultiFileHandlerTest to KotlinFixtureCompletionBaseTestCase
Use light projects as an attempt to fight leaking project errors
2020-08-24 19:03:03 +03:00
Ilya Goncharov
f92083989a [JS, Wizard] Fix build integrity 2020-08-24 19:01:38 +03:00
Nikolay Krasko
6040491373 Revert "CocoaPods: Skip synthetic task on non-mac hosts"
This reverts commit ce029822
2020-08-24 18:31:32 +03:00
Ilya Goncharov
621c87ee84 Overflowed teamcity messages should failed build
^KT-41133 fixed
2020-08-24 18:22:22 +03:00
Nick
e7b12b9bb1 [FIR] Fix false positive SUPER_NOT_AVAILABLE 2020-08-24 17:23:32 +03:00
Dmitry Petrov
a2dabe11c5 JVM KT-41150: Fix backward compatibility for inline vals in inline class
In 1.3.x, for inline class member inline vals 'getFoo-impl' method was
generated in corresponding inline class.
Since 1.4.0, getters for properties returning inline class values are
mangled (so corresponding getters are named 'getFoo-<mangling_hash>'.
However, to maintain backward compatibility with libraries compiled with
1.3.x, inliner should be able to find 'getFoo-impl' method in the
bytecode.
2020-08-24 16:17:12 +03:00
Vladimir Ilmov
27a22fc1e9 Cleanup Coroutine panel in case connection gets disposed soon after
creation.
2020-08-24 15:09:14 +02:00
Vladimir Ilmov
cb2ab4676b (CoroutineDebugger) Top node added to prevent dumpCoroutine() call
Panel gather information from the agent on each breakpoint hit.
2020-08-24 15:09:13 +02:00
Alexander Udalov
fa45650fd0 JVM IR: specialize ExpressionCodegen.visitFunctionAccess for constructors
This makes the code a bit clearer, and gets rid of some extra type
mapper invocations when generating constructor calls.
2020-08-24 14:51:52 +02:00
Ilya Kirillov
f9bd935ac6 Wizard: fix missing module templates 2020-08-24 15:48:02 +03:00
Kirill Shmakov
5a91dd0439 Update main wizard tests 2020-08-24 15:43:08 +03:00
Kirill Shmakov
147a8c357d Wizard: switch androidx.core -> android.material 2020-08-24 15:43:08 +03:00
Kirill Shmakov
57e9e9a2a1 Wizard: add android.useAndroidX property 2020-08-24 15:43:07 +03:00
Kirill Shmakov
9e88d61be4 Wizard: switch android:allowBackup
Otherwise template could leak sensitive data.
2020-08-24 15:43:06 +03:00
Kirill Shmakov
94ae839d2c Wizard: update Android Appcompat version 2020-08-24 15:43:03 +03:00
Kirill Shmakov
06f9a4e228 Wizard: update Android Gradle plugin version 2020-08-24 15:43:02 +03:00
Roman Artemev
a095909d5c [Plugin API] Provide special context in EP for link-time resolve
- requires to customize declarations from synthetic declarations
2020-08-24 15:37:39 +03:00
Steven Schäfer
ea98062241 JVM IR: Fix compilation of inline functions in anonymous objects...
...in class members. The corresponding classes end up nested in the
class initializer of the surrounding class and we need to take this into
account when creating instances of ClassCodegen.

This fixes KT-40332 on the JVM IR backend.
2020-08-24 14:10:36 +02:00
Ilya Matveev
ce02982226 CocoaPods: Skip synthetic task on non-mac hosts
This patch performs the following changes:

1. Create synthetic tasks even if synthetic projects are
not supported on the current host. This change simplifies
configuring dependencies between these tasks and custom user
tasks at the user side.

2. Disable synthetic tasks if synthetic projects are not supported
on the current host

Issue #KT-40834 Fixed
2020-08-24 12:04:50 +00:00
Alexander Udalov
b10cc6657e Fix loading of builtins resources in kotlin-reflect in Java modular mode
The main change here is that when kotlin-reflect is being run under Java
9+, we use another implementation of BuiltInsResourceLoader (see
libraries/reflect/api/src/java9) which loads .kotlin_builtins files from
the java.lang.Module instance of kotlin-stdlib, instead of the class
loader of kotlin-reflect, which may not have access to those resources.

If the application is being run in the old (classpath) mode, that Module
represents the unnamed module, which contains everything on the
classpath, and everything works as before. But if it's being run in the
modular mode, that Module instance is an encapsulated module for
kotlin-stdlib classes and resources, exactly where .kotlin_builtins
files are located.

This fixes a regression in 1.4.0. Prior to 1.4, kotlin-reflect and
kotlin-stdlib were not named modules (see KT-21266) and were loaded as
_automatic_ modules even if the application was run in the modular mode.
Apparently, they shared the same class loader in that case and looking
up .kotlin_builtins resources worked.

This change was supposed to go alongside
828cc6dbf3, but was overlooked because
adding module-info to standard libraries was postponed at that point.

Also slightly refactor Java9ModulesIntegrationTest to simplify running
compiled code, and add a smoke test on using kotlin-reflect in modular
mode.

 #KT-40842 Fixed
2020-08-24 13:30:00 +02:00
Alexander Udalov
201fa849b8 Workaround problem with log4j warnings in CLI tests
#KTI-166
2020-08-24 13:30:00 +02:00
Nick
05cfb654ba [FIR] Fix removeAtInt test 2020-08-24 13:38:43 +03:00
Nikolay Krasko
2b983b1c20 Mute flaky JavaAgainstKotlinBinariesCheckerTestGenerated.testEnumStaticImportInJava 2020-08-24 13:20:31 +03:00
Ilya Goncharov
2d8643b6ef [Gradle, JS] Add nowarn flag for kotlin2js
^KT-41340 fixed
2020-08-24 13:05:22 +03:00
Nick
aeae898b94 [FIR] Fix issues with properties' fake sources 2020-08-24 11:06:45 +03:00
Nick
61e21dadec [FIR] Add 3 type mismatch diagnostics 2020-08-24 11:06:12 +03:00
Nick
c8f8908a01 [FIR] Add NO_THIS & INSTANCE_ACCESS_BEFORE_SUPER_CALL 2020-08-24 11:06:10 +03:00
Nick
7e1c2cfd36 [FIR] Add diagnostic INAPPLICABLE_LATEINIT_MODIFIER + some builtin types 2020-08-24 11:06:06 +03:00
Nick
091e12c093 [FIR] Add diagnostic CONFLICTING_PROJECTION 2020-08-24 11:06:04 +03:00
Dmitriy Dolovov
d40bca4143 [Commonizer] Short-circuiting of type aliases
^KT-41220
2020-08-24 12:21:12 +07:00
Vyacheslav Gerasimov
8a84af8a6f Build: Fix idea-gradle test task dependency on dist 2020-08-22 14:11:34 +03:00
Mark Punzalan
a9359eb530 RangeContainsLowering: Handle unsigned ranges. 2020-08-21 21:15:27 +02:00
Mark Punzalan
ceba9f231d RangeContainsLowering: Fix bug in additional condition order for
`until` ranges.
2020-08-21 21:15:27 +02:00
Mark Punzalan
60a2f7d03f RangeContainsLowering: Handle Comparable ranges. 2020-08-21 21:15:27 +02:00
Mark Punzalan
1c1b1b4b0f Initial version of RangeContainsLowering, which optimizes calls to
contains() on ClosedRanges.
2020-08-21 21:15:27 +02:00
Jinseong Jeon
ca541337d1 FIR: skip return insertion for lambda w/ Unit return type 2020-08-21 19:16:43 +03:00
Alexander Udalov
f1ce668ede IR: minor, don't store unnecessary fields 2020-08-21 17:52:10 +02:00
Alexander Udalov
26eb51a9f9 Minor, fix generateBuiltins test 2020-08-21 17:51:23 +02:00
Nikolay Krasko
d170f46bfc Mute flaky fun usages tests 2020-08-21 18:28:21 +03:00
Nikolay Krasko
6293842d81 Mute XCoroutinesStackTraceTestGenerated flaky test 2020-08-21 18:28:21 +03:00
Nikolay Krasko
9d300f56cc Mark SubpluginsIT.testKotlinVersionDowngradeInSupbrojectKt39809 as flaky 2020-08-21 18:28:21 +03:00
Nikolay Krasko
8f785f6bb2 Mute flaky tests in ContinuationStackTraceTestGenerated 2020-08-21 18:28:21 +03:00
Nikolay Krasko
fd036c2658 Mute flaky tests in JavaAgainstKotlinBinariesCheckerTestGenerated 2020-08-21 18:28:21 +03:00
Roman Artemev
fcca2c6fa3 [JS IR] fix failing test 2020-08-21 17:44:07 +03:00
pyos
5722f889d8 FIR2IR: scan the entire interface tree for delegatable members 2020-08-21 16:50:23 +03:00
Mikhail Glukhikh
99d2fd7c4d [FIR] Handle open in interface correctly during status resolve 2020-08-21 16:50:23 +03:00
Mikhail Glukhikh
8e2c5bf4fe [FIR] Fix exposed visibility checking for enum entries 2020-08-21 16:50:22 +03:00
Mikhail Glukhikh
e15e87fded [FIR] Expand aliased type before checking for exposure 2020-08-21 16:50:22 +03:00
Denis Zharkov
cb6fbc329a FIR: Simplify FirQualifiedAccess hiearchy
Mostly, it's getting rid of FirQualifiedAccessWithoutCallee and FirModifiableQualifiedAccess
The latter was only used during FIR building to set explicit receiver
that might be done by replace call on explicit receiver

The problem with replaceExplicitReceiver is that for FirComponentCall
explicitReceiver should be not null, so it's needed to perform those tricks
at the generatot
2020-08-21 16:34:46 +03:00
Dmitriy Novozhilov
e6837a5b8c [FIR] Unify implementations of toSymbol and getSymbolByLookupTag 2020-08-21 15:28:34 +03:00
Dmitriy Novozhilov
d1f6e45b08 [FIR] Cleanup signature of getNestedClassifierScope 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
ffdc68b68d [FIR] Get rid of AbstractFirSymbolProviderWithCache 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
111b8c0169 [FIR] Cleanup caching symbol in ConeClassLikeLookupTagImpl
Type of `boundSymbol` replaced to OneElementWeakMap
`FirSymbolProvider.getSymbolByLookupTag` moved to extensions
2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
9032234e1d [FIR] Get rid of FirSymbolProvider.getNestedClassifierScope 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
77f52a9ddb [FIR] Add special inline class for caches which are used in symbol providers 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
4b6193159c [FIR] Get rid of JavaSymbolProvider.getJavaTopLevelClasses 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
d7cfb2fb13 [FIR] Get rid of FirSymbolProvider.getClassNamesInPackage
There was one non-removable usage of those function in FirJavaElementFinder
  and three non-trivial implementation
- `FirProvider.SymbolProvider`
- `KotlinDeserializedJvmSymbolsProvider`
- `FirBuiltinSymbolProvider`

First implementation was moved to `FirProvider` and other two was
  deleted, because in FirJavaElementFinder we need lookup only in
  classes from source code, so such methods in library providers are
  useless

#KT-41048
2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
b31f80aee3 [FIR] Get rid of FirSymbolProvider.getAllCallableNamesInPackage
#KT-41048
2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
f32a0fe7ad [FIR-TEST] Unify AbstractFirLoadCompiledKotlin and BuiltInsDeserializationForFirTestCase 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
913ea9b56d [FIR-TEST] Get rid of deprecated methods usage in AbstractFirLoadCompiledKotlin
Now complied declaration names are collected via ModuleDescriptor,
  so tests pass more correctly. Before this change tests didn't render
  compiled typealiases and properties.
Also some testdata was changed because of new order of declaration
2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
41aa90ad71 [FIR-TEST] Add flag to take memory dumps in modularized test 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
cb0b25ea39 [FIR] Replace Deprecated with PrivateForInline in ScopeSession 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
b4dc7955b4 [FIR] Avoid collections copying in FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
ce36ae64a1 [FIR] Deprecate questionable methods of FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
d5bb87cd1f [FIR] Replace inheritance with delegation for FirProvider and FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
ad9e41b828 [FIR] Mark JavaSymbolProvider.getJavaTopLevelClasses as @TestOnly 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
1d26ce4a4e [FIR] Get rid of useless methods in FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
f0d05a321d [FIR-IDE] Use symbolProvider instead of firProvider in KtFirPackageScope 2020-08-21 15:27:53 +03:00
vldf
0d6b363179 [FIR] Refactoring for extended checkers 2020-08-21 15:09:05 +03:00
vldf
e2016499f3 [FIR] Fixed CFA bug 2020-08-21 15:08:37 +03:00
vldf
ac07438489 [FIR] Speed up CFA-checkers 2020-08-21 15:08:37 +03:00
vldf
638a0d3b82 [FIR] Checkers performance improvement and some refactoring 2020-08-21 15:08:36 +03:00
Kirill Shmakov
5a45cc7290 Update wizard tests 2020-08-21 13:06:56 +03:00
Denis Zharkov
cee72023fa Remove TypeSystemContext::mayBeTypeVariable optimization
It doesn't work now since anyway it's required to obtain type
constructor
At the same time, now it's not very expensive to obtain the constructor
since it's just a lookup tag
2020-08-21 12:50:33 +03:00
Denis Zharkov
9ac5dd2bce FIR: Use lookup tags for as type constructors instead of symbols
It may help to avoid redundant symbols lookups
2020-08-21 12:50:33 +03:00
Vladimir Ilmov
34b55dbeb3 (CoroutineDebugger) Disable agent for MPP projects
#KT-39412 fixed
2020-08-21 10:35:39 +02:00
Vladimir Dolzhenko
1e96088cc6 Check unique symbols in Goto*Tests 2020-08-21 10:04:36 +02:00
Dmitry Gridin
5f584691a6 [inspections] disable "Redundant inner modifier" inspection
^KT-41264 Fixed
2020-08-21 09:28:37 +07:00
Vladimir Dolzhenko
ec253862c6 Check unique symbols in Goto*Tests 2020-08-20 23:50:26 +02:00
Kirill Shmakov
62be688eb7 Wizard: add missing test dependency 2020-08-20 22:33:14 +03:00
Roman Artemev
e7f22bcfbc [JS IR] Add test for cross module export 2020-08-20 22:16:20 +03:00
Anton Bannykh
136d86e552 [JS IR] Fix cross-module import/export in case per-module splitting 2020-08-20 22:13:39 +03:00
Roman Artemev
8d61e9ba21 [KLIB] Load @JsExport annotated declarations explicitly 2020-08-20 22:13:39 +03:00
Roman Artemev
1a0e3a1d83 [KLIB] Refactor file serializer a bit
- Support explicitly exported on files and properties
2020-08-20 22:13:38 +03:00
Alexander Udalov
12e900ef3c Minor, do not capitalize words in generated Gradle options docs
To make this output correspond to the actual table at
https://github.com/JetBrains/kotlin-web-site/blob/master/pages/docs/reference/using-gradle.md
2020-08-20 20:30:55 +02:00
Alexander Udalov
0ef4b22cf3 Remove deprecated usages of ContainerUtil 2020-08-20 20:30:34 +02:00
Alexander Udalov
2428c180c2 Suppress warning on usage of old MPP in kotlin-stdlib 2020-08-20 20:30:34 +02:00
Alexander Udalov
da6d904c6e Suppress code warnings in kotlin-stdlib 2020-08-20 20:30:34 +02:00
Nikolay Krasko
5ef4f7df5a Mute more tests 2020-08-20 16:06:11 +03:00
Nikolay Krasko
44a95a4105 Stop running failed AndroidRunner tests 2020-08-20 16:06:11 +03:00
Nikolay Krasko
7f91ed6997 Support mute tests in kotlin-gradle-plugin-integration-tests (KTI-234)
#KTI-234 Fixed
2020-08-20 16:06:11 +03:00
Mikhail Glukhikh
07bddbe4d0 [FIR CLI] Don't run generation if some errors are found 2020-08-20 16:04:07 +03:00
Mikhail Glukhikh
85c1505689 [FIR2IR] Copy type parameters for trivial fake overrides 2020-08-20 16:04:02 +03:00
Alexander Udalov
bf0bb9e946 JVM IR: remove obsolete code for duplicate signature diagnostics 2020-08-20 14:58:36 +02:00
Alexander Udalov
425b192a5f Fix warnings in build-common/daemon code 2020-08-20 14:58:11 +02:00
Alexander Udalov
1d15a5547d Suppress deprecation warnings related to scripting 2020-08-20 14:58:11 +02:00
Alexander Udalov
549ee84687 Fix some compiler warnings in FIR modules 2020-08-20 14:57:54 +02:00
Mikhail Zarechenskiy
ced151f3af Add test for KT-41254
It was fixed along with #KT-41005
2020-08-20 15:45:32 +03:00
Mads Ager
a6f301e84a [JVM_IR] Rebase constructor stepping tests that are working as intended.
JVM_IR has consistent stepping behavior for secondary constructors
and init blocks. This change fixes the expectations for tests that
expect the less consistent JVM backend behavior.
2020-08-20 13:12:22 +02:00
Mads Ager
2c6b5c8847 [JVM_IR] Give temporary variable loads meaningful offsets.
Temporary variable loads in when expressions had the offsets
of the variable declaration. That leads to hacks during codegen
for line number generation.

Instead of those hacks, give the variable loads the offsets of
the context in which they occur. That avoids the codegen hacks
and fixes stepping behavior for more when expressions.
2020-08-20 13:12:22 +02:00
Sergey Igushkin
413d02621b Add a link to docs in MPP stability warning; add a flag that hides it 2020-08-20 10:44:59 +00:00
Mikhail Glukhikh
02e5f140f4 Fir2IrLazyProperty: generate overridden symbols via FirTypeScope 2020-08-20 11:47:35 +03:00
Mikhail Glukhikh
25efad2fd7 [FIR2IR] Extract generateOverriddenAccessorSymbols 2020-08-20 11:47:35 +03:00
Roman Golyshev
539d2bc01f FIR Completion: Fix completion with error type as receiver
- When type is error, the completion should not show anything; instead,
it was showing as if the explicit receiver was not there
2020-08-20 11:33:23 +03:00
Roman Golyshev
bca9754a7b FIR Completion: Move completion from available scopes to separate class 2020-08-20 11:33:23 +03:00
Denis Zharkov
7f3f0faa1a FIR: Rework overridden members processing in FirTypeScope
Now, FirTypeScope returns only direct overridden and a base scope
where a client might look for deeper overridden

It's necessary to make the API fast and simple
when only direct overridden are needed

At the same time, while this API looks a bit complicated for most of the clients
there are simple extension helpers that obtain just the direct or all overridden
2020-08-20 11:18:59 +03:00
Toshiaki Kameyama
8ce9b2d061 KT-34572 Convert to block body action improperly works with suppress annotations (#2969)
* Convert to block body: place @Suppress annotation before return expression

#KT-34572 Fixed

* Convert to block body: place annotations before return expression
2020-08-20 11:15:00 +03:00
Ilya Kirillov
9e0bb4ce8e FIR: save resolvePhase of declaration when creating it fake override copy 2020-08-20 11:07:09 +03:00
Ilya Kirillov
b1d3ab04c2 FIR [IDE]: provide correct node phase when necessary 2020-08-20 09:48:33 +03:00
Mads Ager
119302b016 [JVM_IR] Run KotlinSteppingTests with the JVM_IR backend.
Implement support for supressing failures by backend.
2020-08-20 05:48:54 +02:00
Nikolay Krasko
01f7da66c6 Mute ProjectTemplateNewWizardProjectImportTestGenerated.**.testMultiplatformApplication 2020-08-19 23:35:23 +03:00
Nikolay Krasko
9d18279ec9 Mute ReferenceResolveTestGenerated.DelegatedPropertyAccessors.InStandardLibrary.testNotNull 2020-08-19 23:01:09 +03:00
Nikolay Krasko
d87d42348b Mute flaky GotoWithMultipleLibrariesTest
Tests are flaky after e2a12602a3
2020-08-19 23:01:09 +03:00
Nikolay Krasko
179bd1cc3d Mute KotlinUastTypesTest.testEa101715 2020-08-19 23:01:09 +03:00
Nikolay Krasko
950b139804 Mute CreateFunction.Invoke.testLambdaArgument 2020-08-19 23:01:09 +03:00
Nikolay Krasko
496ede7587 Mute KotlinUastTypesTest.testEa101715 2020-08-19 23:01:08 +03:00
Nikolay Krasko
4135240cc0 Mute testFunctionBreakpointInStdlib in AS41 2020-08-19 23:01:08 +03:00
Nikolay Krasko
7982283007 Copy mutes for AS41 from 201 2020-08-19 23:01:08 +03:00
Nikolay Krasko
a3c8427cb2 Mute GradleScriptListenerTest tests 2020-08-19 23:01:08 +03:00
Nikolay Krasko
7de5368b4d Fix AbstractGradleBuildRootsLocatorTest tests 2020-08-19 23:01:08 +03:00
Nikolay Krasko
0b2fcd2c4d Remove mutes for navigation tests 2020-08-19 23:01:08 +03:00
Yunir Salimzyanov
ebe0489a74 Fix joined lines in .bunch 2020-08-19 19:51:51 +03:00
Yunir Salimzyanov
70cda1b113 Refactor and fix files previously affected by 192 patchset (KTI-315) 2020-08-19 19:40:02 +03:00
Yunir Salimzyanov
42da9e62db Cleanup 192 patchset files (KTI-315) 2020-08-19 19:40:02 +03:00
Yunir Salimzyanov
73aa21aab6 Refactor and fix files previously affected by as36 patchset (KTI-315) 2020-08-19 19:40:00 +03:00
Yunir Salimzyanov
27b2e16141 Cleanup as36 patchset files (KTI-315) 2020-08-19 19:40:00 +03:00
Ilya Chernikov
0a9089bc72 Set correct base classloader for REPL evaluation
the contributed partial fix of KT-35925 set it to the system classloader
which brought in many cases the compiler CP into the evaluation and lead
to the problems like KT-40898. This fix set it to the extension/platform
classloader, which preserves (partial) fix of the KT-35925 and do not
bring the compiler jar into the REPL evaluation classpath.

#KT-40898 fixed
2020-08-19 15:17:07 +02:00
Ilya Chernikov
f713e8ad36 Set context classloader before REPL evaluation
#KT-35925 fixed
2020-08-19 15:17:06 +02:00
Vladimir Dolzhenko
d0366d3bcb Failed test clean up
Relates to ^KT-40960
2020-08-19 15:06:53 +02:00
alexjuca
4794297640 used string template instead of concatenation 2020-08-19 13:58:58 +02:00
Kirill Shmakov
f88e492d11 Support hmpp in template
Explained in KMM-332
2020-08-19 14:46:49 +03:00
Toshiaki Kameyama
11044a3ab5 Surround with null check: fix incorrect check for 'in' expression
#KT-31749 Fixed
2020-08-19 14:37:24 +03:00
Toshiaki Kameyama
1188f4617a Change file's package to match directory: add space after package keyword if needed
#KT-39604 Fixed
2020-08-19 14:04:18 +03:00
Kirill Shmakov
1ce39222e3 Build KMM plugin for AS 4.2 2020-08-19 13:02:39 +03:00
Mikhail Zarechenskiy
6ed13ef1b6 Fix unresolved reference to catch parameter from lambda expression
#KT-41140 Fixed
2020-08-19 12:52:16 +03:00
Mikhail Zarechenskiy
f2fba8a469 Fix delegated property resolve when provideDelegate has this as argument
#KT-41135 Fixed
2020-08-19 12:52:16 +03:00
Toshiaki Kameyama
f3be3f449a Scope function conversion: do not suggest when invoked without receiver
#KT-35525 Fixed
2020-08-19 12:27:41 +03:00
Toshiaki Kameyama
8ba5548a0f "Eliminate argument of 'when'": do not suggest if 'when' is used as expression and it has no 'else' branch (#2898)
#KT-35526 Fixed
2020-08-19 12:24:58 +03:00
Toshiaki Kameyama
d965ad0a98 IfThenToSafeAccessInspection: do not report if condition is SENSELESS_COMPARISON/USELESS_IS_CHECK (#3007)
#KT-36051 Fixed
2020-08-19 12:22:10 +03:00
Toshiaki Kameyama
122bba9102 UnnecessaryVariableInspection: don't report for overriding property
#KT-39263 Fixed
2020-08-19 12:16:37 +03:00
Igor Yakovlev
c29dbee65e Cover move method refactoring with registry key (disabled by default) 2020-08-19 12:11:53 +03:00
aleksandrina-streltsova
ed67517fb9 Move: make minor refactorings and add GUI form for MoveKotlinMethodDialog 2020-08-19 12:11:53 +03:00
aleksandrina-streltsova
5515465760 Move: Support method moving 2020-08-19 12:11:53 +03:00
Alex Chmyr
a5368e443c KT-20421 fixing code generation for the case when "object" extends "class". It should look like: "object: class()". 2020-08-19 11:46:29 +03:00
Anton Yalyshev
26ca205f7e Fix a broken hyperlink to Whatsnew at the plugin change-notes 2020-08-19 11:41:13 +03:00
Ilya Kirillov
ccf285a284 FIR IDE: do not recreate analysis session for tests now 2020-08-19 11:35:42 +03:00
Ilya Kirillov
c191373a6b FIR IDE: always pass ValidityToken to KtAnalysisSessionComponent 2020-08-19 11:35:41 +03:00
Ilya Kirillov
2290d2fcc0 FIR IDE: make FirScopeRegistry belong to a KtFirScopeProvider 2020-08-19 11:35:40 +03:00
Roman Golyshev
7d58588f06 FIR IDE: Fix KtFirPropertySymbol::receiverType 2020-08-19 11:23:56 +03:00
Dmitry Petrov
8f0aecce58 JVM_IR: KT-40330 Unify field names for captured 'this' with JVM
NB some cases such as captured extension receiver for an extension
lambda are not supported yet; to be discussed, to what extent should we
actually follow JVM code shape here.
2020-08-19 11:07:41 +03:00
Dmitriy Dolovov
24bfc155af IDE perf tests for K/N: Use Gradle 6.6 2020-08-19 12:45:16 +07:00
Dmitriy Dolovov
6a95317f73 IDE perf tests for K/N: Switch to 1.4.0 2020-08-19 12:45:09 +07:00
Mikhail Glukhikh
f7cb165fb9 Introduce Fir2IrBuiltIns & move extension function type inside 2020-08-18 21:54:05 +03:00
Simon Ogorodnik
97b10b5ab3 [FIR2IR] Hack-in setting of extension function type annotation 2020-08-18 21:53:55 +03:00
Mikhail Glukhikh
b1c36feef4 Minor: regenerate FIR diagnostic tests 2020-08-18 21:53:35 +03:00
Jinseong Jeon
7e22de1e24 FIR2IR: insert coerce-to-unit expressions in statement containers 2020-08-18 21:53:08 +03:00
pyos
1b3ab53e16 FIR2IR: set superQualifierSymbol for setters too 2020-08-18 21:53:08 +03:00
Jinseong Jeon
e9659d9c8a FIR2IR: make the scope of body of do-while loop transparent 2020-08-18 21:53:07 +03:00
Jinseong Jeon
1b6c4329d2 FIR2IR: handle unbound reference with adapted arguments 2020-08-18 21:53:07 +03:00
vldf
a26eeb6ee8 [FIR] Add CLI flag for running extended checkers 2020-08-18 21:53:07 +03:00
vldf
2bf1d3fee8 [FIR] Add messages for extended checkers' warnings 2020-08-18 21:53:06 +03:00
Ilya Kirillov
08e2dd3dea NJ2K: fix implicit type cast in binary expressions
#KT-37298 fixed
2020-08-18 17:38:07 +03:00
Ilya Kirillov
d5d57f84e0 NJ2K: preserve annotations while converting class to object
#KT-38879 fixed
2020-08-18 17:38:07 +03:00
Ilya Kirillov
3d517c3656 NJ2K: fix retrieving resolutionFacade on empty context elements list 2020-08-18 17:38:07 +03:00
Ilya Kirillov
de0c216cfa NJ2K: fix NPE in JavaObjectEqualsToEqOperatorProcessing 2020-08-18 17:38:06 +03:00
Simon Ogorodnik
38477be484 [FIR] Make test fail if profiling requested, but misconfigured 2020-08-18 16:21:48 +03:00
Simon Ogorodnik
15d4333e81 [FIR] Add per-pass profiling support to modularized test 2020-08-18 16:21:48 +03:00
Simon Ogorodnik
83ded9badf [FIR] Add pass argument to beforePass of modularized test 2020-08-18 16:21:48 +03:00
Roman Artemev
716c3668d6 [IR] Properly resolve type parameters in case of property accessor
- fix KT-41006
2020-08-18 11:48:06 +03:00
Alexander Udalov
a810dbb41b IR: fix compiler warnings 2020-08-18 10:33:25 +02:00
Vladimir Dolzhenko
be53467bee Flaky and muted navigation tests clean up
Relates to #KT-40960
2020-08-18 08:23:02 +00:00
Vladimir Dolzhenko
e2a12602a3 Fixed getPsiMethodWrappers for KtLightMethodForDecompiledDeclaration
#KT-40960 Fixed
2020-08-18 08:23:01 +00:00
Vladimir Dolzhenko
ee0250bd35 Reformat file
Relates to #KT-40960
2020-08-18 08:23:00 +00:00
Vladimir Dolzhenko
5c7054a5ab Fixed src path for mock library
Relates to #KT-40960
2020-08-18 08:23:00 +00:00
Natalia Selezneva
7b80be5c9d Temporary workaround for gradle issue: wrong navigation for included plugin source code
https://github.com/gradle/gradle/issues/13783
^KT-39522
2020-08-17 23:12:51 +03:00
Alexander Udalov
7dd687cf00 IR: minor, use lazy instead of lazyVar for readonly value 2020-08-17 21:19:53 +02:00
Alexander Udalov
a21f273570 Fix compiler warnings in compiler code 2020-08-17 21:18:20 +02:00
Alexander Udalov
9b94e073af Fix warnings related to OptIn/UseExperimental 2020-08-17 21:18:19 +02:00
Alexander Udalov
256f4449ce IR: annotate obsolete API in IrPluginContext with ObsoleteDescriptorBasedAPI 2020-08-17 21:18:19 +02:00
Alexander Udalov
9961bd1fe1 IR: remove unneeded casts after making IrCall's symbol a simple function 2020-08-17 21:18:17 +02:00
Alexander Udalov
3bdbfc1e73 Output total codegen statistics after IR translation/generation 2020-08-17 19:29:58 +02:00
Alexander Udalov
c3cbcf6d7f Slightly improve performance measurements rendering
Report the input module name and size once before any measurements
instead of duplicating it in all of them. Also, render measurements in a
table to improve readability.

Before:

info: PERF: INIT: Compiler initialized in 467 ms
info: PERF: ANALYZE: 1 files (2 lines) target main-java-production in 277 ms - 7.220 loc/s
info: PERF: IR: Translation 1 files (2 lines) target main-java-production in 291 ms - 6.873 loc/s
info: PERF: GENERATE: 1 files (2 lines) target main-java-production in 513 ms - 3.899 loc/s
info: PERF: IR: Generation 1 files (2 lines) target main-java-production in 142 ms - 14.085 loc/s

After:

info: PERF: main-java-production, 1 files (2 lines)
info: PERF: INIT: Compiler initialized in 421 ms
info: PERF:         ANALYZE     342 ms       5.848 loc/s
info: PERF:  IR TRANSLATION     296 ms       6.757 loc/s
info: PERF:        GENERATE     453 ms       4.415 loc/s
info: PERF:   IR GENERATION     137 ms      14.599 loc/s
2020-08-17 19:29:57 +02:00
Simon Ogorodnik
0045b501d5 FIR IDE: Fix memory leak in thread locals 2020-08-17 20:05:52 +03:00
Ilya Kirillov
76b078b561 FIR IDE: resolve KtFirLocalVariableSymbol only to IMPLICIT_TYPES_BODY_RESOLVE 2020-08-17 20:05:52 +03:00
Ilya Kirillov
b8920114f8 FIR: set resolvePhase to BODY_RESOLVE in deserialized Kotlin declarations 2020-08-17 20:05:52 +03:00
Simon Ogorodnik
c7d6a79c25 FIR IDE: Fix completion in case of function with parameters 2020-08-17 20:05:52 +03:00
Nikolay Krasko
863de52f7a Minor: better name for file walking with excludes 2020-08-17 20:02:47 +03:00
Nikolay Krasko
c30910130e Remove minor optimization in CodeConformanceTest 2020-08-17 20:02:46 +03:00
Nikolay Krasko
01f3bdfc69 Exclude kotlin-ultimate/ide/common-cidr-native from author check 2020-08-17 20:02:46 +03:00
Nikolay Krasko
31ed803ada More excludes 2020-08-17 19:40:49 +03:00
Nikolay Krasko
713dbc225e Other repositories monitoring 2020-08-17 19:40:48 +03:00
Nikolay Krasko
fad15b6627 Rewrite testThirdPartyCopyrights test 2020-08-17 19:40:48 +03:00
Nikolay Krasko
bb0ea56d63 Extract traversing through directories to the common code 2020-08-17 19:40:48 +03:00
Nikolay Krasko
8db588c7f0 Optimize testNoBadSubstringsInProjectCode test
Don't visit ignored directories
2020-08-17 19:40:48 +03:00
Nikolay Krasko
2655d9dab3 Optimize testForgottenBunchDirectivesAndFiles test
Don't step through the ignored directories.
2020-08-17 19:40:48 +03:00
Nikolay Krasko
3eb89d6dfd Use own allow list for each repository 2020-08-17 19:40:48 +03:00
Nikolay Krasko
8445c8f4a5 Update copyright conformance excludes 2020-08-17 19:40:47 +03:00
Nikolay Krasko
04a1e572a8 Monitor new usages of kotlin-eap repository 2020-08-17 19:40:47 +03:00
Nikolay Krasko
d2bf5587d6 Monitor new usages of kotlin-dev repository 2020-08-17 19:40:47 +03:00
Nikolay Krasko
50d85b92da Remove more kotlin-dev usages 2020-08-17 19:40:47 +03:00
Nikolay Krasko
be2badc6ed Remove kotlin-dev from gradle migrate test 2020-08-17 19:40:47 +03:00
Nikolay Krasko
0c27e87eb9 Remove kotlin-dev from gradle configurator tests 2020-08-17 19:40:46 +03:00
Dmitriy Dolovov
3dc3c19c02 [Commonizer] Fix ImportAndCheckNavigation IT 2020-08-17 21:52:40 +07:00
Georgy Bronnikov
df8b819a55 JVM_IR: restore dumping for IrLowering phase 2020-08-17 15:57:12 +03:00
Ilya Goncharov
c70759673c [Gradle, JS] Update npm versions
^KT-41125 fixed
2020-08-17 15:22:30 +03:00
Steven Schäfer
6100166185 JVM IR: Fix special bridge generation with external Kotlin dependencies 2020-08-17 13:42:32 +02:00
Ilya Kirillov
730e07c52a Wizard: fix ExpectedFileTest.kt 2020-08-17 12:22:38 +03:00
Toshiaki Kameyama
35459d2ca7 "Add not-null asserted (!!) call": add '!!' to receiver of function reference
#KT-37841 Fixed
2020-08-17 12:05:45 +03:00
Ilya Kirillov
5e5e19f482 FIR IDE: temporary disable AddFunctionReturnTypeIntention 2020-08-17 11:38:05 +03:00
Ilya Kirillov
b79deafbc7 FIR IDE: fix testdata 2020-08-17 11:38:04 +03:00
Ilya Kirillov
27c045d035 FIR IDE: move all all symbol markers to markers package 2020-08-17 11:38:02 +03:00
Ilya Kirillov
052e8e5069 FIR IDE: make a symbol hierarchy a sealed one 2020-08-17 11:38:01 +03:00
Ilya Kirillov
018dd673b3 FIR IDE: simplify containing declaration provider 2020-08-17 11:38:00 +03:00
Ilya Kirillov
37ac654444 FIR IDE: rework high level API
Make analysis session to always be a receiver parameter
2020-08-17 11:37:58 +03:00
Ilya Kirillov
cadf99ca1e FIR IDE: introduce containingDeclarationProvider for symbols 2020-08-17 11:37:57 +03:00
Ilya Kirillov
b5a4e4c409 FIR IDE: introduce applicable computation & -based inspection 2020-08-17 11:37:56 +03:00
Ilya Kirillov
c8ab0766c9 FIR IDE: Implement symbol restoring for member symbols 2020-08-17 11:37:55 +03:00
Ilya Kirillov
e4995175a4 FIR IDE: fix idea-frontend-fir testdata 2020-08-17 11:37:53 +03:00
Ilya Kirillov
5f20910c79 FIR IDE: always try to find symbol origin in overridden symbols 2020-08-17 11:37:52 +03:00
Ilya Kirillov
a700d1fccb FIR IDE: resolve kt symbols only to the phase they actually need 2020-08-17 11:37:51 +03:00
Dmitriy Dolovov
75be9cf31f [Commonizer] Tests on rewriting callables names to succeed commonization
^KT-34602
2020-08-17 09:31:28 +07:00
Dmitriy Dolovov
de0b6e06cf [Commonizer] Keep parameters names hash in approximation keys for ObjC callables
^KT-34602
2020-08-17 09:31:21 +07:00
Dmitriy Dolovov
3b901a28d5 [Commonizer] More compact approximation keys
^KT-34602
2020-08-17 09:31:12 +07:00
Dmitriy Dolovov
4418dc85ca [Commonizer] Allow rewriting callables names to succeed commonization
^KT-34602
2020-08-17 09:31:03 +07:00
Dmitriy Dolovov
8904f5652b [Commonizer] Allow extended lookup for classifiers in test mode
Only for commonizer tests!

Allow to look up classifiers from the standard Kotlin packages (kotlin, kotlinx)
both in the default built-ins module and in test data sources. This is necessary
to write tests that refer to C-interop classifiers that are not available without
Kotlin/Native distribution.

^KT-34602
2020-08-17 09:30:57 +07:00
Dmitriy Dolovov
3b398ed57f [Commonizer] Small clean-up in IllegalCommonizerStateException 2020-08-17 09:30:47 +07:00
Dmitriy Dolovov
494fb39399 [Commonizer] CLI: Report duration even if it's 0ms long 2020-08-17 09:30:42 +07:00
Dmitriy Dolovov
9ef727747b [Commonizer] Use Array instead of List in AbstractListCommonizer 2020-08-17 09:30:36 +07:00
Igor Chevdar
e468a347b5 [box-tests] Tests on field init optimization
Added tests on all primitive types and a test when the field's type is an inline class
2020-08-15 12:16:33 +05:00
Steven Schäfer
0328fcaf5d JVM IR: Avoid IMPLICIT_NOTNULL checks on special bridge methods
...with dynamic type checks, except for the `@PlatformDependent`
methods, for which the JVM backend adds null checks.
2020-08-14 21:59:33 +02:00
Steven Schäfer
9026f89ba5 JVM IR: Avoid CHECKCASTs on type operators (KT-39520)
The type information coming from Java or Kotlin generics may be wrong
due to type erasure and a CHECKCAST instruction could throw an
exception.
2020-08-14 21:58:47 +02:00
Alexander Udalov
469b164555 IR: minor optimizations to IR validation 2020-08-14 21:55:37 +02:00
Alexander Udalov
7468518f35 JVM IR: minor, optimize forceSingleValueParameterBoxing
In JVM IR, both `valueParameters` and `isFromJavaOrBuiltins` take
noticeable time (1% of all compilation) because the logic for these in
IrBasedDescriptors is not trivial.
2020-08-14 21:55:37 +02:00
Alexander Udalov
35cace2540 JVM IR: collect potentialBridgeTargets in a list, then create bridges for all of them
This takes BridgeLowering time percentage from 1.3% to 1.0% of all
compiler time on a sample project, perhaps due to better data locality.
In addition, it simplifies stack traces by effectively merging all
bridge generation call sites into one, helping in future performance
investigations.
2020-08-14 21:55:37 +02:00
Alexander Udalov
9607414cf1 IR: make allOverridden return Set instead of Sequence, move to IrUtils
This doesn't hurt performance, but improves stack traces, in particular
in JVM's BridgeLowering.
2020-08-14 21:55:37 +02:00
Alexander Udalov
adcfbdec24 JVM IR: optimize special method / signature computation in BridgeLowering
First of all, put method signature caches of BridgeLowering into
JvmBackendContext. Since method hierarchies can span several files, and
a new instance of BridgeLowering is created to lower each file, keeping
them cached for the whole module makes BridgeLowering faster.

Also, do not attempt to compute special bridges if the method is
irrelevant, which can be deduced by its name. With this optimization,
the special method cache is no longer needed.

This brings BridgeLowering time from 3.8% down to 1.5% of all compiler
time on a sample project.
2020-08-14 21:55:37 +02:00
Alexander Udalov
0727e9055b JVM IR: use a simpler way to check if class is local 2020-08-14 21:55:37 +02:00
Alexander Udalov
6db5ad7310 IR: remove cast to IrStatement in IrDeclarationBase.transform
Default implementation of `IrStatement.transform` contained a cast to
`IrStatement`. Since almost all IR elements inherit from IrStatement,
this implementation was used in many subclasses. However, checkcast to
interface is slow and this place was indeed noticeable in the profiler
snapshot. Since not that many places really expected to get IrStatement
out of IrStatement.transform, introduce a new method
`transformStatement` that does this cast, and use it in all those
places. Meanwhile, most implementations will use the IrElement's
implementation of `transform` which merely invokes `accept` without
casts.
2020-08-14 21:55:37 +02:00
Alexander Udalov
fb8e39a621 IR: optimize transformation of declarations/statements lists in-place
Also, inherit IrDeclarationBase from IrElementBase to be able to use a
cast to IrElementBase, which is faster than a cast to IrElement or
IrDeclaration.
2020-08-14 21:55:36 +02:00
Alexander Udalov
4f0585950e IR: inline some transformChildren calls in IrElementTransformer{,Void}
IrElementTransformer.visitDeclaration/visitExpression are very prominent
hotspots, and it seems that HotSpot doesn't optimize the inlined Kotlin
bytecode there well enough. Reduce the bytecode in these and similar
methods by inlining calls to also/apply/transformChildrenVoid.
2020-08-14 21:55:36 +02:00
Nikolay Krasko
3a883e1236 Replace bintray bootstrap with space bootstrap repo 2020-08-14 17:31:13 +03:00
Nikolay Krasko
f484ceec80 Use GPG agent for signing in PublishedKotlinModule (KTI-314) 2020-08-14 17:31:13 +03:00
Nikolay Krasko
bbf8b12c65 Sign with GnuPG agent (KTI-314) 2020-08-14 17:31:13 +03:00
Nikolay Krasko
635ffcd53b Update maven signing for working with gpg 2 (KTI-314)
Update to maven-gpg-plugin 1.6 and add workaround for https://issues.apache.org/jira/browse/MGPG-59
2020-08-14 17:31:13 +03:00
Ilya Matveev
a121ec1e39 Update Kotlin/Native: 1.4.20-dev-16314 2020-08-14 09:41:47 +00:00
Roman Artemev
fa2c49a311 [Plugin API] Add extension point to contribute synthetic properties
- needs to fix KT_41006
2020-08-14 11:59:37 +03:00
Denis Zharkov
5ede37d6ab Report warnings on safe call + nullable extension operator
^KT-41034 In Progress
2020-08-14 11:12:34 +03:00
Roman Golyshev
852d22470e Revert "FIR Completion: Add idea-fir dependency to run completion tests"
This reverts commit 7d883f18
2020-08-13 23:12:34 +03:00
Toshiaki Kameyama
89cc5777ce Put parameters on line: don't suggest if parameters has end-of-line comments
#KT-35214 Fixed
2020-08-13 19:53:46 +03:00
Toshiaki Kameyama
efa981db36 "Create class from usage": add visibility to primary constructor if needed
#KT-29844 Fixed
2020-08-13 19:51:01 +03:00
Toshiaki Kameyama
b1e8238ea2 "Convert reference to lambda" intention: handle extension function reference with extension function call
#KT-35558 Fixed
2020-08-13 19:48:07 +03:00
Toshiaki Kameyama
9ff7539ff0 "Merge 'if's" intention: do not remove nested comments
#KT-33258 Fixed
#KT-39552 Fixed
2020-08-13 19:43:39 +03:00
Toshiaki Kameyama
f6e70cfed8 Wrap with let: fix it works correctly for invoking function type
#KT-39182 Fixed
2020-08-13 19:30:34 +03:00
Ilya Goncharov
babdeacdaf [Gradle, JS] Add resolution configuration method
^KT-41054 fixed
2020-08-13 18:04:44 +03:00
Ilya Goncharov
85f23d8c6e [Gradle, JS] Fix test with new API
^KT-41054 fixed
2020-08-13 18:04:44 +03:00
Ilya Goncharov
5eda8e95bf [Gradle, JS] Revert kotlinTargets
^KT-41054 fixed
2020-08-13 18:04:44 +03:00
Ilya Goncharov
855554ac38 [Gradle, JS] Move yarn resolutions from dependency constraints
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
fecda8548b [Gradle, JS] Override maven and ivy publishing aware context
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
58284c8b08 [Gradle, JS] Add yarn resolution gradle integration test
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
9df604cb3d [Gradle, JS] Migrate on set for npm ranges
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
1dd92f011c [Gradle, JS] Compare range lists as sets
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
50ccb522b9 [Gradle, JS] Add intersect tests
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
bd01ac52af [Gradle, JS] Add union test with fixed issue in union method
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
7aaa1cf556 [Gradle, JS] Add invert test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
9b8a64ef7b [Gradle, JS] Add hasIntersection test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
814c0b73e3 [Gradle, JS] Add doc into NpmRange
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
dc7d7135f8 [Gradle, JS] Add min start, max end, min end tests
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
c25bcb4028 [Gradle, JS] Add max start test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
42090e4839 [Gradle, JS] Add failing test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
d4524e4050 [Gradle, JS] Small refactoring
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
b95eb66032 [Gradle, JS] RejectAll => reject wildcard
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
d4c0d62eeb [Gradle, JS] Require version use caret
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
3ed42d394b [Gradle, JS] Support hyphenated range
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
a4de85da13 [Gradle, JS] Right wildcard range
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
f848b7cbeb [Gradle, JS] Right equals and hashCode for npm range
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
68880e6f47 [Gradle, JS] NpmRangeVisitor without nulls
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
7f3a2ac953 [Gradle, JS] Renames
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
fec8c6c0ae [Gradle, JS] Min and max are not nullable
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
966c9dae68 [Gradle, JS] Use not inverted visitor but straightforward visitor
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
9bb49ac370 [Gradle, JS] Union of Npm Ranges
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
14fac83e2b [Gradle, JS] Intersect of NpmRange
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
90bee78dda [Gradle, JS] None range instead of none version
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
f1b8c62231 [Gradle, JS] Use rejected versions
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
d232e2ceb3 [Gradle, JS] Add ANTLR visitor for inverting of npm versions
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
768b9a0340 [Gradle, JS] Use NpmVersionConstraint
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
bb569f36b1 [Gradle, JS] Implement reason and other methods beside version
^KT-41054 fixed
2020-08-13 18:04:39 +03:00
Ilya Goncharov
30f78847b1 [Gradle, JS] Not publish npm dependency constraints in metadata
^KT-41054 fixed
2020-08-13 18:04:39 +03:00
Ilya Goncharov
0473648b0e [Gradle, JS] Use gradle dependency constraints for yarn resolutions
^KT-41054 fixed
2020-08-13 18:04:39 +03:00
Roman Golyshev
7d883f1806 FIR Completion: Add idea-fir dependency to run completion tests
- Without this dependency, FIR plugin completion tests fail because the
fir completion contributor is not available
2020-08-13 17:29:45 +03:00
Ilmir Usmanov
31e4ddafd1 Minor. Add test with boolean parameter 2020-08-13 15:52:53 +02:00
Ilmir Usmanov
bcbb050326 Use fields for spilled variables for lambda parameters as well
In other words, do not generate p$ fields if we can use L$ fields,
which are being cleaned up.
 #KT-16222 Fixed
2020-08-13 15:52:51 +02:00
Ilya Goncharov
f5ab3a445f [Gradle, JS] Fix abstract task on default
^KT-40865 fixed
2020-08-13 15:39:02 +03:00
Yunir Salimzyanov
9ecf416a8a Parse multiple buildTypeIds for one bunch and synchronize muted tests
Cause: split Ide plugin tests in 4 parts
2020-08-13 12:57:09 +03:00
Mikhail Zarechenskiy
aafe41cf7a Do not force coercion to Unit for nullable lambda return type
#KT-41005 Fixed
2020-08-13 10:40:51 +03:00
Vyacheslav Gerasimov
d9bac4d5e4 Build: Warn about empty directories in sources 2020-08-12 21:40:04 +03:00
Vyacheslav Gerasimov
27578e6056 Build: Upgrade gradle to 6.6 2020-08-12 20:24:12 +03:00
Roman Golyshev
166b6db764 Make keyword lookup objects correctly comparable
- This is done to fix the problem with duplicated keyword items in
CodeWithMe plugin (see https://youtrack.jetbrains.com/issue/CWM-438)
2020-08-12 14:41:59 +00:00
Georgy Bronnikov
18ae665d41 IR: make IrCall take IrSimpleFunctionSymbol 2020-08-12 16:31:31 +03:00
Toshiaki Kameyama
4901cdb11f ConvertCallChainIntoSequence: support functions added in Kotlin 1.4
#KT-40448 Fixed
2020-08-12 16:28:29 +03:00
Toshiaki Kameyama
5e91ffb156 Move to class body: don't suggest on data class
#KT-40558 Fixed
2020-08-12 16:10:33 +03:00
Nick
28700ed64c [FIR] Supertype and inheritance checkers group 2020-08-12 15:38:29 +03:00
Oleg Ivanov
252eb1ad23 [FIR] Fix typo in FirDataFlowAnalyzer 2020-08-12 15:00:54 +03:00
Anton Yalyshev
e3bbc54e85 Add change-notes for 1.4 2020-08-12 14:36:47 +03:00
Oleg Ivanov
21b8679799 [FIR] Add ReturnsImplies effect analyzer 2020-08-12 11:06:07 +03:00
Oleg Ivanov
3454ae7ca4 [FIR] Add VariableStorage and flow on nodes into CFG reference 2020-08-12 11:06:07 +03:00
Oleg Ivanov
15598b62c9 [FIR] Add replaceControlFlowGraphReference function for FirFunction 2020-08-12 11:06:07 +03:00
Oleg Ivanov
7da94cc299 [FIR] Fix wrong ConstantReference for returnsNotNull in EffectExtractor 2020-08-12 11:06:07 +03:00
Anton Yalyshev
f6f3787b51 Disable FUS for Code Completion in 1.4.20 2020-08-12 10:22:29 +03:00
Andrey Uskov
20371b874a Configuration caching - register listener only once per project
To many listeners cause performance issues in Gradle.
2020-08-12 00:40:18 +03:00
Georgy Bronnikov
d2fda2a07c Fir2Ir: bug fix 2020-08-12 00:31:33 +03:00
Ilmir Usmanov
8a098545e6 Minor. Add test 2020-08-11 22:10:51 +02:00
Ilmir Usmanov
00bf07fc41 Force boxing kotlin.Result return type of suspend functions
#KT-40843 Fixed
2020-08-11 22:10:47 +02:00
Ilmir Usmanov
b06218c456 Minor. Update test data 2020-08-11 20:27:00 +02:00
Georgy Bronnikov
f21d8a4c5b JVM_IR, minor: use vals instead of objects 2020-08-11 18:44:47 +03:00
Vladimir Dolzhenko
6e016ce041 ktFile has to return script declaration from stub as well 2020-08-11 14:31:18 +00:00
Oleg Ivanov
4367d6631f [FIR] Add CallsInPlace contract analyzer 2020-08-11 16:17:01 +03:00
Oleg Ivanov
cc9c5b9e3c [FIR] Add CFG nodes, add multiple subGraphs for CFGOwner 2020-08-11 16:17:01 +03:00
Oleg Ivanov
128075e780 [FIR] Add fir source saving in resolved contract description 2020-08-11 16:17:01 +03:00
Oleg Ivanov
f467dccc68 [FIR] Rename confusing variable in CFGTraverser 2020-08-11 16:17:00 +03:00
Alexander Udalov
bcf1ee3907 Minor, fix test data for kotlinx.serialization bytecode text test 2020-08-11 15:14:06 +02:00
Steven Schäfer
53fe30eb45 JVM IR: Don't produce CHECKCASTs on null constants (KT-36650) 2020-08-11 15:13:40 +02:00
Alexander Udalov
7503f134c2 IR: use IdSignature to compare classes in FqNameEqualityChecker
This is both simpler and a lot more performant.
2020-08-11 14:41:57 +02:00
Alexander Udalov
36a1a65d98 IR: make IrBranch/IrCatch/IrSpreadElement/IrModuleFragment/IrPackageFragment classes 2020-08-11 14:41:57 +02:00
Alexander Udalov
08a35f0674 IR: make IrBody and subtypes classes 2020-08-11 14:41:57 +02:00
Alexander Udalov
4351f5235b IR: make IrExpression and subtypes classes 2020-08-11 14:41:56 +02:00
Alexander Udalov
ba7ff36274 IR: make IrDeclarationReference and subtypes classes 2020-08-11 14:41:56 +02:00
Alexander Udalov
ee904a975a IR: make IrMemberAccessExpression and subtypes classes
Merge IrMemberAccessExpressionBase into IrMemberAccessExpression, and
IrCallWithIndexedArgumentsBase into IrFunctionAccessExpression (extract
the latter into a separate file).
2020-08-11 14:41:56 +02:00
Alexander Udalov
fde7314aaf IR: do not inherit IrExpressionWithCopy from IrExpression 2020-08-11 14:41:55 +02:00
Alexander Udalov
9aa7da44e2 IR: remove IrTerminalExpressionBase, Ir{Terminal,}DeclarationReferenceBase
Implement no-op acceptChildren/transformChildren in the base class
IrExpressionBase instead. This doesn't change behavior because all other
implementations of acceptChildren/transformChildren are not affected.
2020-08-11 14:41:55 +02:00
Alexander Udalov
868018f51f IR: do not inherit IrFunctionReferenceImpl from IrCallWithIndexedArgumentsBase 2020-08-11 14:41:55 +02:00
Alexander Udalov
e3dfd5fb49 IR: push down implementations of startOffset/endOffset/type/...
Do not store these as properties in IrElementBase, IrExpressionBase and
similar classes. This helps to reduce boilerplate in implementations
(just "override val" in the constructor, instead of taking a parameter
and passing it to the superclass), and also slightly optimizes memory in
cases where the value is trivial (UNDEFINED_OFFSET, 0, etc) and thus
does not need to be stored.
2020-08-11 14:41:54 +02:00
Roman Golyshev
03f804b1c5 FIR Completion: Move completion files to idea-fir module 2020-08-11 15:38:07 +03:00
Ilmir Usmanov
d861373c6d Hack attributes for continuation of suspend function in SAM-adapter 2020-08-11 11:58:20 +02:00
Mikhail Zarechenskiy
2e131b870a Add tests for obsolete issues
#KT-38804 Obsolete
 #KT-38801 Obsolete
 #KT-38835 Obsolete
 #KT-38737 Obsolete
 #KT-38664 Obsolete
 #KT-38549 Obsolete
 #KT-38766 Obsolete
 #KT-38714 Obsolete
2020-08-11 12:34:02 +03:00
Georgy Bronnikov
7f4df19dd1 JVM_IR: reorganize throw... functions in Symbols 2020-08-11 10:54:29 +03:00
Denis Zharkov
6a16d6a246 FIR: Simplify delegating constructors call resolution 2020-08-11 10:14:02 +03:00
Denis Zharkov
8b71f5e558 FIR: Do not leave cyclic upper bounds of type parameters 2020-08-11 10:14:02 +03:00
Denis Zharkov
a5a93d00a7 FIR: Rework delegation constructor calls resolution
Make it work independently of being called for inner class (as in FE 1.0)
2020-08-11 10:14:02 +03:00
Denis Zharkov
db93b9052b FIR: Fix incorrect optimization for integer literals 2020-08-11 10:14:02 +03:00
Vyacheslav Gerasimov
ad8709b2dc Build: Remove exclusion of kotlinx-coroutines-core in scripting-common
It breaks available-at feature used in MPP
2020-08-11 00:39:04 +03:00
Vladimir Dolzhenko
8540f47c15 Fixed FindUsages case on look up implementation getter/setters via property names
#KT-40788 Fixed
#KT-24616 Fixed

back-port from kotlin-ide commit aa5580bb5a7e96b209cdaa1c82f4e485ee001ae8
2020-08-10 22:04:06 +02:00
Mikhail Zarechenskiy
e49cdf0ca2 Prohibit using suspend functions as SAM in fun interfaces
#KT-40978 Fixed
2020-08-10 22:04:16 +03:00
Mikhael Bogdanov
607f99ed3c Don't generate implicit overrides delegating to Java defaults
#KT-40920 Fixed
2020-08-10 20:03:23 +02:00
Sergey Igushkin
07aee8831e Fix stdlib-by-default with non-compiled source sets (KT-40559)
When a `variantFilter { ... }` is used in Android projects, AGP does not
creates some variants but still creates the source sets which would be
related to those variants.

For source sets that are not included into any compilation, the stdlib
module added by default was kotlin-stdlib-common, and it was added to
the `api` scope.

But AGP checks the `androidTest*Api` configurations and
if it detects any dependencies in them, it reports deprecation warnings.

However, we have plans to prohibit unused source sets at all as they
have no reasonable use cases. So the fix is not to add the stdlib by
default to source sets that participate in no compilations.

Issue #KT-40559 Fixed
2020-08-10 20:08:22 +04:00
Roman Golyshev
6e2887e083 FIR Completion: Add insertion handling for functions with lambdas
- The support is not complete
2020-08-10 18:25:34 +03:00
Roman Golyshev
b3a674abee FIR IDE: Add parameter's and type's properties required for completion 2020-08-10 18:25:34 +03:00
Roman Golyshev
67ed33367f FIR Completion: Add function insert handler
- It is a specialized copy from `KotlinFunctionInsertHandler.Normal`
2020-08-10 18:25:34 +03:00
Roman Golyshev
b547feb00d FIR Completion: Render vararg modifier in lookups 2020-08-10 18:25:33 +03:00
Roman Golyshev
582b00f5b2 FIR Completion: Add UniqueLookupElement to the lookup elements
- It is done to differentiate overloads of the same function
2020-08-10 18:25:33 +03:00
Roman Golyshev
b6ee478190 FIR Completion: Add psi element to the lookups
- May be a performance problem later
2020-08-10 18:25:33 +03:00
Roman Golyshev
53180e707e FIR Completion: Fix invalid isAbstract condition 2020-08-10 18:25:33 +03:00
Roman Golyshev
ef461260b0 FIR Completion: Add simple insertion handler to lookup elements
- The `QuotedNamesAwareInsertionHandler` is just a copy of
`BaseDeclarationInsertHandler`
2020-08-10 18:25:33 +03:00
Roman Golyshev
10598ee98e FIR Completion: Add simple lookup decorating with icon and parameters 2020-08-10 18:25:32 +03:00
Roman Golyshev
64187b40c9 FIR Completion: Prevent immediate completion in number literals
- This is copied from the original KotlinCompletionContributor
2020-08-10 18:25:32 +03:00
Alexey Trilis
d86c14243e Add @SinceKotlin to kotlinx.browser and kotlinx.dom packages
Add @DeprecatedSinceKotlin to kotlin.browser and kotlin.dom packages
2020-08-10 18:08:19 +03:00
Dmitriy Novozhilov
0e53d11dd4 Disable AllowResultInReturnType feature
#KT-40843
2020-08-10 17:57:53 +03:00
Valeriy.Vyrva
30ff886754 Improve docs for createTempDir/createTempFile
#KT-35218
2020-08-10 17:29:25 +03:00
Vladimir Ilmov
4fe6880489 Cyrillic 'c' fix in inspectionLikeProcessings.kt 2020-08-10 14:42:46 +02:00
Nick
0a2f113a24 [FIR] Fix slow string conversions in FirEffectiveVisibilityResolver 2020-08-10 13:46:15 +03:00
Alexander Dudinsky
e67518c349 Update gradle plugin version in GradleFacetImportTest
Also drop legacy tests for 1_1_2
2020-08-10 13:14:01 +03:00
Pavel Kirpichenkov
f431da2a66 Reapply "Introduce @FrontendInternals annotation""
This reverts commit 9ca4717d11.
^KT-39643 Fixed
2020-08-10 12:22:55 +03:00
Yan Zhulanow
5e8e60a399 Move back the 'KotlinStructureViewElement.isPublic' property used externally
Reasoning: Method com.gmail.blueboxware.extsee.kotlin.ExtSeeKotlinStructureViewModel.Companion.PublicElementsFilter.isVisible(com.intellij.ide.util.treeView.smartTree.TreeElement treeNode) : boolean contains an *invokevirtual* instruction referencing an unresolved method org.jetbrains.kotlin.idea.structureView.KotlinStructureViewElement.isPublic()
2020-08-10 18:18:37 +09:00
Alexander Dudinsky
aec87744f2 Run ImportAndCheckNavigation tests only vs the master version of plugin
Also error "Could not find org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable"
was fixed by adding ":native:kotlin-klib-commonizer-embeddable:install"
in dependencies for the kotlin-plugin install
2020-08-10 12:13:21 +03:00
Alexander Dudinsky
2042db598a Mute GradleNativeLibrariesInIDENamingTest.testLibrariesNaming in 192, 193
After updating version of gradle-plugin this tests started to fail on
the old version of IDE. After discussion we decided just mute it in
the old bunches
2020-08-10 12:04:51 +03:00
Sergey Igushkin
988480d649 Fix source JARs missing in Kotlin/Native targets with HMPP (KT-39051)
With HMPP, a separate implementation of `kotlinComponents` is used which
accidentally ignored the parent's logic for source artifacts.

As a simple fix, copy the parent's logic for source artifacts.

Issue #KT-39051 Fixed
2020-08-10 13:02:17 +04:00
Nataliya Valtman
a766369e72 KT-33908 Make Kotlin Gradle plugin compatible with configuration cache
#KT-33908 Fixed
2020-08-10 11:17:30 +03:00
Georgy Bronnikov
ea57b4cccb IR: add and unmute tests 2020-08-10 10:16:24 +03:00
Georgy Bronnikov
85ba170217 JVM_IR: use IrBasedDescriptors across codegen 2020-08-10 10:16:23 +03:00
Georgy Bronnikov
0b4c43083d IR: add IrBasedDescriptors 2020-08-10 10:16:23 +03:00
Georgy Bronnikov
dafcdc527d IR: propagate original declaration info via attributeOwnerId
For IrProperty, IrSimpleFunction we need to pass information about
original declaration to JVM_IR codegen. Instead of descriptors, use
the attributeOwnerId field.
2020-08-10 10:16:23 +03:00
Georgy Bronnikov
04d93dfbce IR: move containerSource from descriptor to IrFunction, IrProperty 2020-08-10 10:16:23 +03:00
Nick
4669e019d1 [FIR] Add diagnostic CONFLICTING_OVERLOADS & REDECLARATION 2020-08-10 10:09:37 +03:00
kvirolainen
36984009e9 Add samples for flatten, unzip functions 2020-08-10 03:40:13 +03:00
Elijah Verdoorn
41d5615608 Add samples for mapNotNull, find, getOrNull functions 2020-08-10 03:39:49 +03:00
Ilya Kirillov
62df2b3195 FIR IDE: run SUPER_TYPES & BODY_RESOLVE phases under global lock 2020-08-09 12:05:20 +03:00
Ilya Kirillov
7fb408ecd7 FIR IDE: enable new project wizard to FIR IDE 2020-08-09 12:05:13 +03:00
Ilya Kirillov
db7119f04d FIR IDE: fix ability to create new Kotlin files 2020-08-09 12:05:11 +03:00
Ilya Kirillov
054d196ec5 FIR IDE: temporary ignore failing tests 2020-08-09 12:05:02 +03:00
Ilya Kirillov
683ec2beff FIR IDE: make KtScopeProvider thread local 2020-08-09 12:04:53 +03:00
Ilya Kirillov
f62204fff1 FIR: move getCallableNames/getClassifierNames from scope to FirContainingNamesAwareScope 2020-08-09 12:04:52 +03:00
Ilya Kirillov
36a161080f FIR IDE: introduce KtType rendering 2020-08-09 12:04:44 +03:00
Ilya Kirillov
9f33d0147c FIR IDE: add info about nullability to KtType 2020-08-09 12:04:43 +03:00
Ilya Kirillov
16d22ae7e3 FIR IDE: correctly build FIR for qualified expressions 2020-08-09 12:04:43 +03:00
Ilya Kirillov
66f6fe18d6 FIR IDE: replace javax threadsafe annotations with custom ones
javax.annotation.concurrent may not be present for some JDKs
2020-08-09 12:04:35 +03:00
Ilya Kirillov
4595ee2cc0 FIR IDE: create read only copy of symbol builder only for completion 2020-08-09 12:04:34 +03:00
Ilya Kirillov
ccf232eaab FIR IDE: forbid analysis session to be stored in a variable 2020-08-09 12:04:34 +03:00
Ilya Kirillov
b41a5f9f34 FIR: make TypeRegistry thread safe 2020-08-09 12:04:26 +03:00
Ilya Kirillov
5f424ed1ec FIR IDE: rewrite low level API
- Cache ModuleResolveState for module till the world changes
- Resolve every file under a lock
- All creation of raw fir files and resolve of them happens in FirFileBuilder
- Lazy resolve of fir elements happens in FirElementBuilder

Caching works like the following:
- FirModuleResolveState holds PsiToFirCache & DiagnosticsCollector & FileCacheForModuleProvider
- FileCacheForModuleProvider holds a mapping from ModuleInfo to ModuleFileCache
- ModuleFileCache caches
    - KtFile -> FirFile mapping
    - ClassId -> FirClassLikeDeclaration, CallableId -> FirCallableSymbol
        which used in corresponding FirProvider
    - mapping from declaration to it's file
        which used in corresponding FirProvider
    - locks for fir file resolving
- PsiToFirCache provides mapping from KtElement to  FirElement
- DiagnosticsCollector collects diagnostics for file and caches them
2020-08-09 12:04:11 +03:00
Ilya Kirillov
1957be8757 FIR IDE: fix testdata of tests which now pass 2020-08-09 12:04:03 +03:00
Ilya Kirillov
34aa848b15 FIR: do not allow getting PSI text in RawFirBuilder in stub mode 2020-08-09 12:04:03 +03:00
Ilya Kirillov
cfc46b0cc8 FIR IDE: introduce FirIdeAllSourceDependenciesSymbolProvider
Co-authored-by: Simon Ogorodnik <simon.ogorodnik@jetbrains.com>
2020-08-09 12:03:56 +03:00
Ilya Kirillov
7d8ef5c7a2 FIR IDE: introduce KtFirConstructorDelegationReference 2020-08-09 12:03:54 +03:00
Ilya Kirillov
0870ded054 FIR IDE: introduce KtFirArrayAccessReference 2020-08-09 12:03:47 +03:00
Ilya Kirillov
22054c8507 FIR IDE: use non-fake override fir elements when finding psi for fir 2020-08-09 12:03:40 +03:00
Ilya Kirillov
d10e3f91fa FIR IDE: store FirScope strong references only in KtFirAnalysisSession 2020-08-09 12:03:33 +03:00
Ilya Kirillov
7033be588c FIR IDE: regenerate member scope test 2020-08-09 12:03:27 +03:00
Ilya Kirillov
ea3b2d8310 KT IDE: fix fully-qualified type resolving 2020-08-09 12:03:26 +03:00
Ilya Kirillov
50951fdfc3 KT IDE: use proper package symbol PSI to fix invalidated access exception 2020-08-09 12:03:14 +03:00
Ilya Kirillov
9f9ce6ba61 Fix compilation of KtFirDelegatingScope 2020-08-09 12:03:07 +03:00
Ilya Kirillov
1c195ea2bb FIR IDE: add kdoc for KtAnalysisSession 2020-08-09 12:03:07 +03:00
Ilya Kirillov
b8caefa0c4 FIR IDE: always recreate analysis session in tests to avoid breaking its contract 2020-08-09 12:03:06 +03:00
Ilya Kirillov
19efd19c6c FIR IDE: fix AbstractSymbolByFqNameTest after rebase 2020-08-09 12:03:01 +03:00
Ilya Kirillov
94b62e2ac6 FIR IDE: make context-dependent analysis session to use original cache on read-only mode 2020-08-09 12:03:00 +03:00
Ilya Kirillov
c0f5c90231 FIR IDE: separate ValidityOwner to ValidityTokenOwner & ValidityToken 2020-08-09 12:02:49 +03:00
Ilya Kirillov
6a6580dd97 FIR IDE: introduce KtConstructorSymbol.ownerClassId
Will be needed for completion
2020-08-09 12:02:48 +03:00
Ilya Kirillov
4653cdf794 FIR IDE: make KtFirDelegatingScope caching a thread safe 2020-08-09 12:02:42 +03:00
Roman Golyshev
ebf20c9706 Add multi-file tests for primitive completion
- This is required to test/debug correct completion from imports
2020-08-09 12:02:40 +03:00
Roman Golyshev
1b3a1a662f Add simple completion of class-like symbols 2020-08-09 12:02:34 +03:00
Roman Golyshev
20c627ea47 Implement collecting class-like names in KtFirStarImportingScope 2020-08-09 12:02:28 +03:00
Roman Golyshev
29ee233bb9 Remove repeating scopes collected by buildCompletionContextForFunction
- This is certainly a bug, we would have to fix it later
2020-08-09 12:02:27 +03:00
Roman Golyshev
e3778d62e3 Simplify canBeCalledWith function 2020-08-09 12:02:21 +03:00
Roman Golyshev
b90503decb Move PackageIndexHelper to KtFirStarImportingScope.kt 2020-08-09 12:02:16 +03:00
Roman Golyshev
d2fbd8e338 Remove KotlinFirCompletionProvider
- We should strive to use only high-level API for completion from now on
2020-08-09 12:02:16 +03:00
Ilya Kirillov
dee58e1d86 FIR IDE: handle importing scopes in completion in HL API
Co-authored-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2020-08-09 12:02:11 +03:00
Ilya Kirillov
7aa26944d7 FIR IDE: rename utils.kt to psiUtils.kt
Co-authored-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2020-08-09 12:02:00 +03:00
Ilya Kirillov
902b42ae1d FIR IDE: fix typo in completion testdata
Co-authored-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2020-08-09 12:01:59 +03:00
Roman Golyshev
c3a3ab9e89 Implement the completion using high-level API only
- The indecies are not yet used

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:59 +03:00
Roman Golyshev
a6dd84a7e4 FIR IDE: Modify KtFirAnalysisSession for completion
- This is WIP solution for having a specialized `KtFirAnalysisSession`
for the completion

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:54 +03:00
Roman Golyshev
54946a793a Fix FirCompletionContext for safe access elements
- `towerDataContextForStatement` may contain safe access (?.) fir
elements as keys; however, `state.getCachedMapping(current)` would
never return those since they are considered as sugar fir elements

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:49 +03:00
Roman Golyshev
a2cf01162e Fix bug with member extensions with explicit receiver
Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:48 +03:00
Roman Golyshev
df03e31b86 FIR IDE: Add KtCallableSymbol abstraction
- It should incapsulate callable symbols like functions, properties
and constructors

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:44 +03:00
Roman Golyshev
a4a2d92c08 FIR IDE: Make KtFirReference implement KtSymbolBasedReference
Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:35 +03:00
Roman Golyshev
2eb439899e Use index to get symbols from importing scopes 2020-08-09 12:01:25 +03:00
Dmitriy Novozhilov
cefecdef25 fixup! Iterate on symbols, not on scopes 2020-08-09 12:01:23 +03:00
Roman Golyshev
e7f5594ffe Use more correct check for the constructor symbol
- add test for extension function receiver
2020-08-09 12:01:23 +03:00
Roman Golyshev
a3da1ea1a0 Iterate on symbols, not on scopes
- This way it is easier to get the correct results
2020-08-09 12:01:15 +03:00
Roman Golyshev
708c54f4d2 Refactor the collecting of callable symbols from scopes 2020-08-09 12:01:07 +03:00
Roman Golyshev
81f60bf252 Add test for smartcast 2020-08-09 12:01:07 +03:00
Roman Golyshev
ffb907150a Use information about receivers in completion
- Found few problems during resolving a single functon; disabled
assertions and marked them with TODO
- Add simple completion tests to simplify development
2020-08-09 12:01:00 +03:00
Roman Golyshev
0f5fc1fa99 Add FirSymbolProvider::getAllCallableNamesInPackage function
- Also, fix implementation of `getCallableNames` in few cases
2020-08-09 12:00:59 +03:00
Denis Zharkov
97d4918ed3 Expose local scopes to use in completion 2020-08-09 12:00:52 +03:00
Roman Golyshev
6129f4bcef Partial raw FIR building 2020-08-09 12:00:45 +03:00
Roman Golyshev
a1b621d987 Completion with FIR (prototype, work-in-progress) 2020-08-09 12:00:44 +03:00
Ilya Kirillov
2a495c1135 FIR IDE: introduce composite scopes 2020-08-09 12:00:38 +03:00
Ilya Kirillov
9092b33755 FIR IDE: Introduce module resolve state for completion 2020-08-09 12:00:31 +03:00
Ilya Kirillov
1d92fbaa7f FIR IDE: correctly set symbol origin for fake overridden ones 2020-08-09 12:00:24 +03:00
Ilya Kirillov
88548d988a FIR IDE: implement getCallableNames/getClassifierNames in more scopes 2020-08-09 12:00:18 +03:00
Ilya Kirillov
138f11ee27 FIR IDE: introduce member scope tests 2020-08-09 12:00:11 +03:00
Ilya Kirillov
f709e6acf3 FIR IDE: introduce scopes for HL API 2020-08-09 12:00:05 +03:00
Dmitriy Novozhilov
6596dc359b fixup! Completion with FIR (prototype, work-in-progress) 2020-08-09 12:00:04 +03:00
Ilya Kirillov
d62500531b FIR: add getClassifierNames for FirScope 2020-08-09 11:59:57 +03:00
Roman Golyshev
656086f90a Add FirScope::getCallableNames function 2020-08-09 11:59:50 +03:00
Ilya Kirillov
1f3add49f4 FIR IDE: move trailing comma related registry keys to ide-frontend-independent.xml 2020-08-09 11:59:49 +03:00
Ilya Kirillov
055b975699 FIR IDE: add tests which failing with exceptions inside FIR 2020-08-09 11:59:49 +03:00
Ilya Kirillov
9cf4fdfb71 FIR IDE: add reference info on reference resolve 2020-08-09 11:59:44 +03:00
Ilya Kirillov
5c6d636d02 Minor: reformat fir ide part of GenerateTests.kt 2020-08-09 11:59:38 +03:00
Ilya Kirillov
45e01a8b3d FIR IDE: precalculate DuplicatedFirSourceElementsException error message
It may be called from non-read action
2020-08-09 11:59:33 +03:00
Ilya Kirillov
964becf138 FIR IDE: allow the same entity to be accessed from different threads 2020-08-09 11:59:23 +03:00
Ilya Kirillov
4c08dfb238 Add invoke reference resolve test without errors in test data 2020-08-09 11:59:17 +03:00
Ilya Kirillov
15ecfd84b4 FIR IDE: cache KtAnalysisSession for modules 2020-08-09 11:59:15 +03:00
Ilya Kirillov
8c0197e081 FIR IDE: introduce KtAnalysisSessionProvider & helping functions for working with analysis session 2020-08-09 11:59:10 +03:00
Ilya Kirillov
acb8546583 FIR IDE: fix ReadOnlyWeakRef error message 2020-08-09 11:59:05 +03:00
Ilya Kirillov
b09358fe17 FIR IDE: rename KtFieldSymbol -> KtFirJavaFieldSymbol 2020-08-09 11:59:04 +03:00
Ilya Kirillov
f98ff2c25e FIR IDE: always pass resolve state as parameter when getting fir by psi 2020-08-09 11:59:04 +03:00
Mikhail Zarechenskiy
0c13a7f89a Fix accessibility check for experimental declarations from default scope
#KT-40919 Fixed
2020-08-07 17:49:15 +03:00
Ilmir Usmanov
b403b63f48 Ease field initialization check
Since there is already VAL_REASSIGNMENT diagnostics, we can safely only
for direct assignments.
 #KT-40893 Fixed
2020-08-07 14:22:18 +02:00
Nick
6c0abe7e48 [FIR] Fix CliTestGenerated$Jvm.testFirError 2020-08-07 13:27:29 +03:00
Pavel Kirpichenkov
9ca4717d11 Revert "Introduce @FrontendInternals annotation"
Revert due to Mobile IDE Trunk IJ TC configuration
This reverts commits:
ffc3d8bdfc
c0e713980b

^KT-39643 In Progress
2020-08-07 12:10:03 +03:00
Mads Ager
7f2efabe6a [JVM_IR]: Improve stepping for when.
Additionally, use the line number of the class for default interface
dispatch methods.
2020-08-07 09:16:01 +02:00
Dat Trieu
1009a240f2 KT-20357: Add samples for filter functions 2020-08-06 23:41:12 +03:00
Steven Schäfer
ca6e430e89 JVM IR: Handle nested classes in DelegatedPropertyOptimizer 2020-08-06 21:01:59 +02:00
Steven Schäfer
da9bff40f0 JVM IR: Don't remove stores to visible locals in DelegatedPropertyOptimizer 2020-08-06 21:01:59 +02:00
Ilya Kirillov
983c84d6a6 Wizard: fix default template compilation when using JS IR
#KT-39904 fixed
2020-08-06 21:46:50 +03:00
Alexander Udalov
e4cd7cdbcf IR: remove unused code, cleanup 2020-08-06 17:08:04 +02:00
Alexander Udalov
b30b2e0179 IR: minor, render duplicate IR node in checker 2020-08-06 17:08:04 +02:00
Alexander Udalov
8db1c3611b IR: introduce abstract class IrDeclarationBase
The main purpose of this class is to improve performance of IR visitors
and transformers. `IrElementVisitor.visitDeclaration` now takes
IrDeclarationBase as a parameter, and therefore the call to `accept`
there is now a virtual class call, instead of an interface call.
2020-08-06 17:08:04 +02:00
Alexander Udalov
771e7574f4 IR: make subtypes of IrDeclaration classes 2020-08-06 17:08:03 +02:00
Alexander Udalov
3cecf81176 IR: transform base classes of lazy IR to interfaces 2020-08-06 17:08:02 +02:00
Alexander Udalov
b02653a524 IR: remove base classes IrDeclarationBase and IrFunctionBase
They introduce a diamond class hierarchy which prevents IR element
hierarchy from being transformed to classes.
2020-08-06 16:46:26 +02:00
Alexander Udalov
9152df4702 PIR: transform base implementation classes to interfaces
Unfortunately this requires a lot of boilerplate, but is a requirement
for transforming the main IR element hierarchy interfaces
(IrDeclaration, IrClass, ...) to classes.
2020-08-06 16:46:26 +02:00
Ilya Goncharov
13766d5075 [Gradle, JS] Update test data
^KT-40884 fixed
2020-08-06 15:33:21 +03:00
Ilya Goncharov
52110a08d9 [Gradle, JS] Update versions
^KT-40884 fixed
2020-08-06 15:33:06 +03:00
Sergey Igushkin
f6356199d3 Fix typealias usage nullability and annotations lost in deserialization
Issue #KT-40824 Fixed
2020-08-06 15:46:54 +04:00
Alexander Dudinsky
4063aba677 Remade launch of NativeRunConfigurationTest against master version of gradle plugin 2020-08-06 14:06:05 +03:00
Konstantin Tskhovrebov
69ce6bd952 Add tests for setup native run gutters. 2020-08-06 14:06:04 +03:00
Sergey Igushkin
b5d4e4c44c Enable compatibility metadata variant by default in HMPP
This by default ensures that libraries published with HMPP are
compatible with non-HMPP consumers (which is the default in 1.4.0).
2020-08-06 14:08:51 +04:00
Mikhail Zarechenskiy
2eb17df962 Do not compute SamType too eagerly as it can force member resolution
Internally, during creation of `SamType` the compiler checks if a
 parameter is really can be used as a SAM, so this check involves
 lookup for abstract members, which can force additional computation of
 member scopes. This is totally fine for BE but it can be dangerous
 for light classes computation when not all scopes are processed.

 Note that this issue appeared quite recently after 16f175612e

 #KT-40869 Fixed
2020-08-06 09:20:56 +03:00
Vladimir Dolzhenko
6ec0e9546b Fix 192 compilation for UI for standalone gradle scripts
Relates to #KT-39790
2020-08-05 23:39:34 +02:00
Konstantin Tskhovrebov
66c1bd8c89 Revert "Update KMM plugin user texts."
This reverts commit 5edbc75d
2020-08-05 21:54:01 +03:00
Pavel Kirpichenkov
c0e713980b Add helpers for getting commonly used services without an opt-in
These services are LanguageVersionSettings, DataFlowValueFactory
#KT-39643 Fixed
2020-08-05 21:44:47 +03:00
Pavel Kirpichenkov
ffc3d8bdfc Introduce @FrontendInternals annotation
#KT-39643
2020-08-05 21:44:47 +03:00
Sergey Igushkin
eff5839369 "Kotlin Multiplatform Projects are an ~experimental~ Alpha feature." 2020-08-05 22:01:12 +04:00
Ilmir Usmanov
6c475e614a Minor. Update debugger tests 2020-08-05 19:47:55 +02:00
Ilmir Usmanov
68342a1f72 Initialize fake inliner variables on resume path
Otherwise, this will cause R8 to complain.
2020-08-05 19:47:55 +02:00
Ilmir Usmanov
bb5a99ec18 Do not put $completion to LVT if is dead 2020-08-05 19:47:54 +02:00
Florian Kistner
9925866293 203: Fix compilation 2020-08-05 19:36:43 +02:00
Florian Kistner
c792092410 Bump fastutil version to match 203 2020-08-05 19:36:42 +02:00
Nikita Bobko
c5398e8317 Move 'radixPrefix' from compiler modules to IDE modules
`radixPrefix` is used only in IDE now. So let's put it into IDE modules.

This commit is done in order to be able to use code dependent on
`radixPrefix` in `kotlin-ide` repo, because `kotlin-ide` depends on
1.4.0 artifacts of compiler. And `radixPrefix` isn't presented in
those artifacts
2020-08-05 20:17:17 +03:00
Sergey Igushkin
093d4b3108 Revert "Fix typealias usage nullability and annotations lost in deserialization"
This reverts commit 070848a1
2020-08-05 20:17:49 +04:00
Konstantin Tskhovrebov
5edbc75d7b Update KMM plugin user texts.
#Fixed KMM-324
2020-08-05 18:37:27 +03:00
Jinseong Jeon
b57794d96e IR util: IrExpression.isSafeToUseWithoutCopying 2020-08-05 17:07:27 +03:00
Jinseong Jeon
7ef1c74bbf FIR2IR: apply adapted reference conversion to coercion-to-unit 2020-08-05 17:07:27 +03:00
Mikhail Glukhikh
5f80bfd5d4 [FIR] Don't report UNINITIALIZED_VARIABLE on lateinit local variable 2020-08-05 16:47:51 +03:00
Natalia Selezneva
54d96a2dd7 UI for standalone gradle scripts
^KT-39790 Fixed
2020-08-05 15:22:22 +02:00
Mikhail Glukhikh
fc874e72b1 [FIR2IR] Initialize components a bit earlier to prevent lateinit errors 2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
17b289fa00 [FIR] Code cleanup: get rid of FirClass.buildUseSiteMemberScope() 2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
8bb5488a26 [FIR] look at intersectionOverride during override processing
This commit fixes some BB tests broken by previous commit
2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
f1356a809e Fir2IrLazySimpleFunction: generate overridden symbols via FirTypeScope 2020-08-05 12:11:33 +03:00
Alexander Dudinsky
52c01abb83 Increase Xmx size after investigation OOM problem in KMM-316 2020-08-05 10:45:16 +03:00
Alexander Dudinsky
d012cd3272 Add kotlin-test-junit:install in dependencies for the kotlin-plugin install 2020-08-05 10:45:16 +03:00
Alexander Dudinsky
ea0099aa39 Fix testPlatformToCommonExpByInComposite.
In 9d362875da build started fail if mpp
or js targets not configured.
The test testPlatformToCommonExpByInComposite was fixed due it.
2020-08-05 10:45:16 +03:00
Alexander Dudinsky
05d6217f78 Changed gradle-plugin version in Gradle tests.
When 6.5.1 Gradle version was added, more tests have began to fail
because of legacy gradle-plugin versions (1.1., 1.2.) which are not
compatible with the new version of Gradle. This commit updates the used
version of the Gradle plugin to the latest stable (1.3.72) and makes it
configurable from tests.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
6652a7072c Fix testData due to KT-40551.
Starting from version 1.3.60, unnecessary dependencies with runtime
scopes have been added for modules jvmTest and jsTest. After updating
the plugin version in tests from 1.3.50 to 1.3.72 and master,
tests began to fail because of this. In order not to stop other checks
in tests, they were redone for the current behavior with unnecessary
dependencies.
After fixing bug KT-40551, the old behavior in tests will be returned.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
0298795b18 Add gradle.properties with kotlin.stdlib.default.dependency=false for tests
In the master version of plugin dependencies on stdlibs are enabled
by default. It is not expected for some tests.
Flag kotlin.stdlib.default.dependency=false fixed it.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
bc623e97ec Add Gradle version 6.5.1 for tests. 2020-08-05 10:45:15 +03:00
Alexander Dudinsky
1da05c54be Change gradle-plugin versions for tests from 1.3.50 to 1.3.72 2020-08-05 10:45:14 +03:00
Nick
f15f5bccc8 [FIR] Add more diagnostic messages 2020-08-05 10:41:06 +03:00
Victor Petukhov
f45de9d8fb NI: approximate not top-level captured types during code generation
^KT-40693 Fixed
2020-08-05 10:36:36 +03:00
Ilya Matveev
f6d7e7c52a CocoaPods: Fix setting custom framework name
The main scheme of a synthetic project generated for
pod import has the same name as the podspec generated
for the kotlin module (== Gradle project name). But
when starting an Xcode build, we specify the -scheme
argument to a framework name instead of project.name.

By default they are the same, but if a custom framework
name is specified, xcodebuild fails.

Issue #KT-40801 fixed
2020-08-05 06:46:53 +00:00
Mikhail Zarechenskiy
a45f73867a Add compatibility resolve when SAM conversion was applied partially
#KT-40646 Fixed
2020-08-05 00:03:33 +03:00
Sergey Igushkin
070848a1c1 Fix typealias usage nullability and annotations lost in deserialization
This fixes a regression introduced by the commit 4b0da0688a which made
deserializer expand typealiases but didn't take nullability and use site
annotations into account.

Issue #KT-40824 Fixed
2020-08-05 00:19:52 +04:00
Nick
ec4f04095c [FIR] Rearrange FirErrors.kt 2020-08-04 22:40:09 +03:00
Nick
207027b84c [FIR] Fix light tree's supertype FirDelegatedConstructorCall source 2020-08-04 22:37:43 +03:00
Nick
a59cedcd39 [FIR] Fix non-fake sources for constructor delegates 2020-08-04 22:37:42 +03:00
Nick
f74eb07203 [FIR] Fix incorrect diagnostic behaviour + several enum diagnostics 2020-08-04 22:28:49 +03:00
Nick
b76f757d47 [FIR] Add diagnostic for missing primary constructor 2020-08-04 22:28:49 +03:00
Nick
0f213e58db [FIR] Add diagnostic for primary constructor not called 2020-08-04 22:28:48 +03:00
Nick
bb0e1b7390 [FIR] Add diagnostic for constructor delegation cycles 2020-08-04 22:28:48 +03:00
Mikhail Glukhikh
e841b3a77b [FIR] Add diagnostic collection to KotlinToJVMBytecodeCompiler 2020-08-04 22:27:18 +03:00
Mikhail Glukhikh
9c3b8484b9 [FIR TEST] Add CLI test with should-be-error (not yet) 2020-08-04 22:27:18 +03:00
Ilmir Usmanov
824991a9dd Minor. Add tests. 2020-08-04 15:42:38 +02:00
Ilmir Usmanov
bbd4c21595 Cleanup spilled variables
#KT-16222
2020-08-04 15:42:37 +02:00
Ilmir Usmanov
999b41068b Minor. Refactor variables spilling
Split information collection and method node mutation.
2020-08-04 15:42:37 +02:00
Ilmir Usmanov
405c9743ef Do not spill dispatch receiver of suspend functions if it is not used
#KT-20571
2020-08-04 15:42:36 +02:00
Jinseong Jeon
5db7957230 FIR2IR: use type arguments from fully expanded type 2020-08-04 14:44:38 +03:00
Ilya Kirillov
606dc2f723 Fix binary compatibility problems in ImportInsertHelper & ShortenReferences 2020-08-04 12:46:13 +03:00
Victor Petukhov
af48f08f9c NI: take into account flexible types during capturing arguments from expression
^KT-40544 Fixed
2020-08-04 12:38:04 +03:00
vldf
65ebd02a39 [FIR] Fix for CanBeReplacedWithOperatorAssignment Checker 2020-08-04 11:20:42 +03:00
Mikhail Glukhikh
6f3df6faf4 [FIR] Regenerate extended checker tests 2020-08-04 09:35:36 +03:00
Mikhail Glukhikh
181a8bb79e [FIR TEST] Mute failing BB test with Byte/Short.and usage 2020-08-04 08:59:16 +03:00
Jinseong Jeon
47c47be3d3 FIR serializer: serialize annotations on FirTypeRef, not ConeKotlinType 2020-08-04 08:59:16 +03:00
Ivan Kylchik
0a28e5e031 Add argument unwrapping for case when argument is named 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
2e2099afae [FIR] Introduce NOT_AN_ANNOTATION_CLASS diagnostic 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
8fd087a964 [FIR] Don't report duplicated UNRESOLVED_REFERENCE on annotation entries 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
a6e811a67a [FIR] Add status to Java annotation constructor (fix after rebase) 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
8379b3794a [FIR2IR] Return fallback mode for annotation resolved placeholder 2020-08-04 08:59:15 +03:00
Dmitriy Novozhilov
b63257345b [FIR] Map Class to KClass in java annotations 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
282a295d43 [FIR] Enable arrayOf transformer in completion (inside annotations) 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
721b9b4d8c [FIR] Resolve annotations as calls 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
bc1fa8ed7f [FIR] Add constructor for java annotations 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
644e9843f9 [FIR] Add initialization of calleeReference for FirAnnotationCall 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
614291b2cc [FIR] Make FirAnnotationCall resolvable 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
ffd30566be [FIR] Add FirErrorResolvedQualifier for qualifiers with resolve diagnostic 2020-08-04 08:59:14 +03:00
Dmitry Gridin
a5e9401a0a [configuration] change updater number to 1.4.* and 1.5.*
#KT-40639 Fixed
2020-08-04 11:13:30 +07:00
Julian Kotrba
88f508446a Make repeat example more expressive
This commit adds the zero-based index of current iteration from the passed HOF "action" of the repeat function to its associated code sample.

KT-20357
2020-08-04 00:48:06 +03:00
Ilya Gorbunov
a5178bb826 Minor: fix toJavaDuration docs 2020-08-04 00:34:15 +03:00
Ilya Gorbunov
99eb7f391b Fix doc wording around covariance/invariance 2020-08-04 00:33:05 +03:00
Roman Artemev
4f73e08704 [KLIB] Make fake override resolver garbage free as much as possible
- reduce memory pollution during FO resolve
2020-08-03 19:22:07 +03:00
Roman Artemev
876ee265f2 [KLIB] Fix memory leak in fake override resolver 2020-08-03 19:22:07 +03:00
Roman Artemev
e189cb1895 [KLIB] Fix memory leak in linker through haveSeen set 2020-08-03 19:22:06 +03:00
Roman Artemev
19b5fda750 [KLIB] Do not duplicate origin mapping per file 2020-08-03 19:22:06 +03:00
Roman Artemev
c253042948 [KLIB] Reduce amount of descriptors loaded during desc-idSig resolution 2020-08-03 19:22:06 +03:00
Roman Artemev
851c287105 [KLIB] Use SoftReference to hold proto memory
- fix metadata memory leak for KT-40345
2020-08-03 19:22:06 +03:00
Roman Artemev
add0ad6733 [KLIB] Change KLIB IO API
- Use ReadBuffer instead of native java buffer
 - Use Weak buffers for File IO
 - fix klib memory leak for KT-40345
2020-08-03 19:22:06 +03:00
Jinseong Jeon
0e54f98b79 FIR: support adapted callable reference with vararg 2020-08-03 16:37:36 +03:00
Mikhail Glukhikh
4332e95b8a [FIR] Don't transform setter parameter type if it's given explicitly 2020-08-03 16:37:30 +03:00
vldf
8813ebd950 [FIR] Add RedundantSetterParameterType Checker 2020-08-03 16:37:24 +03:00
vldf
a6c9d869fb [FIR] Move RedundantCallOfConversionMethod to extended checkers 2020-08-03 16:31:49 +03:00
vldf
3349739d1e [FIR] Fixes for RedundantReturnUnitType checker 2020-08-03 11:42:19 +03:00
vladislavf7@gmail.com
2384afdd93 [FIR] refactoring for running extended checkers 2020-08-03 11:42:19 +03:00
vldf
cfc09048c6 [FIR] Add RedundantCallOfConversionMethod checker 2020-08-03 10:41:19 +03:00
Mikhail Glukhikh
39d4b79324 [FIR TEST] Fix FE 1.0 / FIR test data for nested / local type alias case 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
7724d060ff [FIR] Don't compare SYNTAX diagnostics in light tree diagnostic test 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
4e4fe9f719 [FIR] Support some kinds of fake sources in light builder 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
951aa8185e [FIR] Avoid duplicate diagnostics on expression.typeRef 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
dc46d51d9a [FIR TEST] Update diagnostic spec test data 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
6eab6f2f87 [FIR TEST] Replace OTHER_ERROR with UNRESOLVED_REFERENCE in test data 2020-08-02 18:19:47 +03:00
Nick
c55cdf1935 [FIR] Fix missing ErrorTypeRef for QA and clean DiagnosticCollector 2020-08-02 18:19:46 +03:00
Nick
7086b0cbf3 [FIR] Don't report duplicated errors in component calls typeRefs 2020-08-02 18:19:46 +03:00
Nick
4ceae8dc5e [FIR] Don't report duplicated errors in function calls typeRefs 2020-08-02 18:19:46 +03:00
Nick
6f85a07290 [FIR] Don't report duplicated errors in property declarations 2020-08-02 18:19:46 +03:00
Nick
889324e972 [FIR] Ignore failing test, improve DiagnosticKind, fix UPPER_BOUND 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
9335e09149 [FIR] Don't report duplicated errors in implicit properties / parameters 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
ceaffb1e8b [FIR] Don't report duplicated errors in implicit primary constructors 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
749346b73b [FIR] Don't report duplicated errors on default accessor error type refs 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
e0d25876b0 [FIR] Don't report simple diagnostics on fake sources 2020-08-02 18:19:44 +03:00
Mikhail Glukhikh
551bdd267d [FIR] Introduce WRONG_NUMBER_OF_TYPE_ARGUMENTS diagnostic 2020-08-02 18:19:44 +03:00
Mikhail Glukhikh
0804c6a0f3 [FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors
This commit introduces several different things, in particular:
- check type arguments in expressions
- new TypeArgumentList node to deal with diagnostic source
- ConeDiagnostic was moved to fir:cones
- ConeIntermediateDiagnostic to use in inference (?) without reporting
- detailed diagnostics on error type
2020-08-02 18:19:44 +03:00
Jinseong Jeon
c744dfba9c FIR: distinguish anonymous object as enum entry when scoping
so that `this` reference with the enum entry name as label can be
resolved
2020-08-02 18:06:15 +03:00
Jinseong Jeon
52631b7abd FIR2IR: make local storage track scopes, including anonymous init 2020-08-02 18:05:09 +03:00
Nick
26e3a111d6 [FIR] Add diagnostics for object related problems 2020-07-31 19:34:55 +03:00
Nick
694d3cad4e [FIR] Exposed visibility checker: optimize checks for local visibility 2020-07-31 19:28:10 +03:00
Nick
60462bea1c FirEffectiveVisibilityResolver: search parent in containingDeclarations
When determining effective visibility of 'something',
we use containing declarations from the context to find 'something'
parent, to avoid calling getClassSymbolByFqName for all cases.
2020-07-31 19:28:04 +03:00
Nick
7145caca40 [FIR] Refactor effective visibility calculation
Before this commit, we had effective visibility as a part of FIR status,
so it was integrated into the full pipeline. In this commit,
we introduced "effective visibility as a service" which is now used
only by exposed visibility checker. This allows us to make the thing
universal for all FIR nodes, including nodes for Java / deserialized.
2020-07-31 19:27:58 +03:00
Steven Schäfer
b15e32936e JVM IR: Optimize delegated properties (KT-36814) 2020-07-31 19:00:27 +03:00
vldf
8724efbe8a [FIR] Add empty range checker 2020-07-31 16:28:37 +03:00
vldf
b10defdbab [FIR] Add redundant single string expression template checker 2020-07-31 16:28:37 +03:00
vldf
95e0ba3d5c [FIR] Add ArrayEqualityOpCanBeReplacedWithEquals checker 2020-07-31 16:28:37 +03:00
Ilmir Usmanov
4d21a496fe Minor. Update tests 2020-07-31 14:33:52 +02:00
Dmitry Petrov
e11c90f26c JVM_IR: KT-40293 Box return type for DefaultImpls methods if required 2020-07-31 14:48:12 +03:00
Ilya Chernikov
034d5a948c Add JvmDefault to the new EP method for compatibility with older impls 2020-07-31 12:07:10 +02:00
Ilmir Usmanov
fa8c6deb18 Support restricted suspend lambdas in JVM_IR
#KT-40135 Fixed
2020-07-30 20:40:37 +02:00
Ilmir Usmanov
2c205410fa Check whether the field is indeed being initialized
in checkFieldInExactlyOnceLambdaInitialization
 #KT-40691 Fixed
2020-07-30 19:04:54 +02:00
Nikolay Krasko
d8b76f5b26 Register additional repository id 2020-07-30 19:33:58 +03:00
Vladimir Ilmov
7eca13569b (CoroutineDebugger) Enable agent for versions 1.3.8.*
Gradle artifact name gets changed from 'kotlinx-coroutines-core' to
'kotlinx-coroutines-core-jvm'. So it should support both.
2020-07-30 17:54:35 +02:00
Toshiaki Kameyama
c91858d470 Convert member to extension: do not suggest for delegated properties
#KT-35128 Fixed
2020-07-30 17:32:31 +03:00
Dmitry Petrov
46fccae7d1 PSI2IR: KT-40499 Fix delegated property desugaring
No type arguments were provided for property reference inside delegated
property accessors.
2020-07-30 13:18:36 +03:00
Jinseong Jeon
bff36e0199 FIR2IR: convert annotations on FirTypeRef 2020-07-30 11:25:36 +03:00
Georgy Bronnikov
4ca98041cd IR: update test data 2020-07-30 11:24:08 +03:00
Georgy Bronnikov
a27d63f58f JVM_IR: flexible nullability as annotation
We carry information about flexible nullability of IrType as an
annotation, so there is no need to look at its underlying KotlinType.
2020-07-30 11:24:07 +03:00
Georgy Bronnikov
a2e9521ad5 Make DescriptorlessExternalPackageFragmentSymbol public 2020-07-30 11:24:07 +03:00
Georgy Bronnikov
c2ead0303b IR: remove more descriptor usage 2020-07-30 11:24:07 +03:00
Alexander Gorshenev
9a717e9ecf Don't copy default value parameters for fake overrides 2020-07-29 22:15:10 +03:00
Mark Punzalan
2cfd776092 ForLoopsLowering: Assume step == 1 for *Range (e.g., IntRange) and
handle accordingly (e.g., do not read `step` property).
2020-07-29 20:44:51 +02:00
Dmitry Petrov
09e47fff7b Fix KotlinGradleIT.testCustomCompilerFile
Referencing org.jetbrains.annotations.{Nullable, NotNull} classes in
static initializer causes ClassNotFoundError in testCustomCompilerFile.
2020-07-29 20:33:17 +03:00
Dmitry Petrov
dae358c792 JVM: KT-40664 disable optimization for 'ULong in range of UInt' case 2020-07-29 20:33:17 +03:00
Dmitry Petrov
f2493d0950 JVM: KT-40665 more exact check for intrinsified range 'contains' 2020-07-29 20:33:17 +03:00
Roman Artemev
0559e192ee [JS IR] Support external delegation in case of JS in psi2ir
- fix FE delegation resolver
 - fix critical KT-40650
2020-07-29 19:57:05 +03:00
Nicolay Mitropolsky
c254651ed3 Uast: handling annotations on the property receiver (KT-40539) 2020-07-29 19:42:22 +03:00
Yaroslav Chernyshev
325ad56dcd Populate Kotlin source set roots with KotlinSourceRootTypes
By default Kotlin source root is populated with JavaSourceRootType and
changed during import only if real source folder exists.
Now Kotlin source roots has valid source type right after creation

#KT-37106 Fixed
2020-07-29 19:24:44 +03:00
Ilmir Usmanov
fec845365a Minor. No longer ignore obsolete PRE_RELEASE_CLASS diagnostic
in coroutine tests.
2020-07-29 17:52:01 +02:00
Simon Ogorodnik
ebfcd7e074 J2K: Improve presentation of conversions 2020-07-29 17:56:03 +03:00
Simon Ogorodnik
5c745facf4 J2K: Improve error message in case of incorrect detach 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
dc963e4ff6 Improve J2K progress reporting 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
8bcf1000f6 J2K: Fix java 9 try-with-resources 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
c5005f8695 J2K: Speed-up add imports 2020-07-29 17:56:01 +03:00
Simon Ogorodnik
cd0c644654 J2K: Fix incorrect early detaching of elements in for conversion 2020-07-29 17:56:00 +03:00
Simon Ogorodnik
8c2dd876b5 J2K: Fix incorrect argument remapping when introducing defaults 2020-07-29 17:56:00 +03:00
Simon Ogorodnik
cd7ac55091 J2K: Show converted/total file counts 2020-07-29 17:55:59 +03:00
Simon Ogorodnik
468af0bb85 J2K: Fix type parameters in LHS of callable reference 2020-07-29 17:50:10 +03:00
Leonid Startsev
96d0b1c47a Update serialization runtime and fix test data
Revert "Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests"
2020-07-29 14:20:33 +03:00
Nikolay Krasko
a6a22d1cde Revert "Populate Kotlin source set roots with KotlinSourceRootTypes"
This reverts commit e2634190
2020-07-29 12:05:42 +03:00
Yaroslav Chernyshev
e263419088 Populate Kotlin source set roots with KotlinSourceRootTypes
By default Kotlin source root is populated with JavaSourceRootType and
changed during import only if real source folder exists.
Now Kotlin source roots has valid source type right after creation

#KT-37106 Fixed
2020-07-29 10:26:42 +03:00
Ilmir Usmanov
4fb5f8603a Keep $continuation in LVT
in case of suspend functions and `this` is case of lambdas, since they
are used in async stack trace generation.
Update tests.
 #KT-40661 Open
2020-07-29 00:01:12 +02:00
Ilmir Usmanov
db40808186 Minor. Remove unused SourceFrames 2020-07-29 00:01:11 +02:00
Ilmir Usmanov
70e91bd5db Shrink and split LVT records of variables according to their liveness
Otherwise, debugger will show uninitialized values of dead variables
after resume.
 #KT-16222
 #KT-28016 Fixed
 #KT-20571 Fixed
2020-07-29 00:01:10 +02:00
Ilmir Usmanov
e5995f0c12 Update R8
Because old version throws assertion error if parameter's LVT record
does no span the whole function.
2020-07-29 00:01:10 +02:00
Ilmir Usmanov
60875f96b4 Do not take LVT into account when calculating liveness of variables 2020-07-29 00:01:09 +02:00
Alexander Udalov
687d13a320 IR: cleanup expression implementations
Remove unused constructors with descriptors, minimize usages of
secondary constructors and make some properties non-lateinit, fix some
inspections.
2020-07-28 20:05:58 +02:00
Alexander Udalov
e36d3ba4f6 IR: remove IrNoArgumentsCallableReferenceBase
To simplify transformation of IR element hierarchy to classes.
2020-07-28 20:05:57 +02:00
Dmitriy Novozhilov
f270cd8d6e [FIR] Update testdata due to lack of callee reference in FirResolvedQualifier 2020-07-28 20:47:07 +03:00
Dmitriy Novozhilov
f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00
anastasiia.spaseeva
5c0528b61e [Spec tests] Add tests for primary constructors declaration 2020-07-28 20:26:33 +03:00
anastasiia.spaseeva
0488dc985f [Spec tests] Add tests for intersection and OR 2020-07-28 20:26:32 +03:00
anastasiia.spaseeva
46774fb6d6 [Spec tests] Add call without an explicit receiver tests for top-level non-extension functions 2020-07-28 20:26:32 +03:00
anastasiia.spaseeva
bef59055cd [Spec tests] Fix test cases structure 2020-07-28 20:26:31 +03:00
anastasiia.spaseeva
4ad3847224 [Spec tests] Add tests for subtyping rules for simple classifier type 2020-07-28 20:26:30 +03:00
anastasiia.spaseeva
1801344c76 [Spec tests] Add tests for inner-and-nested-type-contexts section 2020-07-28 20:26:29 +03:00
anastasiia.spaseeva
d5ddb26180 [Spec tests] Add overload resolution tests for plus assign operator call 2020-07-28 20:26:28 +03:00
anastasiia.spaseeva
1d83c59e80 [Spec tests] Actualize test for callable reference section 2020-07-28 20:26:27 +03:00
anastasiia.spaseeva
4db209648d [Spec tests] Update spec version 2020-07-28 20:26:26 +03:00
anastasiia.spaseeva
3f862830f2 [Spec tests] Add tests for resolving callable references and some co-tests 2020-07-28 20:26:24 +03:00
anastasiia.spaseeva
cfbfec77a5 [Spec tests] Add tests for Algorithm of MSC selection 2020-07-28 20:26:23 +03:00
anastasiia.spaseeva
73850e97d7 [Spec tests] Add test for Coercion to Unit error diagnostics absence 2020-07-28 20:26:22 +03:00
anastasiia.spaseeva
26ac87d9be [Spec tests] Update spec testData 2020-07-28 20:26:21 +03:00
Alexander Udalov
f240d51d2c IR: do not inherit IrFakeOverride* from IrFunction/IrProperty
This will help to reduce boilerplate after making the latter classes.

Without this change, IrFunctionCommonImpl would not be able to be a
class because it would introduce a diamond class hierarchy, and thus
that would require copying all its contents to IrFunctionImpl and
IrFakeOverrideFunctionImpl.
2020-07-28 19:05:12 +02:00
Alexander Udalov
4892737cc9 Use IrFactory in kotlin-serialization-compiler 2020-07-28 19:04:44 +02:00
Alexander Udalov
0909894a96 PIR: make most implementations and carriers internal 2020-07-28 19:04:44 +02:00
Alexander Udalov
cce55f1609 IR: add module ir.tree.impl, move main IR implementation there 2020-07-28 19:04:44 +02:00
Alexander Udalov
77247deb23 IR: add module ir.tree.persistent, copy PIR implementation there
Use PersistentIrFactory in JS IR compiler entry points.
2020-07-28 19:04:43 +02:00
Alexander Udalov
9aed92d2dd Partially revert "Persistent IR implementation"
This partially reverts commit f437da8ee5.
Changes related to carriers and others are still there. They will be
moved out to a separate module in a subsequent commit.
2020-07-28 19:04:43 +02:00
Dmitry Petrov
980b91d082 JVM: generate 'Deprecated' on method as runtime-visible annotation
We generate @java.lang.Deprecated annotation on methods of $DefaultImpls
classes in compatibility mode. This annotation has RUNTIME retention and
should be visible.

Also, get rid of representing annotations as Class'es (yes we know that
these annotations are in compiler CLASSPATH, but we should not rely on
such classes and associated information).
2020-07-28 18:19:20 +03:00
Dmitry Petrov
4fdccb3b35 JVM_IR: don't generate repeated ElementType values in @Target 2020-07-28 18:19:20 +03:00
Ilya Goncharov
c065210b56 [Gradle, JS] Reuse task requirements
^KT-39825 fixed
2020-07-28 18:17:05 +03:00
Ilya Goncharov
9a3ae4f4fa [Gradle, JS] Common webpack configuration
^KT-39825 fixed
2020-07-28 18:16:51 +03:00
vldf
a2b26c00a1 Uncommented ControlFlowAnalysisBenchmark 2020-07-28 17:10:02 +03:00
vldf
fca0b7fedd [FIR] Add CFA benchmark 2020-07-28 14:30:40 +03:00
vldf
d7b3a86f5e [FIR] Add "can be val" extended checker 2020-07-28 14:17:38 +03:00
Jinseong Jeon
da6e96f4f1 FIR2IR: don't declare dispatch receiver for local functions 2020-07-28 13:43:10 +03:00
Jinseong Jeon
5a3367e09c FIR: initial support of suspend conversion for function reference 2020-07-28 13:37:05 +03:00
Alexander Udalov
b9243aad24 Minor, fix test data in bytecodeListing/specialBridges 2020-07-28 12:12:39 +02:00
Alexander Udalov
df324d5a08 IR: pull up common accept/transform implementations to interfaces
To avoid duplicating them among the main, persisting, lazy, and
fir2ir-lazy implementations.

Also reformat a bit, and avoid storing descriptor in a field in some
places.
2020-07-28 12:05:24 +02:00
Alexander Udalov
12d2a02d22 JS IR: drop JsIrDeclarationBuilder
Move buildValueParameter back to JsIrBuilder, and use common IR builders
directly where buildFunction was called.
2020-07-28 12:05:24 +02:00
Alexander Udalov
0d605a6b7f IR: create IrBlockBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov
9ad4a754ce IR: create IrExpressionBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov
d1dc938a5d IR: use IrFactory in IR builders 2020-07-28 12:05:24 +02:00
Alexander Udalov
898dd20a9e IR: use IrFactory in misc utils 2020-07-28 12:05:23 +02:00
Alexander Udalov
f359f36ed9 IR: add IrFactory to IrDeclaration, use in deep copy 2020-07-28 12:05:23 +02:00
Alexander Udalov
305288aa82 IR: use IrFactory in psi2ir 2020-07-28 12:05:23 +02:00
Alexander Udalov
8c41ba8ee4 IR: use IrFactory in fir2ir 2020-07-28 12:05:23 +02:00
Alexander Udalov
9356f87f28 IR: use IrFactory in linker 2020-07-28 12:05:23 +02:00
Alexander Udalov
db4cbe7103 IR: use IrFactory in SymbolTable 2020-07-28 12:05:23 +02:00
Alexander Udalov
c6a127e87e IR: introduce IrFactory
This is needed to refactor IrPersistingElementBase-based implementations
into another module, to use it in JS IR.
2020-07-28 12:05:23 +02:00
Kirill Shmakov
96968cd9c9 Fix build after rebasing 2020-07-28 12:55:38 +03:00
Kirill Shmakov
96160cbb55 Adapt AS wizard to changes in main wizard 2020-07-28 12:26:19 +03:00
Kirill Shmakov
5c8833f608 Wizard: improve mobile app template 2020-07-28 12:26:19 +03:00
Ilya Kirillov
63fa6674a3 Wizard: temporary add ios shortcut target
Temporary as it will not be needed when HMPP wizard will be ready
2020-07-28 12:26:19 +03:00
Ilya Kirillov
f330cd3697 Wizard: relocate AndroidManifest.xml for MPP module 2020-07-28 12:26:19 +03:00
Ilya Kirillov
b3d48cda8c Wizard: add common tests for iOS/Android template 2020-07-28 12:26:19 +03:00
Ilya Kirillov
5ffcaf6508 Wizard: add shared code for iOS/Android template
fix android
2020-07-28 12:26:19 +03:00
Ilya Kirillov
66c756ad0f Wizard: add ability for wizard to generate expected/actual declarations in MPP module 2020-07-28 12:26:18 +03:00
Ilya Kirillov
7d1036ee7e Wizard: use property for storing module dependency 2020-07-28 12:26:18 +03:00
Ilya Kirillov
dbc43b66bf Wizard: introduce ModuleConfiguratorProperty 2020-07-28 12:26:18 +03:00
Ilya Kirillov
74d6919c7c Wizard: wrap property into PluginProperty for plugin properties 2020-07-28 12:26:18 +03:00
Ilya Kirillov
3c3ba361e8 Wizard: specify path for plugin entities in one place 2020-07-28 12:26:18 +03:00
Ilya Kirillov
c05c72387e Wizard: fix node js templates 2020-07-28 12:26:18 +03:00
aleksandrina-streltsova
63e2d771b3 Get rid of reflection in new project wizard core: manually specify properties in plugins 2020-07-28 12:26:17 +03:00
Ilya Kirillov
cc35529b9a Wizard: get rid of reflection: specify plugin path by hand 2020-07-28 12:23:57 +03:00
Ilya Kirillov
3ed11c0491 Wizard: get rid of reflection: force plugins to specify settings & tasks directly 2020-07-28 12:23:57 +03:00
vldf
eadd3f00f2 [FIR] Add CanBeReplacedWithOperatorAssignmentChecker 2020-07-28 10:13:28 +03:00
Kevin Bierhoff
fa8c6e7fb6 Uast: KT-40578: resolve Kotlin property writes to setters (#3597)
* KT-40578: resolve Kotlin property writes to setters

* limit to non-constructor properties

* Uast: `KotlinIDERenderLogTest.testConstructors` fix

Co-authored-by: Nicolay Mitropolsky <nicolay.mitropolsky@jetbrains.com>
2020-07-28 10:03:22 +03:00
Sergey Bogolepov
5851a7dea0 [kotlinx-metadata-klib] Proper support for nullable enum entry fields 2020-07-28 11:59:17 +07:00
Sergey Rostov
45f0328f21 scripting: preload scripting support plugins 2020-07-27 19:44:03 +00:00
Sergey Rostov
b5e04378ed scripting, ucache: don't init caches at start up
init it in async instead. all usages will be updated thanks to
highlighting/reindexing that is called after cache is constructed.

#KT-40242 Fixed
2020-07-27 19:44:03 +00:00
Dmitry Petrov
43fcb2330e JVM_IR: fix source file name for mutlifile class facades 2020-07-27 19:13:37 +03:00
Dmitry Petrov
89a0b3e944 Check class source in bytecode listing tests 2020-07-27 19:13:37 +03:00
Dmitriy Dolovov
b47946cbba Report interop functions with non-stable parameter names
^KT-34602
2020-07-27 23:11:36 +07:00
Dmitriy Dolovov
3d9093583f Metadata: 'non-stable parameter names' flag for callables
^KT-34602
2020-07-27 23:11:30 +07:00
Ilya Goncharov
8cace2bab4 [Gradle, JS] Add tests on kotlin/js module with js files 2020-07-27 19:00:12 +03:00
Ilya Goncharov
0b88f457e8 [Gradle, JS] Use .meta.js as source of "name" and "main" fields
^KT-40342 fixed
2020-07-27 19:00:12 +03:00
Victor Petukhov
cca64b8fab NI: use the inferred type to check of nullable array for vararg
^KT-40555 Fixed
2020-07-27 18:24:31 +03:00
Steven Schäfer
9d63412b3e JVM IR: Produce correct generic signatures for special bridge methods 2020-07-27 17:02:24 +02:00
Steven Schäfer
c16b548dff JVM IR: Don't produce annotations on builtin stub, toArray, and bridge methods 2020-07-27 17:02:24 +02:00
Andrei Klunnyi
f661b7604b KT-40557 Scratch: .kt files are treated as Kotlin scratches, opening fails
https://ea.jetbrains.com/browser/ea_problems/224367
2020-07-27 15:36:02 +02:00
Andrei Klunnyi
0e46a980f6 EA- 235760 // additional logging
https://ea.jetbrains.com/browser/ea_problems/235760
2020-07-27 15:36:00 +02:00
Andrei Klunnyi
c27453632e EA-235769 // StringIndexOutOfBoundsException
https://ea.jetbrains.com/browser/ea_problems/235769
2020-07-27 15:35:59 +02:00
Andrei Klunnyi
4afa50e081 EA-235759 // NPE fix
https://ea.jetbrains.com/browser/ea_problems/235759
2020-07-27 15:35:58 +02:00
Andrei Klunnyi
29281fd0bf EA-235761 // NPE fix
https://ea.jetbrains.com/browser/ea_problems/235761
2020-07-27 15:35:57 +02:00
Andrei Klunnyi
e63951c38c EA-235765 // NPE at refactoring suggestion
Fixed exception:
java.lang.NullPointerException: null cannot be cast to non-null type
org.jetbrains.kotlin.descriptors.CallableDescriptor

More info: https://ea.jetbrains.com/browser/ea_problems/235765
2020-07-27 15:35:55 +02:00
Dmitry Gridin
e8fd69fde1 [formatter] fix infinite recursion
Already exists in the new repo: original-hash e7ea6926a8a414ab6082299d99239ad167ab75a2

#KT-40636 Fixed
2020-07-27 19:56:19 +07:00
Ryan Nett
b1173317c5 Change scripting Severity enums to order from DEBUG to FATAL.
#KT-39502 fixed
2020-07-27 14:29:30 +02:00
Konstantin Tskhovrebov
59f6c0c273 Add flag for avoid double MPP gradle module resolve. 2020-07-27 15:11:48 +03:00
Ilya Goncharov
5444ffaf4b [Gradle, JS] Deprecate produceExecutable
^KT-40568 fixed
2020-07-27 14:44:47 +03:00
Ilya Goncharov
d9c269ed6b [Gradle, JS] Disable binaries.executable by default in wizard
^KT-40461 fixed
2020-07-27 14:35:45 +03:00
Natalia Selezneva
8d1f9df802 Do not show warning when multiple Gradle Definitions are loaded
This will happen when there are multiple gradle project linked to one IDEA project
andthey have different gradle versions
2020-07-27 13:08:01 +03:00
Ilya Matveev
a62f65940d Gradle, CocoaPods: Use synthetic dir as a working dir for pod gen
'Pod gen' creates an empty folder named 'Pods' in a directory where it
is executed. Earlier, 'pod gen' was executed in a project root
directory, so this `Pods` folder was created in a VCS-controlled
place. This patch fixes this issue by running 'pod gen' in a directory
where the synthetic project is located.
2020-07-27 10:02:07 +00:00
Ilya Matveev
7c3eda31fa Gradle, CocoaPods: Fix non-compilable dummy header
Issue #KT-39999 fixed
2020-07-27 10:02:07 +00:00
Ilya Matveev
85908713b1 Gradle, CocoaPods: Support pods with dashes in names
See https://github.com/JetBrains/kotlin-native/issues/2884
2020-07-27 10:02:06 +00:00
Zalim Bashorov
635869f15a Rewrite className helper to fix tests on android
Since android tests preprocess test data and
(at least) replace package for files and fix package usages
it's preferred to use fqnames explicitly
instead of assembly them from parts, as it was before.
2020-07-25 15:28:36 +03:00
Mikhail Glukhikh
0ded1d7006 FirBasedSignatureComposer: generate better error messages 2020-07-24 19:47:28 +03:00
Mikhail Glukhikh
40256aa43d Fir2IrLazyClass: generate enum values() / valueOf() properly 2020-07-24 19:47:28 +03:00
Mikhail Glukhikh
8bae0f2d0c [FIR2IR] Handle local visibility around signature composer properly 2020-07-24 19:47:27 +03:00
Mikhail Glukhikh
828524bde4 [FIR2IR] Fix conversion of default vararg arguments for annotations 2020-07-24 19:47:27 +03:00
Mikhail Glukhikh
240baa64a5 Fir2IrConverter: initialize call generator earlier to avoid lateinit err 2020-07-24 19:47:26 +03:00
Mikhail Glukhikh
2b52988f1b [FIR TEST] Add failing BB test with Deprecated annotation 2020-07-24 19:47:19 +03:00
Denis Zharkov
df1719c64c Fix incorrect mixed named/positioned arguments in project code
^KT-40404 Fixed
2020-07-24 13:36:52 +03:00
Denis Zharkov
dc6efa5a61 Fix incorrect handling of mixed named/positional arguments
^KT-40404 Fixed
2020-07-24 13:36:52 +03:00
Mikhail Bogdanov
d083297366 Support additional flags in MPP tests. Add diagnostic tests for defaults 2020-07-24 12:10:04 +02:00
Mikhail Bogdanov
125c72cb8d New default checks for mixed hierarchies
Old and new schemes
2020-07-24 12:10:04 +02:00
Denis Zharkov
de02b31ad7 FIR: Use phasedFir in resolve
^KT-40376 Fixed
2020-07-24 12:32:29 +03:00
Yaroslav Chernyshev
0de29e641d Fixed bug with pureKotlinSourceFolders for common modules 2020-07-24 12:22:00 +03:00
Yaroslav Chernyshev
142bd2e009 Filtering pureKotlinSourceFolders for existing package directories 2020-07-24 12:21:59 +03:00
Yaroslav Chernyshev
e6670d439f Small renaming classifier -> disambiguationClassifier 2020-07-24 12:21:58 +03:00
Yaroslav Chernyshev
96d9dad429 Fixed tests for pureKotlinSourceFolders by extending created facets 2020-07-24 12:21:57 +03:00
Yaroslav Chernyshev
f490085142 Support pureKotlinSourceFolders for MPP projects
#KT-34271 Fixed
#KT-32963 Fixed
2020-07-24 12:21:57 +03:00
nataliya.valtman
fde8a34c32 KT-40058 NPE from mpp gradle plugin on kotlinx.benchmarks 2020-07-24 10:46:45 +03:00
Ivan Kylchik
bc41681a2e Fix gradle import error after introducing new gradle task in benchmarks 2020-07-23 21:18:32 +03:00
Vyacheslav Gerasimov
96ac6e612d Build: Replace androidIdeTest task with kaptIdeTest
We dont run android ide tests anymore
2020-07-23 19:18:18 +03:00
Vyacheslav Gerasimov
803d24cd42 Build: Remove pluginTests task and deduplicate kapt test task 2020-07-23 19:18:17 +03:00
Vyacheslav Gerasimov
ee642e69b0 Build: Introduce mainIdeTests task 2020-07-23 19:18:17 +03:00
Dmitry Petrov
e2a4ca10d6 JVM_IR: fix inner class attributes for private class in interface 2020-07-23 19:13:28 +03:00
Dmitry Petrov
0741781462 Compare inner class access flags in bytecode listing tests 2020-07-23 19:13:28 +03:00
21256 changed files with 680255 additions and 323570 deletions

10
.bunch
View File

@@ -1,8 +1,4 @@
201
202
203_202
193
192_193
as36_192_193
as40_193
as41
201
as41_201
as42

3
.gitignore vendored
View File

@@ -59,3 +59,6 @@ node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
local.properties
buildSrcTmp/
distTmp/
outTmp/

View File

@@ -101,4 +101,4 @@
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
</codeStyleSettings>
</code_scheme>
</component>
</component>

View File

@@ -10,6 +10,7 @@
<w>commonizers</w>
<w>commonizes</w>
<w>commonizing</w>
<w>interop</w>
<w>jetbrains</w>
<w>konan</w>
<w>kotlinx</w>

View File

@@ -0,0 +1,27 @@
<component name="ProjectDictionaryState">
<dictionary name="svyatoslav.kuzmich">
<words>
<w>anyfunc</w>
<w>copysign</w>
<w>eqref</w>
<w>exnref</w>
<w>externref</w>
<w>funcref</w>
<w>jetbrains</w>
<w>kotlinx</w>
<w>ktor</w>
<w>optref</w>
<w>popcnt</w>
<w>rotl</w>
<w>rotr</w>
<w>simd</w>
<w>sqrt</w>
<w>testsuite</w>
<w>uninstantiable</w>
<w>unlinkable</w>
<w>vtable</w>
<w>wabt</w>
<w>xopt</w>
</words>
</dictionary>
</component>

View File

@@ -10,7 +10,10 @@
<w>kapt</w>
<w>kotlinc</w>
<w>mutators</w>
<w>parcelable</w>
<w>parceler</w>
<w>parcelers</w>
<w>parcelize</w>
<w>repl</w>
<w>testdata</w>
<w>uast</w>

View File

@@ -453,4 +453,4 @@
<option name="ignoreNonEmtpyLoops" value="false" />
</inspection_tool>
</profile>
</component>
</component>

View File

@@ -10,7 +10,7 @@
</option>
<option name="taskNames">
<list>
<option value=":compiler:generateTests" />
<option value=":compiler:tests-for-compiler-generator:generateTests" />
<option value=":compiler:tests-java8:generateTests" />
<option value=":compiler:tests-against-klib:generateTests" />
<option value=":js:js.tests:generateTests" />
@@ -22,4 +22,4 @@
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<method />
</configuration>
</component>
</component>

11130
ChangeLog.md

File diff suppressed because it is too large Load Diff

View File

@@ -2,10 +2,14 @@
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_KotlinPublic_Compiler.svg)](https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Compiler?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
# Kotlin Programming Language
Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
Welcome to [Kotlin](https://kotlinlang.org/)!
It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors.
Some handy links:
* [Kotlin Site](https://kotlinlang.org/)
* [Getting Started Guide](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -14,10 +18,21 @@ Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
* [Issue Tracker](https://youtrack.jetbrains.com/issues/KT)
* [Forum](https://discuss.kotlinlang.org/)
* [Kotlin Blog](https://blog.jetbrains.com/kotlin/)
* [Subscribe to Kotlin YouTube channel](https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw)
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
* [Public Slack channel](https://slack.kotlinlang.org/)
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
## Kotlin Multiplatform capabilities
Support for multiplatform programming is one of Kotlins key benefits. It reduces time spent writing and maintaining the same code for [different platforms](https://kotlinlang.org/docs/reference/mpp-supported-platforms.html) while retaining the flexibility and benefits of native programming.
* [Kotlin Multiplatform Mobile](https://kotlinlang.org/lp/mobile/) for sharing code between Android and iOS
* [Getting Started with Kotlin Multiplatform Mobile Guide](https://kotlinlang.org/docs/mobile/create-first-app.html)
* [Kotlin Multiplatform Benefits](https://kotlinlang.org/docs/reference/multiplatform.html)
* [Share code on all platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-all-platforms)
* [Share code on similar platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-similar-platforms)
## Editing Kotlin
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)

View File

@@ -16,18 +16,24 @@
package org.jetbrains.kotlin.ant
import org.apache.tools.ant.types.Path
import org.apache.tools.ant.types.Reference
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.taskdefs.Execute
import org.apache.tools.ant.taskdefs.Redirector
import org.apache.tools.ant.types.*
import java.io.File.pathSeparator
import java.io.File.separator
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
var includeRuntime: Boolean = true
var includeRuntime: Boolean = false
var moduleName: String? = null
var noReflect: Boolean = false
private val cmdl = CommandlineJava()
var fork: Boolean = false
private var compileClasspath: Path? = null
fun setClasspath(classpath: Path) {
@@ -73,4 +79,47 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
if (noReflect) args.add("-no-reflect")
if (includeRuntime) args.add("-include-runtime")
}
override fun execute() {
if (!fork)
super.execute()
else {
exec()
}
}
private fun exec() {
val javaHome = System.getProperty("java.home")
val javaBin = javaHome + separator + "bin" + separator + "java"
val redirector = Redirector(this)
fillArguments()
val command = ArrayList<String>()
command.add(javaBin)
command.addAll(cmdl.vmCommand.arguments) // jvm args
command.add("-Dorg.jetbrains.kotlin.cliMessageRenderer=FullPath") // same MessageRenderer as non-forking mode
command.add("-cp")
command.add(KotlinAntTaskUtil.compilerJar.canonicalPath)
command.add(compilerFqName)
command.addAll(args) // compiler args
// streamHandler: used to handle the input and output streams of the subprocess.
// watchdog: a watchdog for the subprocess or <code>null</code> to disable a timeout for the subprocess.
// TODO: support timeout for the subprocess
val exe = Execute(redirector.createHandler(), null)
exe.setAntRun(getProject())
exe.commandline = command.toTypedArray()
log("Executing command: ${command.joinToString(" ")}", LogLevel.DEBUG.level)
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]")
val exitCode = exe.execute()
redirector.complete()
if (failOnError && exitCode != 0) {
throw BuildException("Compile failed; see the compiler error output for details.")
}
}
fun createJvmarg(): Commandline.Argument {
return cmdl.createVmArgument()
}
}

View File

@@ -80,7 +80,7 @@ abstract class KotlinCompilerBaseTask : Task() {
fillSpecificArguments()
}
final override fun execute() {
override fun execute() {
fillArguments()
val compilerClass = KotlinAntTaskUtil.getOrCreateClassLoader().loadClass(compilerFqName)

View File

@@ -8,10 +8,8 @@ buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
dependencies {
@@ -30,10 +28,8 @@ repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
@@ -44,9 +40,7 @@ dependencies {
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
}
@@ -74,6 +68,7 @@ benchmark {
param("size", 1000)
include("CommonCallsBenchmark")
include("ControlFlowAnalysisBenchmark")
//include("InferenceBaselineCallsBenchmark")
}
@@ -111,8 +106,9 @@ tasks.named("classes") {
}
}
/*tasks.register<JavaExec>("runBenchmark") {
val jmhArgs: String by project // example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
tasks.register<JavaExec>("runBenchmark") {
// jmhArgs example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
val jmhArgs = if (project.hasProperty("jmhArgs")) project.property("jmhArgs").toString() else ""
val resultFilePath = "$buildDir/benchmarks/jmh-result.json"
val ideaHome = intellijRootDir().canonicalPath
@@ -120,7 +116,6 @@ tasks.named("classes") {
args = mutableListOf("-Didea.home.path=$ideaHome", benchmarkJarPath, "-rf", "json", "-rff", resultFilePath) + jmhArgs.split("\\s".toRegex())
main = "-jar"
doLast {
if (project.kotlinBuildProperties.isTeamcityBuild) {
val jsonArray = com.google.gson.JsonParser.parseString(File(resultFilePath).readText()).asJsonArray
@@ -144,4 +139,4 @@ tasks.named("classes") {
}
}
}
}*/
}

View File

@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.benchmarks
import com.intellij.openapi.Disposable
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.CharsetToolkit
import com.intellij.psi.PsiElementFinder
@@ -104,9 +103,7 @@ abstract class AbstractSimpleFileBenchmark {
)
if (isIR) {
Extensions.getArea(env.project)
.getExtensionPoint(PsiElementFinder.EP_NAME)
.unregisterExtension(JavaElementFinder::class.java)
PsiElementFinder.EP.getPoint(env.project).unregisterExtension(JavaElementFinder::class.java)
}
file = createFile(
@@ -155,7 +152,7 @@ abstract class AbstractSimpleFileBenchmark {
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSession(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
val totalTransformer = FirTotalResolveProcessor(session)
val firFile = builder.buildFirFile(file).also(firProvider::recordFile)
@@ -163,8 +160,8 @@ abstract class AbstractSimpleFileBenchmark {
totalTransformer.process(listOf(firFile))
bh.consume(firFile.hashCode())
Extensions.getArea(env.project)
.getExtensionPoint(PsiElementFinder.EP_NAME)
env.project.extensionArea
.getExtensionPoint<PsiElementFinder>(PsiElementFinder.EP.name)
.unregisterExtension(FirJavaElementFinder::class.java)
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2010-2020 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.benchmarks
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.Blackhole
import java.util.concurrent.TimeUnit
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
open class ControlFlowAnalysisBenchmark : AbstractSimpleFileBenchmark() {
@Param("1000")
private var size: Int = 0
@Benchmark
fun benchmark(bh: Blackhole) {
analyzeGreenFile(bh)
}
override fun buildText() =
buildString {
appendLine("fun test() {")
for (i in 0 until size) {
appendLine("for (i$i in 0..10) { ")
}
for (i in 0 until size) {
appendLine("}")
}
appendLine("}")
}
}

View File

@@ -7,6 +7,7 @@ plugins {
dependencies {
compileOnly(project(":core:util.runtime"))
compileOnly(project(":compiler:backend.common.jvm"))
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:cli-common"))
compileOnly(project(":compiler:frontend.java"))

View File

@@ -17,9 +17,6 @@ interface BuildMetaInfo {
val compilerBuildVersion: String
val languageVersionString: String
val apiVersionString: String
val coroutinesEnable: Boolean
val coroutinesWarn: Boolean
val coroutinesError: Boolean
val multiplatformEnable: Boolean
val metadataVersionMajor: Int
val metadataVersionMinor: Int
@@ -35,9 +32,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -53,9 +47,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
ownVersion = OWN_VERSION,
coroutinesVersion = COROUTINES_VERSION,

View File

@@ -15,9 +15,6 @@ data class CommonBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -32,9 +29,6 @@ data class CommonBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -47,9 +41,6 @@ data class CommonBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -0,0 +1,12 @@
/*
* Copyright 2010-2020 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.build
import java.io.Serializable
enum class ExecutionStrategy : Serializable {
DAEMON, IN_PROCESS, OUT_OF_PROCESS
}

View File

@@ -15,9 +15,6 @@ data class JsBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -32,9 +29,6 @@ data class JsBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -47,9 +41,6 @@ data class JsBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -27,9 +27,6 @@ data class JvmBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -47,9 +44,6 @@ data class JvmBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -62,9 +56,6 @@ data class JvmBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2010-2020 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.build.report
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
open class BuildReporter(
protected open val icReporter: ICReporter,
protected open val buildMetricsReporter: BuildMetricsReporter
) : ICReporter by icReporter, BuildMetricsReporter by buildMetricsReporter
class RemoteBuildReporter(
override val icReporter: RemoteICReporter,
override val buildMetricsReporter: RemoteBuildMetricsReporter
) : BuildReporter(icReporter, buildMetricsReporter), RemoteReporter {
override fun flush() {
icReporter.flush()
buildMetricsReporter.flush()
}
}

View File

@@ -3,7 +3,7 @@
* 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.incremental
package org.jetbrains.kotlin.build.report
import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
@@ -17,3 +17,5 @@ interface ICReporter {
fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String)
fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String)
}

View File

@@ -1,9 +1,9 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 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.incremental
package org.jetbrains.kotlin.build.report
import java.io.File

View File

@@ -0,0 +1,9 @@
/*
* Copyright 2010-2020 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.build.report
interface RemoteICReporter : ICReporter,
RemoteReporter

View File

@@ -0,0 +1,11 @@
/*
* Copyright 2010-2020 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.build.report
interface RemoteReporter {
fun flush()
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2010-2020 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.build.report.metrics
import java.io.Serializable
enum class BuildAttributeKind : Serializable {
REBUILD_REASON;
companion object {
const val serialVersionUID = 0L
}
}
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON),
CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON),
UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNEXPECTED_PSI(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNKNOWN_QUALIFIER(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_REMOVED_ENTRY(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_IS_NOT_FOUND(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_CANNOT_BE_READ(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_NO_KNOWN_BUILDS(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_NON_INCREMENTAL_BUILD_IN_DEP(BuildAttributeKind.REBUILD_REASON),
IN_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
OUT_OF_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
IC_IS_NOT_ENABLED(BuildAttributeKind.REBUILD_REASON);
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 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.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildAttributes : Serializable {
private val myAttributes =
EnumMap<BuildAttribute, Int>(
BuildAttribute::class.java
)
fun add(attr: BuildAttribute, count: Int = 1) {
myAttributes[attr] = myAttributes.getOrDefault(attr, 0) + count
}
fun addAll(other: BuildAttributes) {
other.myAttributes.forEach { (attr, n) -> add(attr, n) }
}
fun asMap(): Map<BuildAttribute, Int> = myAttributes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright 2010-2020 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.build.report.metrics
import java.io.Serializable
data class BuildMetrics(
val buildTimes: BuildTimes = BuildTimes(),
val buildAttributes: BuildAttributes = BuildAttributes()
) : Serializable {
fun addAll(other: BuildMetrics) {
buildTimes.addAll(other.buildTimes)
buildAttributes.addAll(other.buildAttributes)
}
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2010-2020 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.build.report.metrics
interface BuildMetricsReporter {
fun startMeasure(metric: BuildTime, startNs: Long)
fun endMeasure(metric: BuildTime, endNs: Long)
fun addAttribute(attribute: BuildAttribute)
fun getMetrics(): BuildMetrics
fun addMetrics(metrics: BuildMetrics?)
}
inline fun <T> BuildMetricsReporter.measure(metric: BuildTime, fn: () -> T): T {
val start = System.nanoTime()
startMeasure(metric, start)
try {
return fn()
} finally {
val end = System.nanoTime()
endMeasure(metric, end)
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright 2010-2020 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.build.report.metrics
import java.util.*
class BuildMetricsReporterImpl : BuildMetricsReporter {
private val myBuildTimeStartNs: EnumMap<BuildTime, Long> =
EnumMap(
BuildTime::class.java
)
private val myBuildTimes = BuildTimes()
private val myBuildAttributes = BuildAttributes()
override fun startMeasure(metric: BuildTime, startNs: Long) {
if (metric in myBuildTimeStartNs) {
error("$metric was restarted before it finished")
}
myBuildTimeStartNs[metric] = startNs
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
val startNs = myBuildTimeStartNs.remove(metric) ?: error("$metric finished before it started")
val durationNs = endNs - startNs
myBuildTimes.add(metric, durationNs)
}
override fun addAttribute(attribute: BuildAttribute) {
myBuildAttributes.add(attribute)
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
buildTimes = myBuildTimes,
buildAttributes = myBuildAttributes
)
override fun addMetrics(metrics: BuildMetrics?) {
if (metrics == null) return
myBuildAttributes.addAll(metrics.buildAttributes)
myBuildTimes.addAll(metrics.buildTimes)
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2010-2020 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.build.report.metrics
import java.io.Serializable
@Suppress("Reformat")
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
GRADLE_TASK,
CLEAR_OUTPUT(GRADLE_TASK),
BACKUP_OUTPUT(GRADLE_TASK),
RESTORE_OUTPUT_FROM_BACKUP(GRADLE_TASK),
CONNECT_TO_DAEMON(GRADLE_TASK),
CLEAR_JAR_CACHE(GRADLE_TASK),
RUN_COMPILER(GRADLE_TASK),
NON_INCREMENTAL_COMPILATION_IN_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
INCREMENTAL_COMPILATION(RUN_COMPILER),
IC_CALCULATE_INITIAL_DIRTY_SET(INCREMENTAL_COMPILATION),
IC_ANALYZE_CHANGES_IN_DEPENDENCIES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_FIND_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_CHANGES_IN_JAVA_SOURCES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_ANALYZE_CHANGES_IN_ANDROID_LAYOUTS(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_DETECT_REMOVED_CLASSES(IC_CALCULATE_INITIAL_DIRTY_SET),
CLEAR_OUTPUT_ON_REBUILD(INCREMENTAL_COMPILATION),
IC_UPDATE_CACHES(INCREMENTAL_COMPILATION),
INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
NON_INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
IC_WRITE_HISTORY_FILE(INCREMENTAL_COMPILATION);
companion object {
const val serialVersionUID = 0L
val children by lazy {
values().filter { it.parent != null }.groupBy { it.parent }
}
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2010-2020 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.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildTimes : Serializable {
private val myBuildTimes = EnumMap<BuildTime, Long>(BuildTime::class.java)
fun addAll(other: BuildTimes) {
for ((bt, timeNs) in other.myBuildTimes) {
add(bt, timeNs)
}
}
fun add(buildTime: BuildTime, timeNs: Long) {
myBuildTimes[buildTime] = myBuildTimes.getOrDefault(buildTime, 0) + timeNs
}
fun asMap(): Map<BuildTime, Long> = myBuildTimes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2010-2020 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.build.report.metrics
object DoNothingBuildMetricsReporter : BuildMetricsReporter {
override fun startMeasure(metric: BuildTime, startNs: Long) {
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
}
override fun addAttribute(attribute: BuildAttribute) {
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
BuildTimes(),
BuildAttributes()
)
override fun addMetrics(metrics: BuildMetrics?) {}
}

View File

@@ -0,0 +1,11 @@
/*
* Copyright 2010-2020 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.build.report.metrics
import org.jetbrains.kotlin.build.report.RemoteReporter
interface RemoteBuildMetricsReporter : BuildMetricsReporter,
RemoteReporter

View File

@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.deserialization.supertypes
@@ -34,12 +35,15 @@ interface IncrementalCacheCommon {
val thisWithDependentCaches: Iterable<AbstractIncrementalCache<*>>
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName>
fun getSubtypesOf(className: FqName): Sequence<FqName>
fun getSupertypesOf(className: FqName): Sequence<FqName>
fun getSourceFileIfClass(fqName: FqName): File?
fun markDirty(removedAndCompiledSources: Collection<File>)
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
fun getComplementaryFilesRecursive(dirtyFiles: Collection<File>): Collection<File>
fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl)
fun dump(): String
fun isSealed(className: FqName): Boolean?
}
/**
@@ -50,6 +54,7 @@ abstract class AbstractIncrementalCache<ClassName>(
protected val pathConverter: FileToPathConverter
) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
companion object {
private val CLASS_ATTRIBUTES = "class-attributes"
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
@@ -71,6 +76,7 @@ abstract class AbstractIncrementalCache<ClassName>(
result
}
internal val classAttributesMap = registerMap(ClassAttributesMap(CLASS_ATTRIBUTES.storageFile))
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile, pathConverter))
@@ -90,6 +96,14 @@ abstract class AbstractIncrementalCache<ClassName>(
override fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
override fun getSupertypesOf(className: FqName): Sequence<FqName> {
return supertypesMap[className].asSequence()
}
override fun isSealed(className: FqName): Boolean? {
return classAttributesMap[className]?.isSealed
}
override fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
@@ -118,6 +132,7 @@ abstract class AbstractIncrementalCache<ClassName>(
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
classAttributesMap[child] = ICClassesAttributes(ProtoBuf.Modality.SEALED == Flags.MODALITY.get(proto.flags))
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
@@ -152,14 +167,17 @@ abstract class AbstractIncrementalCache<ClassName>(
}
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
removedFqNames.forEach {
classFqNameToSourceMap.remove(it)
classAttributesMap.remove(it)
}
}
protected class ClassFqNameToSourceMap(
storageFile: File,
private val pathConverter: FileToPathConverter
) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = pathConverter.toPath(sourceFile)
}

View File

@@ -19,12 +19,14 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.supertypes
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.getClassId
class ChangesCollector {
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()
private val changedParents = hashMapOf<FqName, MutableSet<FqName>>()
private val changedMembers = hashMapOf<FqName, MutableSet<String>>()
private val areSubclassesAffected = hashMapOf<FqName, Boolean>()
@@ -47,6 +49,10 @@ class ChangesCollector {
changes.add(ChangeInfo.SignatureChanged(fqName, areSubclassesAffected))
}
for ((fqName, changedParents) in changedParents) {
changes.add(ChangeInfo.ParentsChanged(fqName, changedParents))
}
return changes
}
@@ -79,12 +85,12 @@ class ChangesCollector {
}
if (oldData == null) {
newData!!.collectAll(isRemoved = false, collectAllMembersForNewClass = collectAllMembersForNewClass)
newData!!.collectAll(isRemoved = false, isAdded = true, collectAllMembersForNewClass = collectAllMembersForNewClass)
return
}
if (newData == null) {
oldData.collectAll(isRemoved = true)
oldData.collectAll(isRemoved = true, isAdded = false)
return
}
@@ -98,6 +104,7 @@ class ChangesCollector {
collectSignature(oldData, diff.areSubclassesAffected)
}
collectChangedMembers(fqName, diff.changedMembersNames)
addChangedParents(fqName, diff.changedSupertypes)
}
is PackagePartProtoData -> {
collectSignature(oldData, areSubclassesAffected = true)
@@ -121,10 +128,11 @@ class ChangesCollector {
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
private fun ProtoData.collectAll(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) =
//TODO remember all sealed parent classes
private fun ProtoData.collectAll(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) =
when (this) {
is PackagePartProtoData -> collectAllFromPackage(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved, collectAllMembersForNewClass)
is ClassProtoData -> collectAllFromClass(isRemoved, isAdded, collectAllMembersForNewClass)
}
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
@@ -143,7 +151,7 @@ class ChangesCollector {
}
}
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) {
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) {
val classFqName = nameResolver.getClassId(proto.fqName).asSingleFqName()
val kind = Flags.CLASS_KIND.get(proto.flags)
@@ -162,6 +170,23 @@ class ChangesCollector {
collectSignature(classFqName, areSubclassesAffected = true)
}
if (isRemoved || isAdded) {
collectChangedParents(classFqName, proto.supertypeList)
}
}
private fun addChangedParents(fqName: FqName, parents: Collection<FqName>) {
if (parents.isNotEmpty()) {
changedParents.getOrPut(fqName) { HashSet() }.addAll(parents)
}
}
private fun ClassProtoData.collectChangedParents(fqName: FqName, parents: Collection<ProtoBuf.Type>) {
val changedParentsFqNames = parents.map { type ->
nameResolver.getClassId(type.className).asSingleFqName()
}
addChangedParents(fqName, changedParentsFqNames)
}
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {

View File

@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.name.parentOrNull
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import java.io.DataInput
import java.io.DataOutput
import java.io.File
@@ -75,7 +76,7 @@ open class IncrementalJsCache(
override fun markDirty(removedAndCompiledSources: Collection<File>) {
removedAndCompiledSources.forEach { sourceFile ->
// The common prefix of all FQN parents has to be the file package
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minBy { it.length }?.let {
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minByOrNull { it.length }?.let {
packageMetadata.remove(it)
}
}
@@ -326,7 +327,7 @@ private class ProtoDataProvider(private val serializerProtocol: SerializerExtens
proto.`package`.apply {
val packageNameId = getExtensionOrNull(serializerProtocol.packageFqName)
val packageFqName = packageNameId?.let { FqName(nameResolver.getPackageFqName(it)) } ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -347,7 +348,7 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -412,4 +413,4 @@ private class PackageMetadataMap(storageFile: File) : BasicStringMap<ByteArray>(
operator fun get(packageName: String) = storage[packageName]
override fun dumpValue(value: ByteArray): String = "Package metadata: ${value.md5()}"
}
}

View File

@@ -145,6 +145,7 @@ open class IncrementalJvmCache(
}
protoMap.remove(className, changesCollector)
classFqNameToSourceMap.remove(className.fqNameForClassNameWithoutDollars)
classAttributesMap.remove(className.fqNameForClassNameWithoutDollars)
internalNameToSource.remove(className.internalName)
// TODO NO_CHANGES? (delegates only)
@@ -168,6 +169,8 @@ open class IncrementalJvmCache(
constantsMap.process(kotlinClass, changesCollector)
inlineFunctionsMap.process(kotlinClass, changesCollector)
}
KotlinClassHeader.Kind.UNKNOWN, KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
}
}
}
@@ -269,6 +272,7 @@ open class IncrementalJvmCache(
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
return put(kotlinClass, changesCollector)
}
@@ -280,10 +284,12 @@ open class IncrementalJvmCache(
// from files compiled during last round.
// However there is no need to compare old and new data in this case
// (also that would fail with exception).
@Synchronized
fun storeModuleMapping(className: JvmClassName, bytes: ByteArray) {
storage[className.internalName] = ProtoMapValue(isPackageFacade = false, bytes = bytes, strings = emptyArray())
}
@Synchronized
private fun put(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val header = kotlinClass.classHeader
@@ -306,6 +312,7 @@ open class IncrementalJvmCache(
operator fun get(className: JvmClassName): ProtoMapValue? =
storage[className.internalName]
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -322,6 +329,8 @@ open class IncrementalJvmCache(
private inner class JavaSourcesProtoMap(storageFile: File) :
BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
@Synchronized
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
@@ -333,6 +342,7 @@ open class IncrementalJvmCache(
)
}
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -372,6 +382,7 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -388,6 +399,7 @@ open class IncrementalJvmCache(
}
}
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -520,6 +532,7 @@ open class IncrementalJvmCache(
return result
}
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -545,6 +558,7 @@ open class IncrementalJvmCache(
private fun functionNameBySignature(signature: String): String =
signature.substringBefore("(")
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -566,6 +580,7 @@ sealed class ChangeInfo(val fqName: FqName) {
class SignatureChanged(fqName: FqName, val areSubclassesAffected: Boolean) : ChangeInfo(fqName)
class ParentsChanged(fqName: FqName, val parentsChanged: Collection<FqName>) : ChangeInfo(fqName)
protected open fun toStringProperties(): String = "fqName = $fqName"

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.java.JavaVisibilities
import org.jetbrains.kotlin.load.java.JavaDescriptorVisibilities
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
@@ -41,7 +41,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeClass(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateClass, true)
}
}
@@ -50,7 +50,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
proto: ProtoBuf.Constructor.Builder,
childSerializer: DescriptorSerializer) {
super.serializeConstructor(descriptor, proto, childSerializer)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateConstructor, true)
}
}
@@ -62,7 +62,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeFunction(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateMethod, true)
}
@@ -78,7 +78,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeProperty(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateField, true)
}

View File

@@ -23,12 +23,12 @@ import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
class LocalFileKotlinClass private constructor(
private val file: File,
private val fileContents: ByteArray,
className: ClassId,
classVersion: Int,
classHeader: KotlinClassHeader,
innerClasses: InnerClassesInfo
private val file: File,
private val fileContents: ByteArray,
className: ClassId,
classVersion: Int,
classHeader: KotlinClassHeader,
innerClasses: InnerClassesInfo
) : FileBasedKotlinClass(className, classVersion, classHeader, innerClasses) {
companion object {

View File

@@ -17,19 +17,18 @@
package org.jetbrains.kotlin.incremental
import com.intellij.util.containers.MultiMap
import com.intellij.util.containers.StringInterner
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.createStringInterner
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
import java.io.IOException
import java.util.*
open class LookupStorage(
targetDataDir: File,
pathConverter: FileToPathConverter
@@ -80,7 +79,7 @@ open class LookupStorage(
for (lookupSymbol in lookups.keySet().sorted()) {
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
val paths = lookups[lookupSymbol]!!
val paths = lookups[lookupSymbol]
val fileIds = paths.mapTo(TreeSet()) { pathToId[it]!! }
fileIds.addAll(lookupMap[key] ?: emptySet())
lookupMap[key] = fileIds
@@ -212,8 +211,8 @@ open class LookupStorage(
class LookupTrackerImpl(private val delegate: LookupTracker) : LookupTracker {
val lookups = MultiMap.createSet<LookupSymbol, String>()
val pathInterner = StringInterner()
private val interner = StringInterner()
val pathInterner = createStringInterner()
private val interner = createStringInterner()
override val requiresPosition: Boolean
get() = delegate.requiresPosition

View File

@@ -14,6 +14,8 @@
* limitations under the License.
*/
@file:Suppress("UNUSED_PARAMETER")
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf

View File

@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.build.JvmSourceRoot
import org.jetbrains.kotlin.build.isModuleMappingFile
import org.jetbrains.kotlin.build.report.ICReporter
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
@@ -31,6 +32,7 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus
import org.jetbrains.kotlin.resolve.sam.SAM_LOOKUP_NAME
import org.jetbrains.kotlin.utils.addToStdlib.flattenTo
import java.io.File
import java.nio.file.Files
import java.util.*
import kotlin.collections.HashSet
import kotlin.collections.LinkedHashSet
@@ -66,7 +68,7 @@ fun makeModuleFile(
friendDirs
)
val scriptFile = File.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml")
val scriptFile = Files.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml").toFile()
scriptFile.writeText(builder.asText().toString())
return scriptFile
}
@@ -134,7 +136,8 @@ fun LookupStorage.update(
data class DirtyData(
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
val dirtyClassesFqNames: Collection<FqName> = emptyList()
val dirtyClassesFqNames: Collection<FqName> = emptyList(),
val dirtyClassesFqNamesForceRecompile: Collection<FqName> = emptyList()
)
fun ChangesCollector.getDirtyData(
@@ -144,6 +147,9 @@ fun ChangesCollector.getDirtyData(
val dirtyLookupSymbols = HashSet<LookupSymbol>()
val dirtyClassesFqNames = HashSet<FqName>()
val sealedParents = HashMap<FqName, MutableSet<FqName>>()
val notSealedParents = HashSet<FqName>()
for (change in changes()) {
reporter.reportVerbose { "Process $change" }
@@ -168,10 +174,35 @@ fun ChangesCollector.getDirtyData(
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(SAM_LOOKUP_NAME.asString(), it.asString()) }
} else if (change is ChangeInfo.ParentsChanged) {
fun FqName.isSealed(): Boolean {
if (notSealedParents.contains(this)) return false
if (sealedParents.containsKey(this)) return true
return isSealed(this, caches).also { sealed ->
if (sealed) {
sealedParents[this] = HashSet()
} else {
notSealedParents.add(this)
}
}
}
change.parentsChanged.forEach { parent ->
if (parent.isSealed()) {
sealedParents.getOrPut(parent) { HashSet() }.add(change.fqName)
}
}
}
}
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames)
val forceRecompile = HashSet<FqName>().apply {
addAll(sealedParents.keys)
//we should recompile all inheritors with parent sealed class: add known subtypes
addAll(sealedParents.keys.flatMap { withSubtypes(it, caches) })
//we should recompile all inheritors with parent sealed class: add new subtypes
addAll(sealedParents.values.flatten())
}
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames, forceRecompile)
}
fun mapLookupSymbolsToFiles(
@@ -215,6 +246,11 @@ fun mapClassesFqNamesToFiles(
return fqNameToAffectedFiles.values.flattenTo(HashSet())
}
fun isSealed(
fqName: FqName,
caches: Iterable<IncrementalCacheCommon>
): Boolean = caches.any { it.isSealed(fqName) ?: false }
fun withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon>

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
@@ -27,12 +27,15 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
data class Difference(
val isClassAffected: Boolean = false,
val areSubclassesAffected: Boolean = false,
val changedMembersNames: Set<String> = emptySet()
val changedMembersNames: Set<String> = emptySet(),
val changedSupertypes: Set<FqName> = emptySet()
)
sealed class ProtoData
@@ -49,8 +52,8 @@ fun ProtoMapValue.toProtoData(packageFqName: FqName): ProtoData =
}
internal val MessageLite.isPrivate: Boolean
get() = Visibilities.isPrivate(
ProtoEnumFlags.visibility(
get() = DescriptorVisibilities.isPrivate(
ProtoEnumFlags.descriptorVisibility(
when (this) {
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
@@ -186,6 +189,7 @@ class DifferenceCalculatorForClass(
var isClassAffected = false
var areSubclassesAffected = false
val changedSupertypes = HashSet<FqName>()
val names = hashSetOf<String>()
val classIsSealed = newProto.isSealed && oldProto.isSealed
@@ -246,12 +250,21 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.FLAGS,
ProtoBufClassKind.FQ_NAME,
ProtoBufClassKind.TYPE_PARAMETER_LIST,
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST,
ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST -> {
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST -> {
isClassAffected = true
areSubclassesAffected = true
val oldSupertypes = oldProto.supertypeList.map { oldNameResolver.getClassId(it.className).asSingleFqName() }
val newSupertypes = newProto.supertypeList.map { newNameResolver.getClassId(it.className).asSingleFqName() }
val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes)
changedSupertypes.addAll(changed)
}
ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME,
ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> {
// TODO
@@ -280,7 +293,7 @@ class DifferenceCalculatorForClass(
}
}
return Difference(isClassAffected, areSubclassesAffected, names)
return Difference(isClassAffected, areSubclassesAffected, names, changedSupertypes)
}
}
@@ -346,4 +359,4 @@ val ProtoBuf.Class.typeTableOrNull: ProtoBuf.TypeTable?
get() = if (hasTypeTable()) typeTable else null
val ProtoBuf.Package.typeTableOrNull: ProtoBuf.TypeTable?
get() = if (hasTypeTable()) typeTable else null
get() = if (hasTypeTable()) typeTable else null

View File

@@ -30,6 +30,7 @@ open class BasicMapsOwner(val cachesDir: File) {
protected val String.storageFile: File
get() = File(cachesDir, this + "." + CACHE_EXTENSION)
@Synchronized
protected fun <K, V, M : BasicMap<K, V>> registerMap(map: M): M {
maps.add(map)
return map
@@ -47,6 +48,7 @@ open class BasicMapsOwner(val cachesDir: File) {
forEachMapSafe("flush") { it.flush(memoryCachesOnly) }
}
@Synchronized
private fun forEachMapSafe(actionName: String, action: (BasicMap<*, *>) -> Unit) {
val actionExceptions = LinkedHashMap<String, Exception>()
maps.forEach {
@@ -66,5 +68,6 @@ open class BasicMapsOwner(val cachesDir: File) {
}
@TestOnly
@Synchronized
fun dump(): String = maps.joinToString("\n\n") { it.dump() }
}

View File

@@ -17,9 +17,11 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
import java.io.IOException
/**
@@ -30,7 +32,6 @@ class CachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
@@ -80,8 +81,10 @@ class CachingLazyStorage<K, V>(
try {
storage?.close()
} finally {
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
}
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.name.FqName
import java.io.DataInput
import java.io.DataOutput
import java.io.File
internal data class ICClassesAttributes(val isSealed: Boolean)
internal object ICClassesAttributesExternalizer : DataExternalizer<ICClassesAttributes> {
override fun read(input: DataInput): ICClassesAttributes {
return ICClassesAttributes(input.readBoolean())
}
override fun save(output: DataOutput, value: ICClassesAttributes) {
output.writeBoolean(value.isSealed)
}
}
internal open class ClassAttributesMap(
storageFile: File
) : BasicStringMap<ICClassesAttributes>(storageFile, ICClassesAttributesExternalizer) {
override fun dumpValue(value: ICClassesAttributes): String = value.toString()
operator fun set(key: FqName, value: ICClassesAttributes) {
storage[key.asString()] = value
}
operator fun get(key: FqName): ICClassesAttributes? = storage[key.asString()]
fun remove(key: FqName) {
storage.remove(key.asString())
}
}

View File

@@ -20,18 +20,18 @@ import org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import java.io.File
internal open class ClassOneToManyMap(
storageFile: File
) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
@Synchronized
fun add(key: FqName, value: FqName) {
storage.append(key.asString(), listOf(value.asString()))
}
operator fun get(key: FqName): Collection<FqName> =
storage[key.asString()]?.map(::FqName) ?: setOf()
storage[key.asString()]?.map(::FqName) ?: setOf()
@Synchronized
operator fun set(key: FqName, values: Collection<FqName>) {
if (values.isEmpty()) {
remove(key)
@@ -41,10 +41,14 @@ internal open class ClassOneToManyMap(
storage[key.asString()] = values.map(FqName::asString)
}
@Synchronized
fun remove(key: FqName) {
storage.remove(key.asString())
}
// Access to caches could be done from multiple threads (e.g. JPS worker and RMI). The underlying collection is already synchronized,
// thus we need synchronization of this method and all modification methods.
@Synchronized
fun removeValues(key: FqName, removed: Set<FqName>) {
val notRemoved = this[key].filter { it !in removed }
this[key] = notRemoved

View File

@@ -25,8 +25,7 @@ internal class DirtyClassesJvmNameMap(storageFile: File) : AbstractDirtyClassesM
internal class DirtyClassesFqNameMap(storageFile: File) : AbstractDirtyClassesMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractDirtyClassesMap<Name>(
private val nameTransformer: NameTransformer<Name>,
storageFile: File
private val nameTransformer: NameTransformer<Name>, storageFile: File
) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: Name) {
storage[nameTransformer.asString(className)] = true
@@ -37,10 +36,10 @@ internal abstract class AbstractDirtyClassesMap<Name>(
}
fun getDirtyOutputClasses(): Collection<Name> =
storage.keys.map { nameTransformer.asName(it) }
storage.keys.map { nameTransformer.asName(it) }
fun isDirty(className: Name): Boolean =
storage.contains(nameTransformer.asString(className))
storage.contains(nameTransformer.asString(className))
override fun dumpValue(value: Boolean) = ""
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2010-2020 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.incremental.storage
import java.io.File
open class IncrementalFileToPathConverter(val rootProjectDir: File?) : FileToPathConverter {
//project root dir
private val projectDirPath = rootProjectDir?.normalize()?.absolutePath
override fun toPath(file: File): String {
val path = file.normalize().absolutePath
return when {
projectDirPath == null || !path.startsWith(projectDirPath) -> path
else -> PROJECT_DIR_PLACEHOLDER + path.substring(projectDirPath.length)
}
}
override fun toFile(path: String): File =
when {
rootProjectDir != null && path.startsWith(PROJECT_DIR_PLACEHOLDER) -> rootProjectDir.resolve(path.substring(PATH_PREFIX.length))
else -> File(path)
}
private companion object {
private const val PROJECT_DIR_PLACEHOLDER = "${'$'}PROJECT_DIR$"
//use only for prefix length because it OS dependent
private const val PATH_PREFIX = "$PROJECT_DIR_PLACEHOLDER/"
}
}

View File

@@ -17,9 +17,11 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
import java.io.IOException
class NonCachingLazyStorage<K, V>(
@@ -27,7 +29,6 @@ class NonCachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
@@ -76,11 +77,12 @@ class NonCachingLazyStorage<K, V>(
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
} finally {
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized

View File

@@ -1,106 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.JpsPersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: JpsPersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): JpsPersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): JpsPersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendDataWithoutCache(key, value)
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
JpsPersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): JpsPersistentHashMap<K, V> =
JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
@@ -34,10 +33,7 @@ class BuildMetaInfoTest : TestCase() {
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
@@ -71,14 +67,12 @@ class BuildMetaInfoTest : TestCase() {
@Test
fun testJvmEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo.create(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo.create(args2)
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
assertEquals(info1, info2)
assertEquals(info1, info2.copy())
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2010-2020 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.incremental.storage
import org.jetbrains.kotlin.TestWithWorkingDir
import org.junit.Test
import java.io.File
internal class IncrementalFileToPathConverterTest : TestWithWorkingDir() {
val separator: String = File.separator
@Test
fun testPathTransform() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testComplicatedProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("first$separator..${separator}testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testInccorectProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir$separator"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testFileOutOfProject() {
val relativeFilePath = "..${separator}testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${workingDir.absolutePath}${separator}testFile.txt", transformedPath)
}
@Test
fun testFileWithExtraSlash() {
val relativeFilePath = "testFile.txt$separator"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}${separator}testFile.txt", transformedPath)
}
private fun testPathTransformation(projectRoot: File, relativeFilePath: String): String {
val pathConverter = IncrementalFileToPathConverter(projectRoot)
val testFile = projectRoot.resolve(relativeFilePath)
val transformedPath = pathConverter.toPath(testFile)
assertEquals(testFile.normalize().absolutePath, pathConverter.toFile(transformedPath).normalize().absolutePath)
return transformedPath
}
}

View File

@@ -22,12 +22,12 @@ data class BuildLogFinder(
private val isDataContainerBuildLogEnabled: Boolean = false,
private val isGradleEnabled: Boolean = false,
private val isJsEnabled: Boolean = false,
private val isJsIrEnabled: Boolean = false, // TODO rename as it is used for metadata-only test
private val isScopeExpansionEnabled: Boolean = false
private val isScopeExpansionEnabled: Boolean = false,
private val isKlibEnabled: Boolean = false
) {
companion object {
private const val JS_LOG = "js-build.log"
private const val JS_IR_LOG = "js-ir-build.log"
private const val KLIB_LOG = "klib-build.log"
private const val SCOPE_EXPANDING_LOG = "build-with-scope-expansion.log"
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
@@ -43,7 +43,7 @@ data class BuildLogFinder(
val files = names.filter { File(dir, it).isFile }.toSet()
val matchedName = when {
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
isJsIrEnabled && JS_IR_LOG in files -> JS_IR_LOG
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
isJsEnabled && JS_LOG in files -> JS_LOG
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG

View File

@@ -151,29 +151,35 @@ private fun classFileToString(classFile: File): String {
val traceVisitor = TraceClassVisitor(PrintWriter(out))
ClassReader(classFile.readBytes()).accept(traceVisitor, 0)
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader ?: return ""
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
val annotationDataEncoded = classHeader?.data
if (annotationDataEncoded != null) {
ByteArrayInputStream(BitEncoding.decodeBytes(annotationDataEncoded)).use {
input ->
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.CLASS, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
ByteArrayInputStream(BitEncoding.decodeBytes(classHeader.data!!)).use { input ->
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> throw IllegalStateException()
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> error(classHeader.kind)
}
}
}
KotlinClassHeader.Kind.MULTIFILE_CLASS -> {
out.write("\n------ multi-file facade data -----\n")
out.write(classHeader.data!!.joinToString("\n"))
}
KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
// Synthetic class has no metadata, thus there can be no differences in it.
}
KotlinClassHeader.Kind.UNKNOWN -> error("Should not meet unknown classes here: $classFile")
}
return out.toString()

View File

@@ -17258,6 +17258,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
boolean hasFlags();
@@ -17268,6 +17269,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
int getFlags();
@@ -17463,6 +17465,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -17475,6 +17478,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -17894,6 +17898,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -17906,6 +17911,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -17918,6 +17924,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public Builder setFlags(int value) {
@@ -17933,6 +17940,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public Builder clearFlags() {
@@ -18307,6 +18315,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
boolean hasFlags();
@@ -18325,6 +18334,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
int getFlags();
@@ -18723,6 +18733,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -18743,6 +18754,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -19639,6 +19651,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -19659,6 +19672,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -19679,6 +19693,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public Builder setFlags(int value) {
@@ -19702,6 +19717,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public Builder clearFlags() {

View File

@@ -4656,7 +4656,8 @@ public final class DebugJvmProtoBuf {
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*
* <pre>
* isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* first bit: isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* second bit: is all-compatibility mode or not, 1 - yes, 0 - no
* </pre>
*/
public static final

View File

@@ -7,7 +7,7 @@ import proguard.gradle.ProGuardTask
buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
bootstrapKotlinRepo?.let(::maven)
@@ -27,9 +27,11 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2")
}
}
@@ -50,7 +52,6 @@ pill {
excludedDirs(
"out",
"buildSrc/build",
"buildSrc/prepare-deps/android-dx/build",
"buildSrc/prepare-deps/intellij-sdk/build"
)
}
@@ -72,7 +73,7 @@ val kotlinVersion by extra(
} ?: buildNumber
)
val kotlinLanguageVersion by extra("1.4")
val kotlinLanguageVersion by extra("1.5")
allprojects {
group = "org.jetbrains.kotlin"
@@ -164,21 +165,19 @@ extra["versions.jansi"] = "1.16"
extra["versions.jline"] = "3.3.1"
extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.ant"] = "1.10.7"
extra["versions.android"] = "2.3.1"
val coroutinesVersion = if (Platform[192].orHigher()) "1.3.7" else "1.1.1"
extra["versions.kotlinx-coroutines-core"] = coroutinesVersion
extra["versions.kotlinx-coroutines-jdk8"] = coroutinesVersion
extra["versions.kotlinx-coroutines-core"] = "1.3.8"
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.8"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
extra["versions.robolectric"] = "4.0"
extra["versions.org.springframework"] = "4.2.0.RELEASE"
extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.2"
extra["versions.r8"] = "1.5.70"
extra["versions.completion-ranking-kotlin"] = "0.1.3"
extra["versions.r8"] = "2.0.88"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -187,13 +186,14 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.4-M3-dev-15627"
extra["versions.kotlin-native"] = "1.5-dev-17775"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.getBooleanProperty("kotlin.build.useIR") ?: false)
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
val useJvmFir by extra(project.kotlinBuildProperties.useFir)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -221,6 +221,8 @@ extra["compilerModules"] = arrayOf(
":compiler:config",
":compiler:config.jvm",
":compiler:container",
":compiler:resolution.common",
":compiler:resolution.common.jvm",
":compiler:resolution",
":compiler:serialization",
":compiler:psi",
@@ -229,6 +231,8 @@ extra["compilerModules"] = arrayOf(
":compiler:frontend.java",
":compiler:cli-common",
":compiler:ir.tree",
":compiler:ir.tree.impl",
":compiler:ir.tree.persistent",
":compiler:ir.psi2ir",
":compiler:ir.backend.common",
":compiler:backend.jvm",
@@ -263,17 +267,22 @@ extra["compilerModules"] = arrayOf(
":kotlin-build-common",
":core:metadata",
":core:metadata.jvm",
":core:deserialization.common",
":core:deserialization.common.jvm",
":core:compiler.common",
":core:compiler.common.jvm",
":compiler:backend.common.jvm",
":core:descriptors",
":core:descriptors.jvm",
":core:descriptors.runtime",
":core:deserialization",
":core:util.runtime",
":core:type-system",
":compiler:fir:cones",
":compiler:fir:resolve",
":compiler:fir:fir-serialization",
":compiler:fir:fir-deserialization",
":compiler:fir:tree",
":compiler:fir:raw-fir:fir-common",
":compiler:fir:raw-fir:raw-fir.common",
":compiler:fir:raw-fir:psi2fir",
":compiler:fir:raw-fir:light-tree2fir",
":compiler:fir:fir2ir",
@@ -281,11 +290,13 @@ extra["compilerModules"] = arrayOf(
":compiler:fir:java",
":compiler:fir:jvm",
":compiler:fir:checkers",
":compiler:fir:analysis-tests"
":compiler:fir:entrypoint",
":compiler:fir:analysis-tests",
":compiler:fir:analysis-tests:legacy-fir-tests",
":wasm:wasm.ir"
)
extra["compilerModulesForJps"] = listOf(
":core:type-system",
":kotlin-build-common",
":kotlin-util-io",
":kotlin-util-klib",
@@ -294,6 +305,8 @@ extra["compilerModulesForJps"] = listOf(
":kotlin-compiler-runner",
":daemon-common",
":daemon-common-new",
":core:compiler.common",
":core:compiler.common.jvm",
":core:descriptors",
":core:descriptors.jvm",
":idea:idea-jps-common",
@@ -306,12 +319,33 @@ extra["compilerModulesForJps"] = listOf(
":compiler:compiler.version"
)
// TODO: fix remaining warnings and remove this property.
extra["tasksWithWarnings"] = listOf(
":kotlin-stdlib:compileTestKotlin",
":kotlin-stdlib-jdk7:compileTestKotlin",
":kotlin-stdlib-jdk8:compileTestKotlin",
":compiler:cli:compileKotlin",
":compiler:frontend:compileKotlin",
":compiler:fir:tree:compileKotlin",
":compiler:fir:resolve:compileKotlin",
":compiler:fir:checkers:compileKotlin",
":compiler:fir:java:compileKotlin",
":kotlin-scripting-compiler:compileKotlin",
":kotlin-scripting-compiler:compileTestKotlin",
":plugins:uast-kotlin:compileKotlin",
":plugins:uast-kotlin:compileTestKotlin",
":plugins:uast-kotlin-idea:compileKotlin"
)
val tasksWithWarnings: List<String> by extra
val coreLibProjects = listOfNotNull(
":kotlin-stdlib",
":kotlin-stdlib-common",
":kotlin-stdlib-js",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test",
":kotlin-test:kotlin-test-annotations-common",
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
@@ -319,8 +353,7 @@ val coreLibProjects = listOfNotNull(
":kotlin-test:kotlin-test-junit5",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-reflect",
":kotlin-coroutines-experimental-compat"
":kotlin-reflect"
)
val gradlePluginProjects = listOf(
@@ -329,7 +362,8 @@ val gradlePluginProjects = listOf(
":kotlin-allopen",
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-sam-with-receiver"
":kotlin-sam-with-receiver",
":kotlin-parcelize-compiler"
)
apply {
@@ -353,7 +387,7 @@ fun Task.listConfigurationContents(configName: String) {
}
val defaultJvmTarget = "1.8"
val defaultJavaHome = jdkPath(defaultJvmTarget)
val defaultJavaHome = jdkPath(if (Platform[203].orHigher()) "11" else defaultJvmTarget)
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
allprojects {
@@ -393,8 +427,7 @@ allprojects {
jcenter()
maven(protobufRepo)
maven(intellijRepo)
maven("https://dl.bintray.com/kotlin/ktor")
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://dl.google.com/dl/android/maven2")
bootstrapKotlinRepo?.let(::maven)
@@ -431,6 +464,26 @@ allprojects {
if (useJvmIrBackend) {
useIR = true
}
if (useJvmFir) {
freeCompilerArgs += "-Xuse-fir"
freeCompilerArgs += "-Xabi-stability=stable"
}
}
}
if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir) {
// For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects
// (compiler/build.gradle.kts and libraries/commonConfiguration.gradle).
val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile }
if (projectsWithWarningsAsErrors.any(projectDir::startsWith)) {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
if (path !in tasksWithWarnings) {
kotlinOptions {
allWarningsAsErrors = true
}
}
}
}
}
@@ -452,7 +505,7 @@ allprojects {
}
tasks.withType<Test> {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
}
normalization {
@@ -510,6 +563,23 @@ allprojects {
}
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
apply(from = "$rootDir/gradle/testRetry.gradle.kts")
}
}
gradle.buildFinished {
val taskGraph = gradle?.taskGraph
if (taskGraph != null) {
taskGraph.allTasks
.filterIsInstance<SourceTask>()
.filter { it.didWork }
.forEach {
it.source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
}
}
@@ -519,10 +589,11 @@ gradle.taskGraph.whenReady {
val proguardMessage = "proguard is ${kotlinBuildProperties.proguard.toOnOff()}"
val jarCompressionMessage = "jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()}"
val profileMessage = "$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
logger.warn("\n\n$profileMessage")
logger.warn(
"$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
)
allTasks.filterIsInstance<org.gradle.jvm.tasks.Jar>().forEach { task ->
task.entryCompression = if (kotlinBuildProperties.jarCompression)
@@ -537,7 +608,7 @@ val dist = tasks.register("dist") {
}
val syncMutedTests = tasks.register("syncMutedTests") {
dependsOn(":compiler:tests-mutes:run")
dependsOn(":compiler:tests-mutes:tc-integration:run")
}
val copyCompilerToIdeaPlugin by task<Copy> {
@@ -567,7 +638,10 @@ tasks {
listOf("clean", "assemble", "install").forEach { taskName ->
register("coreLibs${taskName.capitalize()}") {
coreLibProjects.forEach { projectName -> dependsOn("$projectName:$taskName") }
for (projectName in coreLibProjects) {
if (projectName.startsWith(":kotlin-test:") && taskName == "install") continue
dependsOn("$projectName:$taskName")
}
}
}
@@ -598,6 +672,7 @@ tasks {
dependsOn("dist")
dependsOn(
":compiler:test",
":compiler:tests-common-new:test",
":compiler:container:test",
":compiler:tests-java8:test",
":compiler:tests-spec:test",
@@ -619,8 +694,11 @@ tasks {
}
register("wasmCompilerTest") {
// TODO: fix once
// dependsOn(":js:js.tests:wasmTest")
dependsOn(":js:js.tests:wasmTest")
// Windows WABT release requires Visual C++ Redistributable
if (!kotlinBuildProperties.isTeamcityBuild || !org.gradle.internal.os.OperatingSystem.current().isWindows) {
dependsOn(":wasm:wasm.ir:test")
}
}
register("nativeCompilerTest") {
@@ -631,6 +709,7 @@ tasks {
dependsOn(":compiler:fir:raw-fir:psi2fir:test")
dependsOn(":compiler:fir:raw-fir:light-tree2fir:test")
dependsOn(":compiler:fir:analysis-tests:test")
dependsOn(":compiler:fir:analysis-tests:legacy-fir-tests:test")
dependsOn(":compiler:fir:fir2ir:test")
}
@@ -640,6 +719,7 @@ tasks {
":compiler:fir:raw-fir:psi2fir:test",
":compiler:fir:raw-fir:light-tree2fir:test",
":compiler:fir:analysis-tests:test",
":compiler:fir:analysis-tests:legacy-fir-tests:test",
":compiler:fir:fir2ir:test",
":plugins:fir:fir-plugin-prototype:test"
)
@@ -675,7 +755,6 @@ tasks {
}
register("miscCompilerTest") {
dependsOn("wasmCompilerTest")
dependsOn("nativeCompilerTest")
dependsOn("firCompilerTest")
@@ -683,9 +762,12 @@ tasks {
dependsOn("scriptingTest")
dependsOn(":kotlin-build-common:test")
dependsOn(":compiler:incremental-compilation-impl:test")
dependsOn(":compiler:incremental-compilation-impl:testJvmICWithJdk11")
dependsOn(":core:descriptors.runtime:test")
dependsOn("jvmCompilerIntegrationTest")
dependsOn(":plugins:parcelize:parcelize-compiler:test")
}
register("toolsTest") {
@@ -721,11 +803,6 @@ tasks {
dependsOn(":jps-plugin:test")
}
register("idea-plugin-main-tests") {
dependsOn("dist")
dependsOn(":idea:test")
}
register("idea-plugin-additional-tests") {
dependsOn("dist")
dependsOn(
@@ -742,7 +819,6 @@ tasks {
if (Ide.IJ()) {
register("idea-new-project-wizard-tests") {
dependsOn("dist")
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
@@ -751,37 +827,57 @@ tasks {
}
}
register("idea-plugin-tests") {
dependsOn("dist")
register("idea-plugin-performance-tests") {
dependsOn(
"idea-plugin-main-tests",
"idea-plugin-additional-tests"
"dist",
":idea:performanceTests:performanceTest",
":idea:performanceTests:aggregateResults"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
}
}
register("idea-plugin-performance-tests") {
register("idea-fir-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
":idea:performanceTests:performanceTest"
":idea:idea-fir-performance-tests:ideaFirPerformanceTest"
)
}
register("idea-fir-plugin-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-fir:test",
":idea:idea-frontend-api:test",
":idea:idea-frontend-fir:test",
":idea:idea-frontend-fir:idea-fir-low-level-api:test"
)
}
register("android-ide-tests") {
dependsOn("dist")
dependsOn(
":plugins:android-extensions-ide:test",
":idea:idea-android:test",
":kotlin-annotation-processing:test"
":kotlin-annotation-processing:test",
":plugins:parcelize:parcelize-ide:test"
)
}
register("plugins-tests") {
dependsOn("dist")
register("ideaPluginTest") {
dependsOn(
"mainIdeTests",
"gradleIdeTest",
"kaptIdeTest",
"miscIdeTests"
)
}
register("mainIdeTests") {
dependsOn(":idea:test")
}
register("miscIdeTests") {
dependsOn(
":kotlin-annotation-processing:test",
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
@@ -789,30 +885,30 @@ tasks {
":kotlin-annotation-processing-gradle:test",
":kotlinx-serialization-compiler-plugin:test",
":kotlinx-serialization-ide-plugin:test",
":idea:jvm-debugger:jvm-debugger-test:test"
)
}
register("ideaPluginTest") {
dependsOn(
"gradleIdeTest",
"androidIdeTest",
"miscIdeTests"
)
}
register("miscIdeTests") {
dependsOn(
"idea-plugin-tests",
":idea:jvm-debugger:jvm-debugger-test:test",
"idea-plugin-additional-tests",
"jps-tests",
"plugins-tests",
":generators:test"
)
if (Ide.IJ()) {
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
)
}
}
register("androidIdeTest") {
dependsOn("android-ide-tests")
register("ideaIntegrationsTests") {
if (Ide.IJ()) {
dependsOn(":idea:idea-new-project-wizard:test")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
dependsOn(":kotlin-annotation-processing-base:test")
dependsOn(":kotlin-annotation-processing-cli:test")
}
register("gradleIdeTest") {
@@ -822,49 +918,16 @@ tasks {
)
}
register("publishIdeArtifacts") {
idePluginDependency {
dependsOn(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-dist-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",
":kotlin-scripting-jvm:publish",
":kotlin-scripting-compiler:publish",
":kotlin-scripting-compiler-impl:publish",
":kotlin-android-extensions-runtime:publish",
":kotlin-stdlib-common:publish",
":kotlin-stdlib:publish",
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish",
":kotlin-stdlib-js:publish",
":kotlin-test:kotlin-test-js:publish"
)
}
}
register("kmmTest", AggregateTest::class) {
dependsOn(
":idea:idea-gradle:test",
":idea:test",
":compiler:test",
":compiler:container:test",
":js:js.tests:test"
)
if (Ide.IJ193.orHigher())
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
@@ -888,6 +951,40 @@ tasks {
}
}
}
register("publishIdeArtifacts") {
idePluginDependency {
dependsOn(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",
":kotlin-scripting-jvm:publish",
":kotlin-scripting-compiler:publish",
":kotlin-scripting-compiler-impl:publish",
":kotlin-android-extensions-runtime:publish",
":kotlin-stdlib-common:publish",
":kotlin-stdlib:publish",
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish",
":kotlin-stdlib-js:publish",
":kotlin-test:kotlin-test-js:publish"
)
}
}
}
fun CopySpec.setExecutablePermissions() {
@@ -951,7 +1048,7 @@ val zipPlugin by task<Zip> {
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to $archiveFile")
logger.lifecycle("Plugin artifacts packed to ${archiveFile.get()}")
}
}

View File

@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
extra["versions.native-platform"] = "0.14"
buildscript {
@@ -5,15 +7,15 @@ buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
} else {
jcenter()
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
}
project.bootstrapKotlinRepo?.let {
@@ -22,7 +24,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -79,14 +81,12 @@ extra["intellijReleaseType"] = when {
else -> "releases"
}
extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build"
repositories {
jcenter()
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
@@ -97,8 +97,8 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
implementation("com.gradle.publish:plugin-publish-plugin:0.11.0")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
@@ -110,6 +110,9 @@ dependencies {
implementation("org.jetbrains.intellij.deps:asm-all:8.0.1")
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
}
samWithReceiver {
@@ -124,6 +127,11 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs +=
listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
}
tasks["build"].dependsOn(":prepare-deps:build")
allprojects {

View File

@@ -255,9 +255,8 @@ fun buildIvyRepositoryTask(
inputs.files(configuration)
outputs.upToDateWhen {
configuration.resolvedConfiguration.resolvedArtifacts.single()
.moduleDirectory()
.exists()
val repoMarker = configuration.resolvedConfiguration.resolvedArtifacts.single().moduleDirectory().resolve(".marker")
repoMarker.exists()
}
doFirst {
@@ -266,8 +265,9 @@ fun buildIvyRepositoryTask(
artifact.storeDirectory().cleanStore()
if (moduleDirectory.exists()) {
logger.info("Path ${moduleDirectory.absolutePath} already exists, skipping unpacking.")
val repoMarker = File(moduleDirectory, ".marker")
if (repoMarker.exists()) {
logger.info("Path ${repoMarker.absolutePath} already exists, skipping unpacking.")
return@doFirst
}
@@ -326,6 +326,8 @@ fun buildIvyRepositoryTask(
)
}
}
repoMarker.createNewFile()
}
}
}

View File

@@ -14,13 +14,13 @@ pluginManagement {
buildscript {
repositories {
if (cacheRedirectorEnabled == 'true') {
maven { url "https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies" }
maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
} else {
maven { url "https://kotlin.bintray.com/kotlin-dependencies" }
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
}
}
@@ -46,12 +46,12 @@ if (target_AppCode_Clion) {
} else if (target_AndroidStudio) {
logger.info("Including modules for AS (mobile plugin) in buildSrc/settings.gradle")
include ":prepare-deps:cocoa-common-binaries"
include ":prepare-deps:appcode-binaries"
include ":prepare-deps:lldb-framework"
include ":prepare-deps:lldb-frontend"
project(":prepare-deps:cocoa-common-binaries").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/cocoa-common-binaries")
project(":prepare-deps:appcode-binaries").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/appcode-binaries")
project(":prepare-deps:lldb-framework").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-framework")
project(":prepare-deps:lldb-frontend").projectDir =
@@ -69,4 +69,4 @@ if (target_AppCode_Clion) {
} else {
logger.info("Not including extra modules in buildSrc/settings.gradle")
}
}

View File

@@ -54,11 +54,12 @@ var Project.javaHome: String?
extra["javaHome"] = v
}
fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec {
fun Project.generator(fqName: String, sourceSet: SourceSet? = null, configure: JavaExec.() -> Unit = {}) = smartJavaExec {
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
mainClass.set(fqName)
workingDir = rootDir
systemProperty("line.separator", "\n")
configure()
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {

View File

@@ -53,7 +53,8 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
AS35(Platform.P183),
AS36(Platform.P192),
AS40(Platform.P193),
AS41(Platform.P201);
AS41(Platform.P201),
AS42(Platform.P202);
val kind = Kind.values().first { it.shortName == name.take(2) }
val version = name.dropWhile { !it.isDigit() }.toInt()

View File

@@ -71,18 +71,6 @@ fun Project.noDefaultJar() {
}
}
fun <T : Task> Project.runtimeJarArtifactBy(
task: TaskProvider<T>,
artifactRef: Any,
body: ConfigurablePublishArtifact.() -> Unit = {}
) {
addArtifact("archives", task, artifactRef, body)
addArtifact("runtimeJar", task, artifactRef, body)
configurations.findByName("runtime")?.let {
addArtifact(it.name, task, artifactRef, body)
}
}
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body)) { }
fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {}): TaskProvider<T> {
@@ -103,7 +91,11 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
body()
}
project.runtimeJarArtifactBy(task, task)
project.addArtifact("archives", task, task)
project.addArtifact("runtimeJar", task, task)
project.configurations.findByName("runtime")?.let {
project.addArtifact(it.name, task, task)
}
val runtimeJar = configurations.maybeCreate("runtimeJar").apply {
isCanBeConsumed = true

View File

@@ -5,10 +5,13 @@ import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.TaskProvider
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.*
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import java.io.File
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
const val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val packagesToRelocate =
listOf(
@@ -31,21 +34,23 @@ val packagesToRelocate =
// But due to the shadow plugin bug (https://github.com/johnrengelman/shadow/issues/262) it is not possible to use
// packagesToRelocate list to for the include list. Therefore the exclude list has to be created.
val packagesToExcludeFromDummy =
listOf("org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt")
listOf(
"org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt"
)
private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boolean = true) {
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
@@ -67,8 +72,8 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar"))
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(compilerJar)
body()
}
@@ -107,8 +112,8 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(
)
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(compilerDummyJar)
configureEmbeddableCompilerRelocation(withJavaxInject = false)
body()
@@ -119,7 +124,7 @@ fun Project.rewriteDepsToShadedJar(
originalJarTask: TaskProvider<out Jar>, shadowJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}
): TaskProvider<out Jar> {
originalJarTask.configure {
classifier = "original"
archiveClassifier.set("original")
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
@@ -132,7 +137,7 @@ fun Project.rewriteDepsToShadedJar(
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
classifier = ""
archiveClassifier.set("original")
body()
}
return shadowJarTask

View File

@@ -101,8 +101,12 @@ fun MutableCollection<JdkId>.discoverJdks(project: Project) {
}
}
private val macOsJavaHomeOutRegexes = listOf(Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""))
private val macOsJavaHomeOutRegexes =
listOf(
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)""")
)
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)

View File

@@ -76,10 +76,10 @@ fun Project.jpsStandalone() = "kotlin.build:jps-standalone:${rootProject.extra["
fun Project.nodeJSPlugin() = "kotlin.build:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}"
fun Project.androidDxJar() = "org.jetbrains.kotlin:android-dx:${rootProject.extra["versions.androidBuildTools"]}"
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}"
/**
* Runtime version of annotations that are already in Kotlin stdlib (historically Kotlin has older version of this one).
*
@@ -130,12 +130,10 @@ object IntellijRootUtils {
}
}
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) =
@Suppress("UNCHECKED_CAST")
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean = { true }): Unit =
includeJars(
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(),
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter(jarsFilterPredicate).toTypedArray(),
rootProject = project.rootProject
)
@@ -178,6 +176,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",
"-Didea.tooling.debug=true",
"-Dfus.internal.test.mode=true",
"-Dapple.laf.useScreenMenuBar=true",
"-Dapple.awt.graphics.UseQuartz=true",
"-Dsun.io.useCanonCaches=false",

View File

@@ -18,8 +18,12 @@ import java.util.*
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
fun Project.isSonatypePublish(): Boolean =
hasProperty("isSonatypePublish") && property("isSonatypePublish") as Boolean
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
val publishingExtension = extensions.getByType<PublishingExtension>()
val mainPublication = publishingExtension.publications[KotlinBuildPublishingPlugin.PUBLICATION_NAME] as MavenPublication
@@ -32,7 +36,12 @@ fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
tasks.named<PublishToMavenRepository>(
"publish${markerPublication.name.capitalize(Locale.ROOT)}PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository"
).configureRepository()
).apply {
configureRepository()
configure {
onlyIf { !isSonatypePublish() }
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2021 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.
*/
@@ -8,7 +8,6 @@ package plugins
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
import org.gradle.api.component.AdhocComponentWithVariants
import org.gradle.api.component.SoftwareComponentFactory
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublishingExtension
@@ -17,13 +16,12 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import java.net.URI
import java.util.*
import javax.inject.Inject
class KotlinBuildPublishingPlugin @Inject constructor(
private val componentFactory: SoftwareComponentFactory
) : Plugin<Project> {
@@ -47,7 +45,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
}
}
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME) as AdhocComponentWithVariants
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME)
components.add(kotlinLibraryComponent)
kotlinLibraryComponent.addVariantsFromConfiguration(publishedCompile) { mapToMavenScope("compile") }
kotlinLibraryComponent.addVariantsFromConfiguration(publishedRuntime) { mapToMavenScope("runtime") }
@@ -73,56 +71,11 @@ class KotlinBuildPublishingPlugin @Inject constructor(
create<MavenPublication>(PUBLICATION_NAME) {
from(kotlinLibraryComponent)
pom {
packaging = "jar"
name.set(humanReadableName(project))
description.set(project.description ?: humanReadableName(project))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
}
repositories {
maven {
name = REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
configureKotlinPomAttributes(project)
}
}
}
configure<SigningExtension> {
setRequired(provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
})
sign(extensions.getByType<PublishingExtension>().publications[PUBLICATION_NAME])
}
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.named<PublishToMavenRepository>("publish${PUBLICATION_NAME}PublicationTo${REPOSITORY_NAME}Repository")
.configureRepository()
configureDefaultPublishing()
}
companion object {
@@ -133,13 +86,84 @@ class KotlinBuildPublishingPlugin @Inject constructor(
const val COMPILE_CONFIGURATION = "publishedCompile"
const val RUNTIME_CONFIGURATION = "publishedRuntime"
@UseExperimental(ExperimentalStdlibApi::class)
fun humanReadableName(project: Project) =
project.name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
@OptIn(ExperimentalStdlibApi::class)
private fun humanReadableName(name: String) =
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
fun MavenPublication.configureKotlinPomAttributes(project: Project, explicitDescription: String? = null) {
val publication = this
pom {
packaging = "jar"
name.set(humanReadableName(publication.artifactId))
description.set(explicitDescription ?: project.description ?: humanReadableName(publication.artifactId))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
fun Project.configureDefaultPublishing() {
configure<PublishingExtension> {
repositories {
maven {
name = KotlinBuildPublishingPlugin.REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
}
}
}
configureSigning()
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.withType<PublishToMavenRepository>()
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
.all { configureRepository() }
}
private fun Project.configureSigning() {
val signingRequired = provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
}
configure<SigningExtension> {
setRequired(signingRequired)
sign(extensions.getByType<PublishingExtension>().publications) // all publications
useGpgCmd()
}
tasks.withType<Sign>().configureEach {
setOnlyIf { signingRequired.get() }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
configure { configureRepository() }
private fun PublishToMavenRepository.configureRepository() {
dependsOn(project.rootProject.tasks.named("preparePublication"))
doFirst {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
@@ -157,4 +181,4 @@ fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
}
}
}
}
}

View File

@@ -1,3 +1,4 @@
@file:Suppress("DEPRECATION")
package plugins
import org.codehaus.groovy.runtime.InvokerHelper
@@ -16,10 +17,8 @@ import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import kotlin.properties.Delegates
/**
* Configures a Kotlin module for publication.
*
*/
open class PublishedKotlinModule : Plugin<Project> {
@@ -52,6 +51,7 @@ open class PublishedKotlinModule : Plugin<Project> {
configure<SigningExtension> {
isRequired = signingRequired
sign(configurations["archives"])
useGpgCmd()
}
tasks.named<Sign>("signArchives").configure {

View File

@@ -30,6 +30,7 @@ val SourceSet.projectDefault: Project.() -> Unit
}
"test" -> {
java.srcDirs("test", "tests")
this@projectDefault.resources.srcDir("testResources")
}
}
}

View File

@@ -1,17 +1,6 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2021 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.
*/
@@ -37,6 +26,7 @@ fun Task.dependsOnKotlinPluginInstall() {
":kotlin-noarg:install",
":kotlin-sam-with-receiver:install",
":kotlin-android-extensions:install",
":kotlin-parcelize-compiler:install",
":kotlin-build-common:install",
":kotlin-compiler-embeddable:install",
":native:kotlin-native-utils:install",
@@ -50,10 +40,7 @@ fun Task.dependsOnKotlinPluginInstall() {
":kotlin-gradle-plugin-model:install",
":kotlin-reflect:install",
":kotlin-annotation-processing-gradle:install",
":kotlin-test:kotlin-test-common:install",
":kotlin-test:kotlin-test-annotations-common:install",
":kotlin-test:kotlin-test-jvm:install",
":kotlin-test:kotlin-test-js:install",
":kotlin-test:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",
@@ -65,7 +52,8 @@ fun Task.dependsOnKotlinPluginInstall() {
":kotlin-scripting-jvm:install",
":kotlin-scripting-compiler-embeddable:install",
":kotlin-scripting-compiler-impl-embeddable:install",
":kotlin-test-js-runner:install"
":kotlin-test-js-runner:install",
":native:kotlin-klib-commonizer-embeddable:install"
)
}
@@ -73,6 +61,7 @@ fun Project.projectTest(
taskName: String = "test",
parallel: Boolean = false,
shortenTempRootName: Boolean = false,
jUnit5Enabled: Boolean = false,
body: Test.() -> Unit = {}
): TaskProvider<Test> = getOrCreateTask(taskName) {
doFirst {
@@ -106,12 +95,29 @@ fun Project.projectTest(
}
}
include {
val path = it.path
if (it.isDirectory) {
val parentNames = if (jUnit5Enabled) {
/*
* If we run test from inner test class with junit 5 we need
* to include all containing classes of our class
*/
val nestedNames = classFileNameWithoutExtension.split("$")
mutableListOf(nestedNames.first()).also {
for (s in nestedNames.subList(1, nestedNames.size)) {
it += "${it.last()}\$$s"
}
}
} else emptyList()
include { treeElement ->
val path = treeElement.path
if (treeElement.isDirectory) {
classFileNameWithoutExtension.startsWith(path)
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
@@ -151,7 +157,7 @@ fun Project.projectTest(
var subProjectTempRoot: Path? = null
doFirst {
val teamcity = rootProject.findProperty("teamcity") as? Map<Any?, *>
val teamcity = rootProject.findProperty("teamcity") as? Map<*, *>
val systemTempRoot =
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
// Should be fixed soon on Teamcity side
@@ -177,7 +183,7 @@ fun Project.projectTest(
if (parallel) {
maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: Math.max(Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4, 1)
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
body()
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 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.
*/
import com.gradle.enterprise.gradleplugin.testdistribution.TestDistributionExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.internal.os.OperatingSystem
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
?: isTeamcityBuild
useJUnitPlatform()
extensions.configure(TestDistributionExtension::class.java) {
enabled.set(testDistributionEnabled)
maxRemoteExecutors.set(20)
if (isTeamcityBuild) {
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))
} else {
maxLocalExecutors.set(0)
}
configure()
}
}
fun Test.isTestDistributionEnabled(): Boolean =
extensions.findByType(TestDistributionExtension::class.java)?.enabled?.orNull ?: false

View File

@@ -1,14 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
isD8Enabled = project.findProperty('android.enableD8').toBoolean()
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.1.1'
}
}
apply plugin: 'com.android.application'
@@ -20,7 +17,7 @@ repositories {
android {
compileSdkVersion 26
buildToolsVersion "28.0.3"
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "org.jetbrains.kotlin.android.tests"
@@ -60,11 +57,9 @@ android {
resultsDir = "build/test/results"
}
if (isD8Enabled) {
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
flavorDimensions "box"
@@ -86,15 +81,12 @@ android {
dimension "box"
}
jvm80 {
dimension "box"
}
if (isD8Enabled) {
jvm80 {
dimension "box"
}
reflectjvm80 {
dimension "box"
}
reflectjvm80 {
dimension "box"
}
}

View File

@@ -1,3 +1,2 @@
#don't try to download android specific tools within gradle: licence acceptance will be required
android.builder.sdkDownload=false
android.enableD8=true
android.builder.sdkDownload=false

View File

@@ -6,25 +6,23 @@ plugins {
}
dependencies {
compile(project(":compiler:util"))
compile(project(":compiler:cli"))
compile(project(":compiler:frontend"))
compile(project(":compiler:backend"))
compile(kotlinStdlib())
compile(project(":kotlin-reflect"))
compile(projectTests(":compiler:tests-common"))
compile(commonDep("junit:junit"))
Platform[193].orLower {
compileOnly(intellijDep()) { includeJars("openapi") }
}
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":core:descriptors"))
testCompile(project(":core:descriptors.jvm"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:backend"))
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":compiler:frontend.java"))
testCompile(kotlinStdlib())
testCompile(project(":kotlin-reflect"))
testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit"))
testCompile(projectTests(":jps-plugin"))
testCompile(commonDep("junit:junit"))
Platform[193].orLower {
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
@@ -36,15 +34,13 @@ dependencies {
Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
}
Platform[192].orHigher {
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
}
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
testCompile(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest())
}
sourceSets {
"main" { projectDefault() }
"main" { }
"test" { projectDefault() }
}

View File

@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.android.tests
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.io.FileUtil
@@ -23,10 +22,14 @@ import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.*
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.junit.Assert
import java.io.File
import java.io.FileWriter
import java.io.IOException
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.Path
import kotlin.io.path.createTempDirectory
import kotlin.test.assertTrue
data class ConfigurationKey(val kind: ConfigurationKind, val jdkKind: TestJdkKind, val configuration: String)
@@ -266,8 +269,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
continue
}
val fullFileText =
FileUtil.loadFile(file, true).replace("COROUTINES_PACKAGE", "kotlin.coroutines")
val fullFileText = FileUtil.loadFile(file, true)
if (fullFileText.contains("// WITH_COROUTINES")) {
if (fullFileText.contains("kotlin.coroutines.experimental")) continue
@@ -301,7 +303,9 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (kind.withReflection) JVM8REFLECT else JVM8
} else if (kind.withReflection) REFLECT else COMMON
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind,
KtTestUtil.getAnnotationsJar()
).apply {
println("Creating new configuration by $key")
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
})
@@ -314,11 +318,11 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
}
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
CodegenTestCase.createTestFilesFromFile(file, expectedText, "kotlin.coroutines", false, TargetBackend.JVM)
CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)
companion object {
const val GRADLE_VERSION = "5.6.4" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d"
const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "fd591a34af7385730970399f473afabdb8b28d57fd97d6625c388d090039d6fd"
const val testClassPackage = "org.jetbrains.kotlin.android.tests"
const val testClassName = "CodegenTestCaseOnAndroid"
const val baseTestClassPackage = "org.jetbrains.kotlin.android.tests"
@@ -339,20 +343,21 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
@Throws(IOException::class)
internal fun writeAndroidSkdToLocalProperties(pathManager: PathManager) {
val sdkRoot = KotlinTestUtils.getAndroidSdkSystemIndependentPath()
val sdkRoot = KtTestUtil.getAndroidSdkSystemIndependentPath()
println("Writing android sdk to local.properties: $sdkRoot")
val file = File(pathManager.tmpFolder + "/local.properties")
FileWriter(file).use { fw -> fw.write("sdk.dir=$sdkRoot") }
}
@OptIn(ExperimentalPathApi::class)
@JvmStatic
fun main(args: Array<String>) {
val tmpFolder = createTempDir()
println("Created temporary folder for android tests: " + tmpFolder.absolutePath)
val rootFolder = File("")
val pathManager = PathManager(rootFolder.absolutePath, tmpFolder.absolutePath)
val tmpFolder = createTempDirectory().toAbsolutePath().toString()
println("Created temporary folder for android tests: $tmpFolder")
val rootFolder = Path("").toAbsolutePath().toString()
val pathManager = PathManager(rootFolder, tmpFolder)
generate(pathManager, true)
println("Android test project is generated into " + tmpFolder.absolutePath + " folder")
println("Android test project is generated into $tmpFolder folder")
}
}
}

View File

@@ -55,16 +55,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
runTestsOnEmulator(gradleRunner, TestSuite("D8")).apply {
rootSuite.addTest(this)
}
renameFlavorFolder()
enableD8(false)
runTestsOnEmulator(gradleRunner, TestSuite("DX")).apply {
(0 until this.countTestCases()).forEach {
val testCase = testAt(it) as TestCase
testCase.name += "_DX"
}
rootSuite.addTest(this)
}
} catch (e: RuntimeException) {
e.printStackTrace()
throw e
@@ -81,16 +71,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return rootSuite
}
private fun enableD8(enable: Boolean) {
val file = File(pathManager.androidTmpFolder, "gradle.properties")
val lines = file.readLines().map {
if (it.startsWith("android.enableD8=")) {
"android.enableD8=$enable"
} else it
}
file.writeText(lines.joinToString("\n"))
}
private fun processReport(suite: TestSuite, resultOutput: String) {
val reportFolder = File(flavorFolder())
try {
@@ -160,7 +140,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
val item = testCases.item(i) as Element
val failure = item.getElementsByTagName("failure")
val name = item.getAttribute("name")
val clazz = item.getAttribute("classname")
if (failure.length == 0) {
object : TestCase(name) {

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.android.tests;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import java.io.File;
@@ -69,7 +69,7 @@ public class PathManager {
}
public String getAndroidSdkRoot() {
return KotlinTestUtils.getAndroidSdkSystemIndependentPath();
return KtTestUtil.getAndroidSdkSystemIndependentPath();
}
public String getAndroidModuleRoot() {

View File

@@ -121,8 +121,11 @@ public class Emulator {
public void startEmulator() {
startServer();
System.out.println("Starting emulator...");
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(getStartCommand(), null, false, "START: ", true));
System.out.println("Starting emulator with ANDROID_HOME/ANDROID_SDK_ROOT: " + pathManager.getAndroidSdkRoot());
GeneralCommandLine startCommand = getStartCommand();
startCommand.withEnvironment("ANDROID_SDK_ROOT", pathManager.getAndroidSdkRoot());
startCommand.withEnvironment("ANDROID_HOME", pathManager.getAndroidSdkRoot());
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(startCommand, null, false, "START: ", true));
printLog();
}
@@ -144,6 +147,7 @@ public class Emulator {
bootCheckCommand.addParameter("shell");
bootCheckCommand.addParameter("getprop");
bootCheckCommand.addParameter("sys.boot_completed");
int counter = 0;
RunResult execute = RunUtils.execute(bootCheckCommand);
while (counter < 20) {

View File

@@ -0,0 +1,8 @@
/*
* Copyright 2010-2020 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.backend.common
class BackendException(message: String, cause: Throwable?) : IllegalStateException(message, cause)

View File

@@ -65,7 +65,7 @@ object CodegenUtil {
if (copy)
copyFunctions(
declaration, traitMember, declaration.containingDeclaration, traitMember.modality,
Visibilities.PUBLIC, CallableMemberDescriptor.Kind.DECLARATION, true
DescriptorVisibilities.PUBLIC, CallableMemberDescriptor.Kind.DECLARATION, true
)
else mapMembers(declaration, traitMember)
)
@@ -74,13 +74,13 @@ object CodegenUtil {
}
fun copyFunctions(
inheritedMember: CallableMemberDescriptor,
traitMember: CallableMemberDescriptor,
newOwner: DeclarationDescriptor,
modality: Modality,
visibility: Visibility,
kind: CallableMemberDescriptor.Kind,
copyOverrides: Boolean
inheritedMember: CallableMemberDescriptor,
traitMember: CallableMemberDescriptor,
newOwner: DeclarationDescriptor,
modality: Modality,
visibility: DescriptorVisibility,
kind: CallableMemberDescriptor.Kind,
copyOverrides: Boolean
): Map<FunctionDescriptor, FunctionDescriptor> =
mapMembers(inheritedMember.copy(newOwner, modality, visibility, kind, copyOverrides), traitMember)
@@ -232,12 +232,13 @@ object CodegenUtil {
}
@JvmStatic
fun reportBackendException(exception: Throwable, phase: String, fileUrl: String?): Nothing {
fun reportBackendException(exception: Throwable, phase: String, location: String?, additionalMessage: String? = null): Nothing {
// CompilationException (the only KotlinExceptionWithAttachments possible here) is already supposed
// to have all information about the context.
if (exception is KotlinExceptionWithAttachments) throw exception
throw IllegalStateException(
getExceptionMessage("Backend", "Exception during $phase", exception, fileUrl),
throw BackendException(
getExceptionMessage("Backend", "Exception during $phase", exception, location) +
additionalMessage?.let { "\n" + it }.orEmpty(),
exception
)
}

View File

@@ -0,0 +1,15 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
api(project(":core:compiler.common.jvm"))
api(project(":compiler:config.jvm"))
api(intellijCoreDep()) { includeJars("asm-all", "guava", rootProject = rootProject) }
}
sourceSets {
"main" { projectDefault() }
"test" {}
}

View File

@@ -0,0 +1,450 @@
/*
* Copyright 2010-2020 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.codegen;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.PrimitiveType;
import org.jetbrains.kotlin.descriptors.Visibilities;
import org.jetbrains.kotlin.descriptors.Visibility;
import org.jetbrains.kotlin.descriptors.java.JavaVisibilities;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.Opcodes;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import org.jetbrains.org.objectweb.asm.commons.Method;
import java.util.Map;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class AsmUtil {
private static final int NO_FLAG_LOCAL = 0;
public static final int NO_FLAG_PACKAGE_PRIVATE = 0;
@NotNull
private static final Map<Visibility, Integer> visibilityToAccessFlag = ImmutableMap.<Visibility, Integer>builder()
.put(Visibilities.Private.INSTANCE, ACC_PRIVATE)
.put(Visibilities.PrivateToThis.INSTANCE, ACC_PRIVATE)
.put(Visibilities.Protected.INSTANCE, ACC_PROTECTED)
.put(JavaVisibilities.ProtectedStaticVisibility.INSTANCE, ACC_PROTECTED)
.put(JavaVisibilities.ProtectedAndPackage.INSTANCE, ACC_PROTECTED)
.put(Visibilities.Public.INSTANCE, ACC_PUBLIC)
.put(Visibilities.Internal.INSTANCE, ACC_PUBLIC)
.put(Visibilities.Local.INSTANCE, NO_FLAG_LOCAL)
.put(JavaVisibilities.PackageVisibility.INSTANCE, NO_FLAG_PACKAGE_PRIVATE)
.build();
public static final String CAPTURED_PREFIX = "$";
public static final String THIS = "this";
public static final String THIS_IN_DEFAULT_IMPLS = "$this";
public static final String LABELED_THIS_FIELD = THIS + "_";
public static final String CAPTURED_LABELED_THIS_FIELD = CAPTURED_PREFIX + LABELED_THIS_FIELD;
public static final String INLINE_DECLARATION_SITE_THIS = "this_";
public static final String LABELED_THIS_PARAMETER = CAPTURED_PREFIX + THIS + "$";
public static final String CAPTURED_THIS_FIELD = "this$0";
public static final String RECEIVER_PARAMETER_NAME = "$receiver";
/*
This is basically an old convention. Starting from Kotlin 1.3, it was replaced with `$this_<label>`.
Note that it is still used for inlined callable references and anonymous callable extension receivers
even in 1.3.
*/
public static final String CAPTURED_RECEIVER_FIELD = "receiver$0";
// For non-inlined callable references ('kotlin.jvm.internal.CallableReference' has a 'receiver' field)
public static final String BOUND_REFERENCE_RECEIVER = "receiver";
public static final String LOCAL_FUNCTION_VARIABLE_PREFIX = "$fun$";
private static final ImmutableMap<Integer, JvmPrimitiveType> primitiveTypeByAsmSort;
private static final ImmutableMap<Type, Type> primitiveTypeByBoxedType;
static {
ImmutableMap.Builder<Integer, JvmPrimitiveType> typeBySortBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Type, Type> typeByWrapperBuilder = ImmutableMap.builder();
for (JvmPrimitiveType primitiveType : JvmPrimitiveType.values()) {
Type asmType = Type.getType(primitiveType.getDesc());
typeBySortBuilder.put(asmType.getSort(), primitiveType);
typeByWrapperBuilder.put(asmTypeByFqNameWithoutInnerClasses(primitiveType.getWrapperFqName()), asmType);
}
primitiveTypeByAsmSort = typeBySortBuilder.build();
primitiveTypeByBoxedType = typeByWrapperBuilder.build();
}
private AsmUtil() {
}
@NotNull
public static String getCapturedFieldName(@NotNull String originalName) {
return CAPTURED_PREFIX + originalName;
}
@NotNull
public static String getLabeledThisName(@NotNull String callableName, @NotNull String prefix, @NotNull String defaultName) {
if (!Name.isValidIdentifier(callableName)) {
return defaultName;
}
return prefix + CommonVariableAsmNameManglingUtils.mangleNameIfNeeded(callableName);
}
@NotNull
public static Type boxType(@NotNull Type type) {
Type boxedType = boxPrimitiveType(type);
return boxedType != null ? boxedType : type;
}
@Nullable
public static Type boxPrimitiveType(@NotNull Type type) {
JvmPrimitiveType jvmPrimitiveType = primitiveTypeByAsmSort.get(type.getSort());
return jvmPrimitiveType != null ? asmTypeByFqNameWithoutInnerClasses(jvmPrimitiveType.getWrapperFqName()) : null;
}
@NotNull
public static Type unboxType(@NotNull Type boxedType) {
Type primitiveType = unboxPrimitiveTypeOrNull(boxedType);
if (primitiveType == null) {
throw new UnsupportedOperationException("Unboxing: " + boxedType);
}
return primitiveType;
}
@Nullable
public static Type unboxPrimitiveTypeOrNull(@NotNull Type boxedType) {
return primitiveTypeByBoxedType.get(boxedType);
}
public static boolean isBoxedPrimitiveType(@NotNull Type boxedType) {
return primitiveTypeByBoxedType.get(boxedType) != null;
}
@NotNull
public static Type unboxUnlessPrimitive(@NotNull Type boxedOrPrimitiveType) {
if (isPrimitive(boxedOrPrimitiveType)) return boxedOrPrimitiveType;
return unboxType(boxedOrPrimitiveType);
}
public static boolean isBoxedTypeOf(@NotNull Type boxedType, @NotNull Type unboxedType) {
return unboxPrimitiveTypeOrNull(boxedType) == unboxedType;
}
public static boolean isIntPrimitive(Type type) {
return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE || type == Type.CHAR_TYPE;
}
public static boolean isIntOrLongPrimitive(Type type) {
return isIntPrimitive(type) || type == Type.LONG_TYPE;
}
public static boolean isPrimitive(Type type) {
return type.getSort() != Type.OBJECT && type.getSort() != Type.ARRAY;
}
@NotNull
public static Type correctElementType(@NotNull Type type) {
String internalName = type.getInternalName();
assert internalName.charAt(0) == '[';
return Type.getType(internalName.substring(1));
}
@NotNull
public static Type getArrayType(@NotNull Type componentType) {
return Type.getType("[" + componentType.getDescriptor());
}
@Nullable
public static PrimitiveType asmPrimitiveTypeToLangPrimitiveType(Type type) {
JvmPrimitiveType jvmPrimitiveType = primitiveTypeByAsmSort.get(type.getSort());
return jvmPrimitiveType != null ? jvmPrimitiveType.getPrimitiveType() : null;
}
@NotNull
public static Method method(@NotNull String name, @NotNull Type returnType, @NotNull Type... parameterTypes) {
return new Method(name, Type.getMethodDescriptor(returnType, parameterTypes));
}
public static Type stringValueOfType(Type type) {
int sort = type.getSort();
return sort == Type.OBJECT || sort == Type.ARRAY
? OBJECT_TYPE
: sort == Type.BYTE || sort == Type.SHORT ? Type.INT_TYPE : type;
}
public static void genThrow(@NotNull InstructionAdapter v, @NotNull String exception, @Nullable String message) {
v.anew(Type.getObjectType(exception));
v.dup();
if (message != null) {
v.aconst(message);
v.invokespecial(exception, "<init>", "(Ljava/lang/String;)V", false);
}
else {
v.invokespecial(exception, "<init>", "()V", false);
}
v.athrow();
}
public static void genStringBuilderConstructor(InstructionAdapter v) {
v.visitTypeInsn(NEW, "java/lang/StringBuilder");
v.dup();
v.invokespecial("java/lang/StringBuilder", "<init>", "()V", false);
}
public static void genInvertBoolean(InstructionAdapter v) {
v.iconst(1);
v.xor(Type.INT_TYPE);
}
public static void numConst(int value, Type type, InstructionAdapter v) {
if (type == Type.FLOAT_TYPE) {
v.fconst(value);
}
else if (type == Type.DOUBLE_TYPE) {
v.dconst(value);
}
else if (type == Type.LONG_TYPE) {
v.lconst(value);
}
else if (type == Type.CHAR_TYPE || type == Type.BYTE_TYPE || type == Type.SHORT_TYPE || type == Type.INT_TYPE) {
v.iconst(value);
}
else {
throw new IllegalArgumentException("Primitive numeric type expected, got: " + type);
}
}
public static void swap(InstructionAdapter v, Type stackTop, Type afterTop) {
if (stackTop.getSize() == 1) {
if (afterTop.getSize() == 1) {
v.swap();
}
else {
v.dupX2();
v.pop();
}
}
else {
if (afterTop.getSize() == 1) {
v.dup2X1();
}
else {
v.dup2X2();
}
v.pop2();
}
}
public static void pushDefaultValueOnStack(@NotNull Type type, @NotNull InstructionAdapter v) {
v.visitInsn(defaultValueOpcode(type));
}
public static int defaultValueOpcode(@NotNull Type type) {
if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
return ACONST_NULL;
}
if (type.getSort() == Type.FLOAT) {
return FCONST_0;
}
if (type.getSort() == Type.DOUBLE) {
return DCONST_0;
}
if (type.getSort() == Type.LONG) {
return LCONST_0;
}
return ICONST_0;
}
public static Type comparisonOperandType(Type left, Type right) {
if (left == Type.DOUBLE_TYPE || right == Type.DOUBLE_TYPE) return Type.DOUBLE_TYPE;
if (left == Type.FLOAT_TYPE || right == Type.FLOAT_TYPE) return Type.FLOAT_TYPE;
if (left == Type.LONG_TYPE || right == Type.LONG_TYPE) return Type.LONG_TYPE;
if (left == Type.CHAR_TYPE || right == Type.CHAR_TYPE) return Type.CHAR_TYPE;
return Type.INT_TYPE;
}
@NotNull
public static Type numberFunctionOperandType(@NotNull Type expectedType) {
if (expectedType == Type.SHORT_TYPE || expectedType == Type.BYTE_TYPE || expectedType == Type.CHAR_TYPE) {
return Type.INT_TYPE;
}
return expectedType;
}
public static void pop(@NotNull MethodVisitor v, @NotNull Type type) {
if (type.getSize() == 2) {
v.visitInsn(Opcodes.POP2);
}
else {
v.visitInsn(Opcodes.POP);
}
}
public static void pop2(@NotNull MethodVisitor v, @NotNull Type topOfStack, @NotNull Type afterTop) {
if (topOfStack.getSize() == 1 && afterTop.getSize() == 1) {
v.visitInsn(POP2);
} else {
pop(v, topOfStack);
pop(v, afterTop);
}
}
public static void pop2(@NotNull MethodVisitor v, @NotNull Type type) {
if (type.getSize() == 2) {
v.visitInsn(Opcodes.POP2);
v.visitInsn(Opcodes.POP2);
}
else {
v.visitInsn(Opcodes.POP2);
}
}
public static void dup(@NotNull InstructionAdapter v, @NotNull Type type) {
dup(v, type.getSize());
}
private static void dup(@NotNull InstructionAdapter v, int size) {
if (size == 2) {
v.dup2();
}
else if (size == 1) {
v.dup();
}
else {
throw new UnsupportedOperationException();
}
}
public static void dupx(@NotNull InstructionAdapter v, @NotNull Type type) {
dupx(v, type.getSize());
}
private static void dupx(@NotNull InstructionAdapter v, int size) {
if (size == 2) {
v.dup2X2();
}
else if (size == 1) {
v.dupX1();
}
else {
throw new UnsupportedOperationException();
}
}
// Duplicate the element afterTop and push it on the top of the stack.
public static void dupSecond(@NotNull InstructionAdapter v, @NotNull Type topOfStack, @NotNull Type afterTop) {
if (afterTop.getSize() == 0) {
return;
}
if (topOfStack.getSize() == 0) {
dup(v, afterTop);
} else if (topOfStack.getSize() == 1 && afterTop.getSize() == 1) {
v.dup2();
v.pop();
} else {
swap(v, topOfStack, afterTop);
if (topOfStack.getSize() == 1 && afterTop.getSize() == 2) {
v.dup2X1();
} else if (topOfStack.getSize() == 2 && afterTop.getSize() == 1) {
v.dupX2();
} else /* top = 2, after top = 2 */ {
v.dup2X2();
}
}
}
public static void dup(@NotNull InstructionAdapter v, @NotNull Type topOfStack, @NotNull Type afterTop) {
if (topOfStack.getSize() == 0 && afterTop.getSize() == 0) {
return;
}
if (topOfStack.getSize() == 0) {
dup(v, afterTop);
}
else if (afterTop.getSize() == 0) {
dup(v, topOfStack);
}
else if (afterTop.getSize() == 1) {
if (topOfStack.getSize() == 1) {
dup(v, 2);
}
else {
v.dup2X1();
v.pop2();
v.dupX2();
v.dupX2();
v.pop();
v.dup2X1();
}
}
else {
//Note: it's possible to write dup3 and dup4
throw new UnsupportedOperationException("Don't know how generate dup3/dup4 for: " + topOfStack + " and " + afterTop);
}
}
public static void writeAnnotationData(
@NotNull AnnotationVisitor av, @NotNull String[] data, @NotNull String[] strings
) {
AnnotationVisitor dataVisitor = av.visitArray(JvmAnnotationNames.METADATA_DATA_FIELD_NAME);
for (String string : data) {
dataVisitor.visit(null, string);
}
dataVisitor.visitEnd();
AnnotationVisitor stringsVisitor = av.visitArray(JvmAnnotationNames.METADATA_STRINGS_FIELD_NAME);
for (String string : strings) {
stringsVisitor.visit(null, string);
}
stringsVisitor.visitEnd();
}
@NotNull
public static Type asmTypeByFqNameWithoutInnerClasses(@NotNull FqName fqName) {
return Type.getObjectType(internalNameByFqNameWithoutInnerClasses(fqName));
}
@NotNull
public static Type asmTypeByClassId(@NotNull ClassId classId) {
return Type.getObjectType(classId.asString().replace('.', '$'));
}
@NotNull
public static String internalNameByFqNameWithoutInnerClasses(@NotNull FqName fqName) {
return JvmClassName.byFqNameWithoutInnerClasses(fqName).getInternalName();
}
public static void wrapJavaClassIntoKClass(@NotNull InstructionAdapter v) {
v.invokestatic(REFLECTION, "getOrCreateKotlinClass", Type.getMethodDescriptor(K_CLASS_TYPE, getType(Class.class)), false);
}
public static void wrapJavaClassesIntoKClasses(@NotNull InstructionAdapter v) {
v.invokestatic(REFLECTION, "getOrCreateKotlinClasses", Type.getMethodDescriptor(K_CLASS_ARRAY_TYPE, getType(Class[].class)), false);
}
@Nullable
public static Integer getVisibilityAccessFlag(Visibility visibility) {
return visibilityToAccessFlag.get(visibility);
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 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.
*/
@file:JvmName("CommonVariableAsmNameManglingUtils")
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.resolve.jvm.checkers.isValidDalvikCharacter
fun mangleNameIfNeeded(name: String): String {
if (name.all { it.isValidCharacter() }) {
return name
}
return buildString {
for (c in name) {
if (c.isValidCharacter()) {
append(c)
} else {
val hexString = Integer.toHexString(c.toInt())
assert(hexString.length <= 4)
append("_u").append(hexString)
}
}
}
}
private fun Char.isValidCharacter(): Boolean {
return this != '$' && this != '-' && isValidDalvikCharacter(this)
}

View File

@@ -0,0 +1,13 @@
/*
* Copyright 2010-2020 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.codegen
import org.jetbrains.org.objectweb.asm.Opcodes
// This object should help compiling against different ASM versions in different bunch versions
object VersionIndependentOpcodes {
const val ACC_RECORD = Opcodes.ACC_RECORD
}

View File

@@ -0,0 +1,13 @@
/*
* Copyright 2010-2020 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.codegen
import org.jetbrains.org.objectweb.asm.Opcodes
// This object should help compiling against different ASM versions from different bunch versions
object VersionIndependentOpcodes {
const val ACC_RECORD = 0
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 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.
*/
@@ -10,7 +10,11 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.builtins.PrimitiveType;
import org.jetbrains.org.objectweb.asm.Type;
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
public class AsmTypes {
private static final Map<Class<?>, Type> TYPES_MAP = new HashMap<>();

View File

@@ -0,0 +1,22 @@
/*
* Copyright 2010-2020 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.
*/
@file:JvmName("DalvikIdentifierUtils")
package org.jetbrains.kotlin.resolve.jvm.checkers
fun isValidDalvikIdentifier(identifier: String): Boolean = identifier.all { isValidDalvikCharacter(it) }
// https://source.android.com/devices/tech/dalvik/dex-format.html#string-syntax
fun isValidDalvikCharacter(c: Char): Boolean = when (c) {
in 'A'..'Z' -> true
in 'a'..'z' -> true
in '0'..'9' -> true
'$', '-', '_' -> true
in '\u00a1' .. '\u1fff' -> true
in '\u2010' .. '\u2027' -> true
in '\u2030' .. '\ud7ff' -> true
in '\ue000' .. '\uffef' -> true
else -> false
}

View File

@@ -0,0 +1,138 @@
/*
* Copyright 2010-2020 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.types
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.signature.AsmTypeFactory
import org.jetbrains.kotlin.load.kotlin.JvmDescriptorTypeWriter
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
import org.jetbrains.kotlin.load.kotlin.mapBuiltInType
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.types.model.*
import org.jetbrains.org.objectweb.asm.Type
interface TypeMappingContext<Writer : JvmDescriptorTypeWriter<Type>> {
val typeContext: TypeSystemCommonBackendContextForTypeMapping
fun getClassInternalName(typeConstructor: TypeConstructorMarker): String
fun Writer.writeGenericType(type: SimpleTypeMarker, asmType: Type, mode: TypeMappingMode)
}
object AbstractTypeMapper {
fun <Writer : JvmDescriptorTypeWriter<Type>> mapClass(context: TypeMappingContext<Writer>, typeConstructor: TypeConstructorMarker): Type {
return with(context.typeContext) {
when {
typeConstructor.isClassTypeConstructor() -> {
mapType(context, typeConstructor.defaultType(), TypeMappingMode.CLASS_DECLARATION)
}
typeConstructor.isTypeParameter() -> {
mapType(context, typeConstructor.defaultType())
}
else -> error("Unknown type constructor: $typeConstructor")
}
}
}
fun <Writer : JvmDescriptorTypeWriter<Type>> mapType(
context: TypeMappingContext<Writer>,
type: KotlinTypeMarker,
mode: TypeMappingMode = TypeMappingMode.DEFAULT,
sw: Writer? = null
): Type = context.typeContext.mapType(context, type, mode, sw)
@OptIn(ExperimentalStdlibApi::class)
private fun <Writer : JvmDescriptorTypeWriter<Type>> TypeSystemCommonBackendContextForTypeMapping.mapType(
context: TypeMappingContext<Writer>,
type: KotlinTypeMarker,
mode: TypeMappingMode = TypeMappingMode.DEFAULT,
sw: Writer? = null
): Type {
if (type !is SimpleTypeMarker) {
error("Unexpected type: $type (original Kotlin type=$type of ${type.let { it::class }})")
}
if (type.isSuspendFunction()) {
val argumentsCount = type.argumentsCount()
val argumentsList = type.asArgumentList()
@Suppress("RemoveExplicitTypeArguments") // Workaround for KT-42175
val arguments = buildList<KotlinTypeMarker> {
for (i in 0 until (argumentsCount - 1)) {
this += argumentsList[i].adjustedType()
}
this += continuationTypeConstructor().typeWithArguments(argumentsList[argumentsCount - 1].adjustedType())
this += nullableAnyType()
}
val runtimeFunctionType = functionNTypeConstructor(arguments.size - 1).typeWithArguments(arguments)
return mapType(context, runtimeFunctionType, mode, sw)
}
mapBuiltInType(type, AsmTypeFactory, mode)?.let { builtInType ->
return boxTypeIfNeeded(builtInType, mode.needPrimitiveBoxing).also { asmType ->
with(context) { sw?.writeGenericType(type, asmType, mode) }
}
}
val typeConstructor = type.typeConstructor()
when {
type.isArrayOrNullableArray() -> {
val typeArgument = type.asArgumentList()[0]
val (variance, memberType) = when {
typeArgument.isStarProjection() -> Variance.OUT_VARIANCE to nullableAnyType()
else -> typeArgument.getVariance().toVariance() to typeArgument.getType()
}
require(memberType is SimpleTypeMarker)
val arrayElementType: Type
sw?.writeArrayType()
if (variance == Variance.IN_VARIANCE) {
arrayElementType = AsmTypes.OBJECT_TYPE
sw?.writeClass(arrayElementType)
} else {
arrayElementType = mapType(context, memberType, mode.toGenericArgumentMode(variance, ofArray = true), sw)
}
sw?.writeArrayEnd()
return AsmUtil.getArrayType(arrayElementType)
}
typeConstructor.isClassTypeConstructor() -> {
if (typeConstructor.isInlineClass() && !mode.needInlineClassWrapping) {
val expandedType = computeExpandedTypeForInlineClass(type)
require(expandedType is SimpleTypeMarker?)
if (expandedType != null) {
return mapType(context, expandedType, mode.wrapInlineClassesMode(), sw)
}
}
val asmType = if (mode.isForAnnotationParameter && type.isKClass())
AsmTypes.JAVA_CLASS_TYPE
else
Type.getObjectType(context.getClassInternalName(typeConstructor))
with(context) { sw?.writeGenericType(type, asmType, mode) }
return asmType
}
typeConstructor.isTypeParameter() -> {
val typeParameter = typeConstructor as TypeParameterMarker
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->
sw?.writeTypeVariable(typeParameter.getName(), asmType)
}
}
else -> throw UnsupportedOperationException("Unknown type $type")
}
}
private fun boxTypeIfNeeded(possiblyPrimitiveType: Type, needBoxedType: Boolean): Type =
if (needBoxedType) AsmUtil.boxType(possiblyPrimitiveType) else possiblyPrimitiveType
private fun TypeVariance.toVariance(): Variance = when (this) {
TypeVariance.IN -> Variance.IN_VARIANCE
TypeVariance.OUT -> Variance.OUT_VARIANCE
TypeVariance.INV -> Variance.INVARIANT
}
}

Some files were not shown because too many files have changed in this diff Show More