Compare commits

...

546 Commits

Author SHA1 Message Date
Ilya Gorbunov
67758d8701 fixup! step 2: keep iterators in public, but deprecated with error 2021-03-26 20:16:09 +03:00
Ilya Gorbunov
6e723a25e9 Stabilize unsigned types, fix compiler tests
Drop unsignedLiteralsOn1_2 because apiversion 1.2 is no longer supported
Drop experimental unsigned literals diagnostic test
2021-03-23 12:11:42 +03:00
Ilya Gorbunov
7cd18707d5 Stabilize unsigned types: update JS API dump 2021-03-22 14:40:43 +03:00
Ilya Gorbunov
805c7a51b2 Stabilize unsigned types, step 2
Remove specialized iterators from public API
2021-03-22 14:05:14 +03:00
Ilya Gorbunov
ab86030769 Stabilize unsigned types, step 1 2021-03-22 14:05:13 +03:00
Svyatoslav Scherbina
8b3ff11a2b Provide CName annotation in common stdlib as optional 2021-03-22 09:20:05 +00:00
Svyatoslav Scherbina
552bd108a9 stdlib: rename NativeAnnotationsH.kt -> NativeConcurrentAnnotations.kt
Also move it from libraries/stdlib/common/src/kotlin
to libraries/stdlib/src/kotlin/annotations
2021-03-22 09:20:05 +00:00
Igor Yakovlev
25929b50d9 [FIR IDE] RawFirBuilder for lazy bodies 2021-03-21 10:42:29 +01:00
Nikolay Krasko
1558bd7373 Trust all module metadata till Gradle 6.8 update (KTI-493)
There's and issue with absent module files in the cache that leads to
"Artifact has been deleted from dependency cache" that can be resolved
by cleaning caches. It should be fixed in Gradle 6.8

https://github.com/gradle/gradle/issues/12713
2021-03-21 00:05:54 +03:00
Nikolay Krasko
73bc16896d Trust all poms till Gradle 6.8 update (KTI-493)
There's and issue with absent poms in the cache that leads to
"Artifact has been deleted from dependency cache" that can be resolved
by cleaning caches. It should be fixed in Gradle 6.8

https://github.com/gradle/gradle/issues/12713
2021-03-21 00:05:54 +03:00
Nikolay Krasko
efcb071f24 Trust javadoc and sources artifacts as the shouldn't be used in builds (KTI-493) 2021-03-21 00:05:53 +03:00
Nikolay Krasko
fd921f1dc0 Trust kotlin-native-prebuild-* (KTI-493)
Need more investigation for this artifact
2021-03-21 00:05:53 +03:00
Nikolay Krasko
fae1215881 Trust kotlin artifacts for bootstrapping (KTI-493)
Can't predict exact version after build
2021-03-21 00:05:53 +03:00
Nikolay Krasko
4bbba74360 Trust ivy xml files as they are constantly regenerated (KTI-493) 2021-03-21 00:05:52 +03:00
Nikolay Krasko
8240f5e459 Add dependencies lock with md5 and sha256 (KTI-493)
Initial commit without explicit check or cleanup.

Includes Kotlin Native dependencies.
2021-03-21 00:05:52 +03:00
Keegan Witt
a1ceaa9e44 Change pronoun in execption from "his" to "its" 2021-03-19 23:36:53 +01:00
Ilya Goncharov
f85ad41674 [IR] Check pureness in inlining lowering after transformation 2021-03-19 21:52:51 +03:00
Ilya Goncharov
8ac8dbdab8 [JS IR] Type operator call pureness 2021-03-19 21:52:51 +03:00
Ilya Goncharov
47d050c420 [JS IR] Correct pureness of expressions for arrayLiteral 2021-03-19 21:52:50 +03:00
Ilya Goncharov
f890156dde [JS IR] arrayConcat not use additional slice 2021-03-19 21:52:50 +03:00
Ilya Goncharov
76005813ff [JS IR] Fix for pureness of vararg 2021-03-19 21:52:50 +03:00
Ilya Goncharov
278a8c27fc [JS IR] Not create temporary variable for pure expressions on inline 2021-03-19 21:52:50 +03:00
Ilya Goncharov
ece0e200d5 [JS IR] Not nullize external varargs if it is not on the end of call 2021-03-19 21:52:50 +03:00
Ilya Goncharov
b8d5712bc0 [JS IR] Not use double slice for external varargs 2021-03-19 21:52:50 +03:00
Ilya Goncharov
120b5b9e05 [JS IR] Move isPure check to backend.common and add platform-specific check on calls with side effects 2021-03-19 21:52:50 +03:00
Ilya Goncharov
7bbb5b77db [JS IR] Concat varargs with non varargs on compile time for function w/o receiver 2021-03-19 21:52:50 +03:00
Ilya Goncharov
fc559ab0cd [JS IR] Unite varargs and non varargs before vararg 2021-03-19 21:52:49 +03:00
Dmitry Petrov
9e30ddd12e JVM_IR KT-45581 generate H_INVOKEINTERFACE for interface method handles 2021-03-19 18:57:21 +03:00
Dmitry Petrov
73d4fa65ea JVM_IR KT-45431 don't optimize out $$delegatedProperties in companion
Corresponding delegates are initialized in the host class, using
'$$delegatedProperties'.
TODO figure out proper code generation scheme for delegated properties
in companions (KT-45580)
2021-03-19 18:54:01 +03:00
Dmitry Petrov
f6baabd98e JVM_IR KT-45408 rewrite static calls recursively 2021-03-19 18:53:59 +03:00
Alexander Udalov
e5f218859b JVM IR: minor, improve error messages for inline classes
It will help in diagnosing problems like KT-44723.
2021-03-19 16:33:42 +01:00
Ivan Kylchik
65fcd72ce1 [VISUALIZER] Add handler for dot qualified expression in fir
For some reason source element of such expression in fir
was changed, so to get FirFunctionCall we should seek it
in KtDotQualifiedExpression
2021-03-19 18:30:35 +03:00
Ivan Kylchik
0160174c7a Extract VisualizerDirectives to separate file 2021-03-19 18:30:34 +03:00
Ivan Kylchik
de351d8bd3 Extract output handlers in visualiser's tests to separate files 2021-03-19 18:30:33 +03:00
Ivan Kylchik
6a439ad186 Add Test postfix to Abstract(Psi|Fir)Visualizer classes 2021-03-19 18:30:31 +03:00
Ivan Kylchik
5efa00821d Replace junit dependencies with single testApiJUnit5 call 2021-03-19 18:30:30 +03:00
Ivan Kylchik
6f639a39a7 Remove unnecessary dependencies on visualizer module 2021-03-19 18:30:28 +03:00
Ivan Kylchik
13ef126d4c [VISUALIZER] Remove ignore directive from correct test files 2021-03-19 18:30:27 +03:00
Ivan Kylchik
59416f447e [VISUALIZER] Change rendering of equals call 2021-03-19 18:30:26 +03:00
Ivan Kylchik
dd8a7010f0 [VISUALIZER] Forbid to render unary minus for integer literals 2021-03-19 18:30:25 +03:00
Ivan Kylchik
685f599c82 [VISUALIZER] Allow to render all calls at unary expresion in fir 2021-03-19 18:30:23 +03:00
Ivan Kylchik
84d4a0609f [VISUALIZER] Fix typealias rendering in fir 2021-03-19 18:30:22 +03:00
Ivan Kylchik
c94a4e7baf [VISUALIZER] Fix class literals rendering 2021-03-19 18:30:21 +03:00
Ivan Kylchik
fb654ce09b [VISUALIZER] Fix extension types rendering in fir 2021-03-19 18:30:20 +03:00
Ivan Kylchik
9e5645777d [VISUALIZER] Add annotation text for backing field in fir 2021-03-19 18:30:19 +03:00
Ivan Kylchik
813e48ffb4 [VISUALIZER] Replace rendering of class with no name to anonymous 2021-03-19 18:30:18 +03:00
Ivan Kylchik
ca424a94ef [VISUALIZER] Add local path to local declarations in fir 2021-03-19 18:30:16 +03:00
Ivan Kylchik
607c7b3e82 [VISUALIZER] Add implicit receiver rendering in fir 2021-03-19 18:30:15 +03:00
Ivan Kylchik
0ca0304865 [VISUALIZER] Fix render of null constant in fir 2021-03-19 18:30:14 +03:00
Ivan Kylchik
a497a2fa9b [VISUALIZER] Forbid to render type of single underscore variable 2021-03-19 18:30:13 +03:00
Ivan Kylchik
48ee4791b6 [VISUALIZER] Fix rendering of enum class and enum entry in fir 2021-03-19 18:30:12 +03:00
Ivan Kylchik
e2a7da25b0 [VISUALIZER] Rewrite fir symbol's rendering 2021-03-19 18:30:10 +03:00
Ivan Kylchik
4259ad2d84 [VISUALIZER] Change result of psi render according to new test data 2021-03-19 18:30:09 +03:00
Ivan Kylchik
3e66d12bef [FIR] Change some raw-fir test files to make them correct
"correct" means that these files can be compiled. This change is
necessary for visualizer. Don't want to ignore these test files,
so they must not produce errors.
2021-03-19 18:30:08 +03:00
Ivan Kylchik
951d607445 [VISUALIZER] Forbid to walk inside type reference children in psi 2021-03-19 18:30:07 +03:00
Ivan Kylchik
cc7d82ab7b [VISUALIZER] Change rendering of equality operator 2021-03-19 18:30:06 +03:00
Ivan Kylchik
c678ad9eb9 [VISUALIZER] Fix superTypes test 2021-03-19 18:30:05 +03:00
Ivan Kylchik
05efb8c129 [VISUALIZER] Add possibility to render callable reference in fir part 2021-03-19 18:30:04 +03:00
Ivan Kylchik
ce844a9bba [VISUALIZER] Disable rendering of value arguments in psi part
For now instead of arguments will be rendered parameters
2021-03-19 18:30:03 +03:00
Ivan Kylchik
f2cf86a3ae [VISUALIZER] Fix package rendering 2021-03-19 18:30:02 +03:00
Ivan Kylchik
c4be67b518 [VISUALIZER] Change rendering of constructors in fir part 2021-03-19 18:30:01 +03:00
Ivan Kylchik
945cc36ce3 [VISUALIZER] Add annotation at Array.set method 2021-03-19 18:30:00 +03:00
Ivan Kylchik
ca1b20c7f4 [VISUALIZER] Add some tests to ignore list 2021-03-19 18:29:58 +03:00
Ivan Kylchik
919591909e Update test data for compiler visualizer 2021-03-19 18:29:56 +03:00
Ivan Kylchik
4ac38e5f29 Rewrite compiler visualizer tests using new test infrastructure 2021-03-19 18:29:55 +03:00
Roman Golyshev
4c0cab4756 FIR IDE: Always insert additional spaces into lambda brackets
The customization of this with
`INSERT_WHITESPACES_IN_SIMPLE_ONE_LINE_METHOD` will be supported later
2021-03-19 17:44:15 +03:00
Alexander Udalov
415d52fe54 Deprecate KotlinJvmOptions.useIR
Starting from language version 1.5, JVM IR is enabled by default, so
this option has no effect. To rollback to the old JVM backend, the new
option useOldBackend can be used.

 #KT-45504 Fixed
2021-03-19 14:57:55 +01:00
Alexander Udalov
a10ebcea51 Minor, add -Xopt-in=kotlin.RequiresOptIn to kotlin-test-js
To prevent compilation warning on usages of OptIn in new
assertContentEquals functions.
2021-03-19 14:56:37 +01:00
Alexander Udalov
b33d245dfb Do not print stdlib version substitution message if nothing changed 2021-03-19 14:56:14 +01:00
Alexander Udalov
ec3799a696 Do not print total bytes written in :core:builtins:serialize
To reduce the amount of output on a clean build. Will have effect after
the next bootstrap update.
2021-03-19 14:56:14 +01:00
Anastasiya Shadrina
94c4d1c23e Specify when the range is empty in KDoc 2021-03-19 20:40:06 +07:00
Victor Petukhov
60f2f85be7 Process captured types with type variable inside properly, in the operations related with the type variables fixation 2021-03-19 16:16:11 +03:00
Victor Petukhov
a2b1aa753b Substitute captured types with type variables properly
^KT-44687 Fixed
2021-03-19 16:16:09 +03:00
Sergey Bogolepov
d276d583ba Keep host_os and host_arch methods for backward-compatibility
Because it is still used by IDE plugin
2021-03-19 15:24:45 +03:00
Sergey Bogolepov
af3ff6c4d6 Revert "Revert "Remove unused protobuf from backend.native""
This reverts commit c4182c82
2021-03-19 15:24:44 +03:00
Sergey Bogolepov
bba82c0d60 Revert "Revert "Remove obsolete bc.frontend module""
This reverts commit e7a385f9
2021-03-19 15:24:43 +03:00
Sergey Bogolepov
30e9c645f8 Revert "Revert "Cleanup TargetManager.kt a little bit""
This reverts commit 3dd25e49
2021-03-19 15:24:42 +03:00
Sergey Bogolepov
1d8d76eb7f Revert "Revert "Cleanup HostManager.kt a little bit""
This reverts commit 98b2c000
2021-03-19 15:24:41 +03:00
Roman Golyshev
184838ae35 FIR IDE: Fix import of properties; also fix bug in alreadyHasImport 2021-03-19 12:37:43 +03:00
Roman Golyshev
054d6ccdfb FIR IDE: Refactor KotlinFirLookupElementFactory 2021-03-19 12:37:43 +03:00
Roman Golyshev
9db8bd8d38 FIR IDE: Refactor variables insertion handlers 2021-03-19 12:37:43 +03:00
Roman Golyshev
84386237a6 FIR IDE: Refactor classifiers insertion handlers 2021-03-19 12:37:42 +03:00
Roman Golyshev
fe921b98ce FIR IDE: Refactor functions insertion handler 2021-03-19 12:37:42 +03:00
Roman Golyshev
43b829b1f0 Fix test data
We do not need to check the imports order in this particular test
2021-03-19 12:37:42 +03:00
Roman Golyshev
7b7ba717d0 FIR IDE: Add more correct importing of the callables
Now we use scopes to decide if the callable really needs to be inserted
2021-03-19 12:37:42 +03:00
Roman Golyshev
76ff106458 FIR: Add collecting top-level scopes of the file
It will be useful in the completion when we need to dicide if we
need to import FQN or not
2021-03-19 12:37:42 +03:00
Roman Golyshev
3427e0aebb FIR IDE: Add extensions function completion from indices
The insertion handling test is not correct, we need to check file
imports before adding new ones
2021-03-19 12:37:41 +03:00
Roman Golyshev
8396e17c52 Improve test data (to avoid clash with stdlib) 2021-03-19 12:37:41 +03:00
Roman Golyshev
83a9b4fb87 FIR IDE: Only insert FqNames for non-extension non-members properties
This is not completely correct, will be fixed later
2021-03-19 12:37:41 +03:00
Roman Golyshev
bf52417268 Add test for synthetic java property completion to multi-file tests 2021-03-19 12:37:41 +03:00
Roman Golyshev
d955f8e0d3 FIR IDE: Add simple shortening completion handler for properties 2021-03-19 12:37:41 +03:00
Roman Golyshev
8392b36964 FIR IDE: Add more accurate shortening for properties 2021-03-19 12:37:41 +03:00
Roman Golyshev
03a1c6fcca Add multi-file completion handler tests for FIR code completion
This is a temporary (and dirty) solution to start using those tests as
fast as possible. We certainly need to refactor them so they can be
generated from the testData
2021-03-19 12:37:40 +03:00
Roman Golyshev
73e623b5ac Generate multi-file completion tests for FIR completion
Also remove `MultiFilePrimitiveJvmBasicCompletionTestGenerated` tests
2021-03-19 12:37:40 +03:00
Roman Golyshev
abeff5d5c5 Enable passing tests 2021-03-19 12:37:40 +03:00
Roman Golyshev
d6d3d3a6ad FIR IDE: Add completion for top level functions and properties 2021-03-19 12:37:40 +03:00
Roman Golyshev
62389bad0b FIR IDE: Add more useful Lookup Objects
Main purpose of those lookup objects for now is to allow same lookup
elements to merge
2021-03-19 12:37:40 +03:00
Roman Golyshev
ab191925cb FIR IDE: Update test data for completion handlers test 2021-03-19 12:37:39 +03:00
Roman Golyshev
9896512eda FIR IDE: Collect scopes information in reanalyze
It is needed for the completion, so after the changes in method bodies
all contexts are correctly collected
2021-03-19 12:37:39 +03:00
Roman Golyshev
f641466f70 FIR IDE: Fix searching for the closest function to re-resolve
If the function is local, there would be errors related to its
unresolved body and receiver type
2021-03-19 12:37:39 +03:00
Roman Golyshev
1d64c0789f FIR IDE: Add implementation of classifiers completion from indices 2021-03-19 12:37:38 +03:00
Alexander Shabalin
5b1c30c198 Extract initializing singleton marker
* Extract kInitializingSingleton marker
* Extract isNullOrMarker helper function
2021-03-19 08:19:10 +00:00
Vasily Levchenko
b3ae30fdea [llvm][context util] make error more readable 2021-03-19 08:04:00 +00:00
Sergey Bogolepov
e320f7efc3 Add libffi buildscript for Apple Silicon 2021-03-19 07:21:39 +00:00
Svyatoslav Scherbina
a9d0409f2e Don't use Function.reflect() in kotlin-native/Interop on JVM
Use inline functions and typeOf<T>() instead
2021-03-19 06:53:09 +00:00
Alexander Likhachev
008e2636b7 [Gradle] Prevent early capturing of project build dir in KotlinCompile
#KT-45301 Fixed
2021-03-18 19:51:08 +00:00
Ilya Gorbunov
42648d55a0 kotlin-test: make assertIs<T> returning value cast to T KT-45296 2021-03-18 21:57:16 +03:00
Ilya Goncharov
2fd8620551 [Gradle, JS] Support custom display name in npm versions generator
^KT-42921 fixed
2021-03-18 21:32:15 +03:00
Ilya Goncharov
a291895ebe [Gradle, JS] Add compatibility with webpack 4
^KT-42921 fixed
2021-03-18 21:32:14 +03:00
Ilya Goncharov
a1a01a1428 [Gradle, JS] Use compatible node version
^KT-42921 fixed
2021-03-18 21:32:12 +03:00
Ilya Goncharov
b2a2616c10 [Gradle, JS] Fix of using format-util
^KT-42921 fixed
2021-03-18 21:32:11 +03:00
Ilya Goncharov
965426bbd9 [Gradle, JS] Webpack serve for webpack-dev-server
^KT-42921 fixed
2021-03-18 21:32:10 +03:00
Ilya Goncharov
5827ed3f05 [Gradle, JS] Update versions with karma-webpack 5.0.0
^KT-42921 fixed
2021-03-18 21:32:08 +03:00
Ilya Goncharov
1b8c74337e [Gradle, JS] Adopt Gradle plugin to webpack 5
^KT-42921 fixed
2021-03-18 21:32:07 +03:00
Ilya Goncharov
a06feaf819 Add possibility to hardcode version
^KT-42921 fixed
2021-03-18 21:32:05 +03:00
Ilya Goncharov
88abb3d6c9 [JS IR] Fix creating of classes extended from nested one
[JS IR] Extract getClassRef method

 ^KT-44950 fixed
2021-03-18 21:14:00 +03:00
Ilya Goncharov
a61312120b [Gradle, JS] WA for tests with multiple binaries 2021-03-18 20:07:48 +03:00
Ilya Goncharov
8ffe70cb4d [Gradle, JS] Use one folder for sync tasks 2021-03-18 20:07:47 +03:00
Dmitry Petrov
17da240910 JVM_IR KT-45195 generate non-static annotation members as ACC_ABSTRACT 2021-03-18 19:41:24 +03:00
Dmitry Petrov
2fd69a5718 Add bytecode listing tests for 'allopen' plugin with JVM_IR 2021-03-18 19:41:23 +03:00
Victor Turansky
e4d98d4e39 Gradle 7.0 support. com.gradle.plugin-publish 0.12.0 -> 0.13.0
[With Gradle 7+ support](https://plugins.gradle.org/plugin/com.gradle.plugin-publish/0.13.0)
2021-03-18 19:11:26 +03:00
Steven Schäfer
d0424465b8 JVM IR: Resolve fake overrides when calculating return types (KT-44867) 2021-03-18 16:02:35 +01:00
Pavel Punegov
cae95b1ba0 [native] Fix kotlin.native.home properties order. 2021-03-18 14:41:03 +00:00
Roman Artemev
44d03bc727 [Psi2Ir] Fix generation of property references for synthetic java props
- Declare it on use-site
 - Fix export checker for that case
 - Fix KT-45297
2021-03-18 16:50:31 +03:00
Roman Artemev
9632839253 [JVM IR] Add jvm box test for KT-45297 2021-03-18 16:50:27 +03:00
Roman Artemev
0a4f2bc39c [IR] Add irText test for KT-45297 2021-03-18 16:50:22 +03:00
Mikhail Zarechenskiy
78a0d7b5bb Disable check about unimplemented check for real defaults
Now we can generate proper defaults and there is no need in additional
 checks about unimplemented methods

 #KT-41130 Fixed
2021-03-18 16:38:55 +03:00
Mikhail Zarechenskiy
641f08d561 Use compiler arguments for Java against Kotlin highlighting tests
This is needed for the next commit to check jvm-default options

 #KT-41130 In Progress
2021-03-18 16:38:54 +03:00
Mikhail Zarechenskiy
111e54c8c1 Do not generate DefaultImpls for light classes if not needed
#KT-41130 In Progress
2021-03-18 16:38:52 +03:00
Dmitry Petrov
ac6232b4ba JVM_IR KT-36853 patch parents after tailrecPhase 2021-03-18 15:19:24 +03:00
Dmitriy Novozhilov
34f8c7a68b [TEST] Add ability to register compiler extensions in EnvironmentConfigurator 2021-03-18 14:00:38 +03:00
Ivan Gavrilovic
875ef73371 KT-45519: Get AGP version only once per classloader
Memoize AGP version per classloader, instead of computing
it once per project.

Fixes #KT-45519
2021-03-18 12:08:04 +03:00
Dmitriy Novozhilov
fc2d294b6c [FIR] Fix tower priorities for invoke resolve
#KT-45316 Fixed
2021-03-18 10:24:57 +03:00
Sergey Shanshin
cfca7183e5 Add inspections and quickfixes of redundant Json format instantiation
Resolves KT-45075
2021-03-18 05:44:03 +03:00
Alexander Udalov
27174de891 Add JVM target bytecode version 16
#KT-45515 Fixed
2021-03-17 21:31:08 +01:00
Andrei Klunnyi
09f9489619 [FIR]: sealed hierarchy processor for IDE
From now on sealed declarations get resolved with the help of
FirIdeSealedHierarchyProcessor. This change entails correct IDE side
check for sealed when exhaustiveness.
2021-03-17 19:43:49 +01:00
Nikolay Krasko
98b2c00083 Revert "Cleanup HostManager.kt a little bit"
This reverts commit 9d957f68
2021-03-17 20:40:48 +03:00
Nikolay Krasko
3dd25e4965 Revert "Cleanup TargetManager.kt a little bit"
This reverts commit a4010c7a
2021-03-17 20:40:29 +03:00
Nikolay Krasko
e7a385f9da Revert "Remove obsolete bc.frontend module"
This reverts commit b48a42a5
2021-03-17 20:40:00 +03:00
Nikolay Krasko
c4182c8269 Revert "Remove unused protobuf from backend.native"
This reverts commit 7a526a85
2021-03-17 20:39:35 +03:00
Ilya Gorbunov
85a0538f0a Compile and run common tests of kotlin-test in kotlin-test-js-ir build 2021-03-17 17:53:54 +03:00
Ilya Gorbunov
e66eeefe2a kotlin-test: assertIs and assertIsNot KT-45296
- Rename assertNotIs to assertIsNot
- Extract parts of implementation to helper internal PublishedApi
functions in order to inline minimum amount of code at use sites
- Remove PublishedApi from messagePrefix, no longer needed
2021-03-17 17:53:54 +03:00
Ben Asher
3a0219d84c kotlin-test: add assertIs and assertNotIs assertions KT-45296 2021-03-17 17:53:54 +03:00
Svyatoslav Scherbina
542518f290 Remove contents of kotlin-native/CHANGELOG.md
Keep only links to old and new changelogs.
2021-03-17 13:53:05 +00:00
Svyatoslav Scherbina
8a940fc075 Update kotlin-native/BUILDING_LLVM.md after build rework
Running `dependencies:update` task is no longer required.
2021-03-17 13:53:04 +00:00
Svyatoslav Scherbina
1f5830404c Native: remove documents that were migrated to kotlin-web-site
These documents were moved from kotlin-native repo to kotlin-web-site.
So copies that got merged into kotlin repo are unused.
2021-03-17 13:53:03 +00:00
Sergey Bogolepov
7a526a852f Remove unused protobuf from backend.native 2021-03-17 13:44:05 +00:00
Sergey Bogolepov
b48a42a5a6 Remove obsolete bc.frontend module 2021-03-17 13:44:04 +00:00
Sergey Bogolepov
a4010c7abe Cleanup TargetManager.kt a little bit 2021-03-17 13:44:03 +00:00
Sergey Bogolepov
9d957f686a Cleanup HostManager.kt a little bit 2021-03-17 13:44:03 +00:00
Sergey Bogolepov
d7bd3d671c Fix formatting of HostManager.kt 2021-03-17 13:44:02 +00:00
Dmitry Petrov
7fabc19326 JVM_IR KT-45446 don't erase captured var if it's dead code 2021-03-17 15:37:35 +03:00
Svyatoslav Kuzmich
6bd34db725 [JS IR] Fix kotlin.js.js with complex constant expressions
Use IR interpreter to evaluate complex constexprs
2021-03-17 15:12:18 +03:00
Jinseong Jeon
93289aa899 FIR checker: report VAL_REASSIGNMENT_VIA_BACKING_FIELD(_ERROR) 2021-03-17 15:04:44 +03:00
Mikhail Glukhikh
a6d11b8914 FirFunctionParameterChecker: use reportOnWithSuppression 2021-03-17 15:04:44 +03:00
Tianyu Geng
94de193993 FIR: introduce VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION check
Besides adding VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION,
we remove here NO_TYPE_FOR_TYPE_PARAMETER since it doesn't exist in FE1.0.
The name also doesn't make much sense.
From the usage it looks like it should have been
VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION instead.
2021-03-17 15:04:43 +03:00
sebastian.sellmair
f4b840467f CommonizerIT: Mark Windows as non-executable target 2021-03-17 10:55:46 +00:00
Dmitriy Dolovov
5a35018a88 [Commonizer] Move source code to the folder that corresponds package name 2021-03-17 13:34:14 +03:00
Dmitriy Dolovov
fc4f66b702 [Commonizer] Change the main package name
org.jetbrains.kotlin.descriptors.commonizer -> org.jetbrains.kotlin.commonizer
2021-03-17 13:34:06 +03:00
Alexander Dudinsky
28e4ce191b [Test] Add 'kotlin-stdlib-jdk7' to dependency for publishing KGP 2021-03-17 13:12:57 +03:00
Mark Punzalan
10d16d10d5 Raw FIR: Fix downward propagation of external and inline from
property to default accessors for light-tree.
2021-03-17 10:45:26 +01:00
Mark Punzalan
7d31ea3e8f FIR checker: Add utility functions for FirModifierList. 2021-03-17 10:45:26 +01:00
Mark Punzalan
315047b164 FIR checker: Make FirJvmExternalDeclarationChecker a
FirMemberDeclarationChecker.

Set isExternal in status for FirRegularClass. Invoke member declaration
checkers for FirRegularClass.
2021-03-17 10:45:26 +01:00
Mark Punzalan
cef26a043e FIR checker: Merge FirConstDeclarationChecker with
FirConstPropertyChecker.
2021-03-17 10:45:26 +01:00
Mark Punzalan
beaeb74a26 FIR checker: Separate FirExternalDeclarationChecker as it is
JVM-specific.
2021-03-17 10:45:26 +01:00
Mark Punzalan
c3d2ce0c1f FIR checker/IDE: Add checker and quickfix for WRONG_MODIFIER_TARGET.
There are only simple checks for `external` and `const` for now. The
rest of the checks (see ModifiersChecker in FE1.0) will be added later.
2021-03-17 10:45:26 +01:00
Mikhail Glukhikh
ebfc431733 FIR body resolve context: fix accessor scope handling 2021-03-17 12:13:23 +03:00
Mikhail Glukhikh
ca15df7815 FIR: introduce separate containingClass in BodyResolveContext 2021-03-17 12:13:23 +03:00
Mikhail Glukhikh
f9618db9e2 FIR: rearrange functions in BodyResolveContext 2021-03-17 12:13:23 +03:00
Mikhail Glukhikh
d30299c29e FIR: introduce BodyResolveContext.forBlock, withWhenExpression 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
6ae948b655 FirAbstractBodyResolveTransformer: drop some unused context functions 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
cbf38b119c FIR: introduce BodyResolveContext.storeCallableReferenceContext 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
8b7b15f02b FIR: refactor delegating constructors resolve 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
8a9be56d07 FIR: introduce BodyResolveContext.forFunctionBody 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
b4cec3fb5d FIR: introduce BodyResolveContext.forEnumEntry 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
2db413d535 FIR: enhance (using mode inside) BodyResolveContext.withAnonymousFunction 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
798d848a91 FirReturnsImpliesAnalyzer: find receiver/variable of accessor properly 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
a345b81f2a Use BodyResolveContext.with* functions in FirContractResolveTransformer 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
4d519f646e FIR: extract BodyResolveContext.withAnonymousInitializer, withParameter 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
4235075f35 FIR: extract BodyResolveContext.withAnonymousFunction 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
d7b2ab6b99 FIR: extract BodyResolveContext.withConstructor in variations 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
bd2cdf2ec9 FIR: extract BodyResolveContext.withField 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
64353f34e9 FIR: extract BodyResolveContext.withProperty 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
06b3a0d57b FIR: extract BodyResolveContext.withSimpleFunction 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
db2b6e92e5 FIR: extract BodyResolveContext.withAnonymousObject 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
e5325e70fc FIR: extract BodyResolveContext.withRegularClass 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
4cff6d93be Get rid of containingClass storage in FirDeclarationsResolveTransformer 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
91607044d0 FIR: extract BodyResolveContext.withFile 2021-03-17 12:13:20 +03:00
Andrey
b7dc1e64b1 [KAPT] Disable JPMS when running annotation processing
If sources contain module-info.java javac tries to validate modules existence/visibility during AP phase and fails, because we don't specify modules-path/patch-module. All these checks will be done in kotlin compiler and in javac for java classes. And it is not necessary to do it in AP too.
So we go for easiest path possible - disable jpms for AP. 

#KT-32202 Fixed
2021-03-17 11:10:27 +03:00
Ilmir Usmanov
a90a5f6dd4 Check for backend when checking for suspend in fun interfaces 2021-03-16 22:37:44 +01:00
Steven Schäfer
bf2942b5cc JVM IR: Add Object.clone to JvmSymbols
The `clone` function is not available in the builtin classes created
from fir.
2021-03-16 21:30:18 +01:00
Steven Schäfer
99a4779c6b JVM IR: Don't produce line numbers in synthetic Enum members 2021-03-16 21:30:18 +01:00
Steven Schäfer
5be00cfa04 JVM IR: Don't use null checks in Enum.valueOf 2021-03-16 21:30:18 +01:00
Steven Schäfer
bea1a8c422 JVM IR: Use Object.clone in Enum.values 2021-03-16 21:30:18 +01:00
Ilmir Usmanov
e47715f52b Minor. Add tests with returning inline class from SAM adapter 2021-03-16 20:57:05 +01:00
Nikolay Krasko
aff25b3666 Remove jcenter usages 2021-03-16 22:24:10 +03:00
Nikolay Krasko
74dd8726c0 Update repositories in kotlin/buildSrc 2021-03-16 22:24:08 +03:00
Mikhail Glukhikh
0e8f8362da FIR checkers: use isNullableType() instead of isSubtypeOfAny() 2021-03-16 21:56:11 +03:00
Mikhail Glukhikh
599a0d9c2b Minor fixes in FirTypeParameterInQualifiedAccessChecker 2021-03-16 21:56:10 +03:00
Mikhail Glukhikh
0b9598d880 Minor fixes around FirKClassWithIncorrectTypeArgumentChecker 2021-03-16 21:56:10 +03:00
Jinseong Jeon
4c08d10cce FIR checker: report expression of nullable type parameter as LHS of class literals 2021-03-16 21:56:10 +03:00
Jinseong Jeon
26441ed64f FIR IDEA: avoid unnecessary type casting 2021-03-16 21:56:10 +03:00
Jinseong Jeon
7fff4108b6 FIR checker: report KClass with incorrect type argument 2021-03-16 21:56:10 +03:00
Jinseong Jeon
bc2228d434 FIR checker: don't report errors on type parameter as LHS of class literals
If a type paramter is not reified or nullable, different errors will
be reported by FirGetClassCallChecker.

When determining whether type parameter wrapped in qualified access is a
standalone expression or not, we examine whether the checker context has
other qualified accesses in stack. Class literals (::class) is desugared
to FirGetClassCall, and thus not stacked as qualified access. Since
class literals are a special type of callable reference (a subtype of
qualified access), we should keep track of FirGetClassCall in a similar
way.
2021-03-16 21:56:09 +03:00
Jinseong Jeon
e29b40b07f FIR checker: report TYPE_PARAMETER_AS_REIFIED 2021-03-16 21:56:09 +03:00
Jinseong Jeon
5ba5b63dee FIR checker: report nullable expression as LHS of class literals 2021-03-16 21:56:09 +03:00
Jinseong Jeon
33c5b49632 FIR checker: report non-typed LHS of callable references 2021-03-16 21:56:08 +03:00
scaventz
329be4f906 Add a test to for the situation where pathname of destination does not name a parent. 2021-03-16 18:44:12 +01:00
Georgy Bronnikov
bff6e9b972 IR: document lock priority. 2021-03-16 19:49:31 +03:00
Georgy Bronnikov
60f38369f1 JVM_IR: synchronize binary class reloading 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
42279c3b5b IR: introduce IrLock
Use a single lock object for synchronization to avoid deadlocks.
2021-03-16 19:49:30 +03:00
Georgy Bronnikov
215556511e JVM_IR: synchronization in InlineCodegen 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
be67dacef1 JVM_IR: synchronized getOrPut for SLRUMap 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
78d62dcb1e JVM_IR: use ConcurrentHashMap in codegen where appropriate 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
c36bc9f312 JVM_IR: use synchronized map in ClassFileFactory 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
3a10ea4f88 JVM_IR: synchronize code generation for inline functions 2021-03-16 19:49:29 +03:00
Georgy Bronnikov
c7feaee8ae IR: make copying optional in performByIrFile
For codegen phases, input files are readonly data. There is no need to
copy them.
2021-03-16 19:49:29 +03:00
Georgy Bronnikov
1383c31caf JVM_IR: use threadLocal in GlobalInlineContext 2021-03-16 19:49:29 +03:00
Georgy Bronnikov
fe4d33dcb1 JVM_IR: make codegen a phase 2021-03-16 19:49:29 +03:00
sebastian.sellmair
b68fee9cbc CliCommonizer: Guard input- and dependency- libraries 2021-03-16 15:47:29 +00:00
sebastian.sellmair
d03a85525d [Commonizer] DependencyLibrariesOptionType: Make option optional (default: empty) 2021-03-16 15:47:28 +00:00
sebastian.sellmair
73222fbc4f [Commonizer] Add more verbose debugging information when failing to parse a task 2021-03-16 15:47:28 +00:00
sebastian.sellmair
f6e8afcbcc Move Gradle property 'kotlin.commonizer.jvmArgs' to 'kotlin.mpp.commonizerJvmArgs' 2021-03-16 15:47:27 +00:00
sebastian.sellmair
56661068bd CommonizerIT: Reuse DISABLED_NATIVE_TARGETS_REPORTER_WARNING_PREFIX instead of hardcoded string 2021-03-16 15:47:26 +00:00
sebastian.sellmair
5a10cb6a3e CommonizerIT: Add integration tests for user defined c-interop commonization 2021-03-16 15:47:25 +00:00
sebastian.sellmair
80e964c166 [Commonizer] NativeKlibCommonize: Remove optimization for only loading dependencies from native distribution
This is removed for now, because of test failures on Windows.
It seems like the dependencies in the klib produced by Windows are not
correct.

See: https://youtrack.jetbrains.com/issue/KT-45471
^KT-45471
2021-03-16 15:47:25 +00:00
sebastian.sellmair
b777c89bc8 [Commonizer] NativeKlibCommonize: Only load dependencies from native distribution 2021-03-16 15:47:24 +00:00
sebastian.sellmair
97a57a7d93 Forward dependencies from CInteropCommonizerTask to commonizer 2021-03-16 15:47:23 +00:00
sebastian.sellmair
49cf386258 Limit CInteropCommonizerTask to only one level of commonization
See ^KT-39324
2021-03-16 15:47:23 +00:00
sebastian.sellmair
261934d881 Implement CopyCommonizeCInteropForIdeTask to survive build folder cleaning 2021-03-16 15:47:22 +00:00
sebastian.sellmair
a53df56781 Implement CInteropIdentifier.Scope 2021-03-16 15:47:21 +00:00
sebastian.sellmair
6efd04edc0 Implement CInteropCommonizerTask to support commonization of user-defined cinterops
^KT-40975 Verification Pending
2021-03-16 15:47:20 +00:00
sebastian.sellmair
7cf8e9ec58 CInteropProcess: Promote settings to constructor
This enforces that the specified c-interop settings cannot be re-set on
a CInteropProcess.
2021-03-16 15:47:20 +00:00
sebastian.sellmair
be84b7b419 Rename 'getSourceSetHierarchy' to 'withAllDependsOnSourceSets' and lift the previous Deprecation 2021-03-16 15:47:19 +00:00
sebastian.sellmair
7da7dd92d6 Deprecate KotlinSourceSet.getSourceSetHierarchy in favour of 'resolveAllDependsOnSourceSets' and general purpose 'transitiveClosure' 2021-03-16 15:47:18 +00:00
sebastian.sellmair
4e07dcf2d8 Minor: Add dictionaries/sebastiansellmair.xml 2021-03-16 15:47:17 +00:00
Ilya Matveev
6643119f08 [K/N][New MM] Move ThreadStateGuard to the main Memory.h
Integrating the stdlib with the thread states machinery requires
accessing to some parts of the new MM. This patch provides this
access by moving these parts to the main Memory.h header.
2021-03-16 17:04:26 +03:00
Ilya Matveev
482305cfb2 [K/N][New MM] Move RunInNewThread to the main ThreadSupport.hpp
Some of unit-tests for the C++ part of the stdlib will require
thread state switching. In the new MM, we already have a helper
function that allows us to scopely initialize the memory subsystem
for a separate thread. This patch makes this helper available
for tests in the main runtime module by moving it to the main
ThreadSupport.hpp.
2021-03-16 17:04:25 +03:00
Ilya Matveev
fc43fbf578 [K/N][New MM] Move MemoryState conversions to separate header 2021-03-16 17:04:23 +03:00
Nikolay Krasko
da6440c59e Add heap-dumps collection to BaseGradleIT.kt for TC investigations
Disable in daemon tests that checks defaults of -XX:MaxMetaspaceSize as
it looks like settings any jvm options reset defaults.
2021-03-16 15:55:01 +03:00
Nikolay Krasko
48f2db51d2 Stop polluting output for successful Gradle tests 2021-03-16 15:55:00 +03:00
Dmitry Petrov
decfaa3ba5 JVM_IR KT-44993 preserve inner expression type when fusing if-null 2021-03-16 15:30:45 +03:00
Jinseong Jeon
922419efb8 FIR CFG: route to exit of try main for throw in try main
to make the remaining part of try main marked as dead.

^KT-45475 Fixed
2021-03-16 15:11:56 +03:00
Jinseong Jeon
7a7114f896 FIR CFG: create TryMainBlockExitNode before visiting try main block
so that a node that returns Nothing inside try main block can route to
the exit of try main block, instead of exit target for try directly.
2021-03-16 15:11:55 +03:00
Jinseong Jeon
7e5b562b33 Reproduce KT-45475: no smartcast after conditional throw in try expression 2021-03-16 15:11:53 +03:00
Svyatoslav Scherbina
1f6f996faf kotlin-native/samples: workaround build for linuxArm32Hfp
libSDL2.so is missing in new sysroot (since 1.5), use one from
the old sysroot as a workaround.
2021-03-16 11:58:56 +00:00
Yan Zhulanow
1dad549c81 All-open: Add Micronaut preset (KT-26325) 2021-03-16 19:21:50 +09:00
Yan Zhulanow
69fedd9791 Avoid serializing non-serializable properties (EA-253232) 2021-03-16 19:21:50 +09:00
Yan Zhulanow
0fb57d7253 Pill: Exclude native-commonizer from JPS modules 2021-03-16 19:21:50 +09:00
Yan Zhulanow
5fca37fa0f Pill: Do not delete existing artifacts for JPS build 2021-03-16 19:21:49 +09:00
Yan Zhulanow
cfd585e221 Pill: Remove 'kotlin-coroutines-experimental-compat' from mapped libraries 2021-03-16 19:21:49 +09:00
Yan Zhulanow
4e8ec69ca7 Pill: Support kotlinx.serialization plugin 2021-03-16 19:21:49 +09:00
Yan Zhulanow
bcce187e3f Pill: Import kotlinx-metadata only in FULL mode 2021-03-16 19:21:49 +09:00
Yan Zhulanow
cc41ccc3b9 Pill: Disable all compiler plugins by default 2021-03-16 19:21:48 +09:00
Yan Zhulanow
61cd97b340 Pill: Remove unused EmbeddedComponents class 2021-03-16 19:21:48 +09:00
Yan Zhulanow
a00f3b97c5 Pill: Move utility classes to util package 2021-03-16 19:21:48 +09:00
Yan Zhulanow
6da03c0cda Pill: Move project model out of parser file 2021-03-16 19:21:48 +09:00
Yan Zhulanow
e4ce48d9ef Pill: Extract artifact-related components to their own package 2021-03-16 19:21:47 +09:00
Yan Zhulanow
901bfbb3c7 Pill: Create KotlinArtifact only for variants that include BASE 2021-03-16 19:21:47 +09:00
Yan Zhulanow
6ff68311c1 Pill: Support module prefixes 2021-03-16 19:21:47 +09:00
Yan Zhulanow
a561fb85ad Pill: minor, fix inspection warnings 2021-03-16 19:21:47 +09:00
Yan Zhulanow
4708525b9a Pill: Refactor Pill variants, replace DEFAULT variant with nullable value 2021-03-16 19:21:46 +09:00
Yan Zhulanow
51a23b7aeb Pill: Always import Pill importer module for debugging purposes 2021-03-16 19:21:46 +09:00
Yan Zhulanow
c2cbbc5aba Pill: Removed unused NONE variant 2021-03-16 19:21:46 +09:00
Yan Zhulanow
a355d82b37 Pill: Fix warnings in PillExtension 2021-03-16 19:21:46 +09:00
Yan Zhulanow
f84c1d7354 Pill: Fix warnings in PillExtensionMirror 2021-03-16 19:21:45 +09:00
Yan Zhulanow
880067946e Pill: Do not import kotlin-serialization library as dist dependency as it doesn't exist in dist/kotlinc 2021-03-16 19:21:45 +09:00
Yan Zhulanow
38d88877a3 Pill: Map kotlin-coroutines-experimental-compat library 2021-03-16 19:21:45 +09:00
Yan Zhulanow
cc56511585 Pill: Map 'java9' source sets of standard library and tests 2021-03-16 19:21:45 +09:00
Zac Sweers
12a6352bef Fix NPE in KaptJavaLog
See https://issuetracker.google.com/issues/162446295 for more context, but in short: this will fail if the project:
* targets java 8
* consumes external libraries targeting a higher version (java 9+). This includes Android SDK 30's android.jar, which targets java 9
* has `mapDiagnosticLocations` enabled for kapt

targetElement is a nullable type, so this seems like a pretty cut-and-dry NPE fix
2021-03-16 19:21:44 +09:00
Vladimir Dolzhenko
462b752763 Mark flaky test 2021-03-16 11:03:05 +01:00
Dmitriy Novozhilov
cef859fced Fix exponential pseudocode size on incorrect prefix increments and decrements
#KT-44153 Fixed
2021-03-16 12:25:23 +03:00
Denis.Zharkov
6c5557dae3 FIR2IR: Optimize computation of fake overrides in lazy classes 2021-03-16 09:28:52 +03:00
Denis.Zharkov
fbed88d32d FIR2IR: Do not unwrap fake override when computing overridden 2021-03-16 09:28:52 +03:00
Denis.Zharkov
74ecae7f6d IR: Optimize IrSimpleFunction::collectRealOverrides 2021-03-16 09:28:52 +03:00
Denis.Zharkov
1a36ee2110 IR: Postpone computing real fake overrides at SyntheticAccessorLowering 2021-03-16 09:28:52 +03:00
Denis.Zharkov
c09fe3ea6f FIR: Optimize unnecessary interface casts by adding relevant overload 2021-03-16 09:28:52 +03:00
Denis.Zharkov
f141c276be IR: Avoid recomputing Symbols::progressionElementTypes 2021-03-16 09:28:52 +03:00
Alexander Udalov
d9a9bd0136 Fix compilation of Interop/Runtime after fc36178f3a 2021-03-15 20:34:24 +01:00
Dmitry Petrov
d74168fb8f PSI2IR KT-44414 fix adapted reference to imported object member 2021-03-15 21:24:25 +03:00
Mikhail Glukhikh
e7129329d2 Revert "FIR: do not eagerly resolve class references in imported annotations"
This reverts commit 1a57d60f
2021-03-15 18:36:13 +03:00
Alexander Udalov
83a4b6396a Deduplicate source roots in psi2ir and CLI
Compiler plugins can add new source roots to the next compilation round
by using `AnalysisResult.RetryWithAdditionalRoots`. Some plugins added
already existing source roots to this list in some cases. For example,
this is reproducible with `square/anvil` with incremental compilation
(KT-45100, KT-44925). Psi2ir didn't deduplicate the source files before,
which resulted in several classes with the same name linked to the same
symbol. This led to a "symbol is already bound" exception, and in case
of KT-44925, to an additional NPE when we were rendering the class to
display it in the message.

The solution is to deduplicate classes before psi2ir. Note that this
commit has two changes, in CLI and in psi2ir. Any one of these is
sufficient for fixing the problem, however both are made just to make it
more future-proof against new components and/or changes in existing
subsystems (e.g. fir2ir).

In the old JVM backend, similar deduplication was happening in
`ClassFileFactory.registerSourceFiles`, which is why the problem is not
reproducible there.

 #KT-45100 Fixed
2021-03-15 16:30:46 +01:00
Alexander Udalov
fc36178f3a Annotate kotlin.reflect.jvm.reflect with ExperimentalReflectionOnLambdas
This function was always experimental, as explained in its kdoc, but it
was introduced before opt-in requirement markers were supported. Thus,
breaking changes (such as in KT-42746) were always expected, and the
`@ExperimentalReflectionOnLambdas` annotation just makes it clearer.

 #KT-45486 Fixed
2021-03-15 15:54:31 +01:00
pyos
43140db65e FIR2IR: better filter out non-declared data class properties 2021-03-15 17:32:41 +03:00
pyos
1a57d60f68 FIR: do not eagerly resolve class references in imported annotations 2021-03-15 17:32:39 +03:00
Dmitry Petrov
e630e00e99 JVM_IR KT-44744 check accessibility of enum entry 'this' 2021-03-15 17:26:49 +03:00
Svyatoslav Scherbina
14cb762133 Update the docs to reflect Kotlin/Native merge to kotlin repo
Also:
* Revamp kotlin-native/README.md a bit: make it more up-to-date,
  add useful links
* Remove "composite build" section from ReadMe.md:
  it was used for Kotlin + Kotlin/Native composite;
  this is no longer required.
2021-03-15 14:09:00 +00:00
Ilya Kirillov
d7da17d8e6 FIR: fix FirOldFrontendDiagnosticsTestGenerated.testVariableInvoke test 2021-03-15 14:31:12 +01:00
Igor Chevdar
c37f8ba708 [IR][cache] Fix for https://youtrack.jetbrains.com/issue/KT-44764
The .konanLibrary is cached for each declaration for performance purposes, but it is only ok to do it
after IR has been lowered to its final state (or at least when declarations aren't being moved around),
so the fix respects that by only taking .konanLibrary of a IrFile (it is assumed that files stay on their place
during entire backend lowering procedure).

(cherry picked from commit e021138368b48e306ba99a96f47d93ecbe039f4d)
2021-03-15 15:54:51 +03:00
Alexander Udalov
c56f719dcc Fix/suppress some warnings
(cherry picked from commit d8a43c216925b3a9e1475b786978436835a57927)
2021-03-15 15:54:50 +03:00
Igor Chevdar
c5249ac714 Disposed target data
(cherry picked from commit 250be87acf66d5c780fb593f46da3540a536e049)
2021-03-15 15:54:49 +03:00
Vladimir Ivanov
ba50a8275c Add test for [KT-3706]
Issue is already fixed by metadata-based cinterop

(cherry picked from commit fd4f5b2c07ebdc431d6243ac087f911ee30e88ca)
2021-03-15 15:54:48 +03:00
Vladimir Ivanov
64129314fb Fix sample file naming for case-sensitive FS
(cherry picked from commit 72235c31852fba4f2ab330d8178197c2584b1cda)
2021-03-15 15:54:46 +03:00
Jinseong Jeon
8dce6f2ac9 FIR CFG: don't propagate deadness on the uncaught exception path 2021-03-15 15:54:22 +03:00
Jinseong Jeon
d27ecca0e9 FIR CFA: keep UncaughtExceptionPath separated 2021-03-15 15:54:21 +03:00
Mikhail Glukhikh
06a80c0b34 FIR tree generator: merge fields from parents properly 2021-03-15 15:33:38 +03:00
Mikhail Glukhikh
7f7a964b2e FIR: annotate 'replaceSource' with '@FirImplementationDetail' 2021-03-15 15:33:38 +03:00
Mikhail Glukhikh
c641fa739b FIR: provide 'replaceSource' only for FirQualifiedAccess inheritors 2021-03-15 15:33:38 +03:00
Dmitriy Novozhilov
4d65b0ef5a [FIR2IR] Unmute passing black box test 2021-03-15 15:12:11 +03:00
Alexander Shabalin
f51c85a63f Add test support for types and objects creation
* test_support::TypeInfoHolder to create TypeInfo given payload description
* test_support::Object<Payload> to create objects with Payload and to get them from ObjHeader* after checking that their type_info are layout compatible.
* test_support::*Array<Count> to create various arrays with given length and similarly get them from ArrayHeader*.
2021-03-15 11:25:04 +00:00
Yaroslav Chernyshev
aff49c76a9 loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception' 2021-03-15 13:35:37 +03:00
Yaroslav Chernyshev
116b11d8be Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData' 2021-03-15 13:35:36 +03:00
Yaroslav Chernyshev
d053ee33a8 Precise platform importing changes ported from new repository 2021-03-15 13:35:35 +03:00
Yaroslav Chernyshev
960a7dca45 Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies 2021-03-15 13:35:34 +03:00
Yaroslav Chernyshev
18a06dc37e HMPP import: add dependencies present on all compilation a jvm&android shared source set participates 2021-03-15 13:35:33 +03:00
Dmitry Savvinov
96a4d19365 Minor: inline addDependsOnSourceSets in buildCompilation 2021-03-15 13:35:33 +03:00
Dmitry Savvinov
4927777ffb Minor: rename KotlinCompilation.sourceSets -> allSourceSets 2021-03-15 13:35:32 +03:00
Dmitry Savvinov
1143865e88 Minor: add test on importing platform of commonMain in single-backend project 2021-03-15 13:35:32 +03:00
Dmitry Savvinov
c3f5d57d3b Implement precise platforms importing in MPP
- skip metadata target from importing. That lead to metadata
compilations being imported is well -> some source-sets were
participating in metadata compilations as well -> logic for determining
platforms used to consider metadata compilations as well, adding COMMON
platform to set of platforms

Seems like metadata was never needed in import/IDE, and got there purely
by accident

- Use only targets, actually present in the project, as the default
platform. This is needed mostly for corner-cases/miconfigurations, like
orphan source-sets (source-sets which are created but not included into
any configuraion). Still, for those source-sets the tooling is required
to behave properly; presence of non-existing target can lead to various
issues like showing gutters for test runs, which would fail on launch
(because tests for that target actually do not exist)

^KT-37127 Fixed
2021-03-15 13:35:31 +03:00
Dmitry Savvinov
7a5b4ccb9a Refactoring: collect all logic regarding detecting sourceSet platform in one function
Note that previously addSourceSetsToCompilation had logic regarding
platforms. The reason for that is that it was the last place where
default soruce sets of compilations could be distinguished from all
participated source sets.

So, to move that logic, we have to preserve default source sets.
Therefore, this commit introduces 'KotlinCompilation.defaultSourceSets',
and 'ImportingContext.isDefaultSourceSet' method.

The rest is trivial code moving/methods introduction

The resulting code isn't really pretty and likely has non-orthogonal
predicates, this will be cleaned-up in the next commits
2021-03-15 13:35:31 +03:00
Dmitry Savvinov
ef04ae041e Minor: swap receiver and parameter for shouldCoerceToCommon
Otherwise, it reads as if KotlinSourceSet coerces ImportingContext,
which is in fact the other way around
2021-03-15 13:35:30 +03:00
Dmitry Savvinov
7ddcdca6bb Dont coerce platforms of source-sets in HMPP to set of available targets in project 2021-03-15 13:35:30 +03:00
Andrey Uskov
9c000000cf Update Gradle verion in tests from 6.1 to 6.1.1
Gradle 6.1 is not suitable for testing because of memory leak on
artefact validation (https://github.com/gradle/gradle/issues/11966)
2021-03-15 12:28:08 +03:00
Dmitriy Novozhilov
054c278c83 [FIR] Fix determining nullability of type variables and type parameters 2021-03-15 12:13:10 +03:00
Dmitriy Novozhilov
e00ff5c473 [FIR] Make FirClassifierSymbol sealed 2021-03-15 12:13:09 +03:00
Dmitriy Novozhilov
631b771251 [FIR] Report proper resolution diagnostics from arguments checks 2021-03-15 12:13:08 +03:00
Dmitriy Novozhilov
6cc3fff48d [FIR] Properly handle that type variable is contained in inv or contravar positions
#KT-45344 Fixed
2021-03-15 12:13:07 +03:00
Dmitriy Novozhilov
3d1f4b8386 [FIR] Don't add @EnhancedVisibility to types with @Nullable annotation 2021-03-15 12:13:06 +03:00
Dmitriy Novozhilov
a7c08345b4 Extract Generate Compiler Tests run configuration back to top level 2021-03-15 12:13:04 +03:00
Dmitriy Novozhilov
329d9a58bc Generate IDE run configurations for modularized and full pipeline test
To generate configuration you need to specify path to root directory
  with modularized testdata for kotlin project in `local.properties`:

```
kotlin.fir.modularized.testdata=/path/to/testdata/modularized-kotlin
```
2021-03-15 12:13:02 +03:00
Dmitriy Novozhilov
f5d00716d1 Advance kotlin-build-gradle-plugin version to 0.0.26 2021-03-15 12:13:01 +03:00
Dmitriy Novozhilov
ab62680a03 Add new configuration flag to kotlin-build-gradle-plugin
This flag is needed for auto-generation of run configurations
  for modularized tests which are used by FIR team
2021-03-15 12:12:59 +03:00
Andrey
fe6ddcc1fa [KAPT] Skip kapt tasks if no annotations processors are provided (#4190)
So we don't do any preparation, don't spin up compiler.  And user will see SKIPPED in task execution
2021-03-15 11:37:06 +03:00
Svyatoslav Scherbina
77161af92a Delete obsolete kotlin-native/GRADLE_PLUGIN.md 2021-03-15 08:30:23 +00:00
Dmitriy Dolovov
6791ae81db [Commonizer] Minor. Clean-up in AbstractCommonizerTest 2021-03-15 11:25:48 +03:00
Dmitriy Dolovov
aa196ae813 [Commonizer] Minor. Clean-up in ValueParameterCommonizerTest 2021-03-15 11:25:43 +03:00
Dmitriy Dolovov
0bd5fdb611 [Commonizer] Minor. Formatted 2021-03-15 11:25:37 +03:00
Dmitriy Dolovov
ed98d878df [Commonizer] Minor. Reorganize CirClass.supertypes 2021-03-15 11:25:32 +03:00
Mikhael Bogdanov
cdb2dd6661 Advance bootstrap to 1.5.20-dev-2613 2021-03-15 07:10:03 +01:00
Ilmir Usmanov
64abb2501f Minor. Add FIR_IDENTICAL directive 2021-03-15 06:19:22 +01:00
Ilmir Usmanov
c9f41a2440 Minor. Ignore tests on WASM 2021-03-15 06:14:44 +01:00
Ilmir Usmanov
149064803d JVM_IR: Do not unbox Result argument inside java SAM adapters
#KT-45259
2021-03-15 06:14:42 +01:00
Ilmir Usmanov
4099dfc7e0 JVM_IR: Do not unbox Result argument inside SAM adapters
#KT-45259 Fixed
2021-03-15 06:14:40 +01:00
Mikhael Bogdanov
6fab1305e9 Fix compilation after @JvmDefault deprecation
Suppress could be removed after switch to -Xjvm-default=all
2021-03-13 08:24:18 +00:00
Mikhail Bogdanov
95654bb9bc Deprecate @JvmDefault
#KT-40392 Fixed

(cherry picked from commit c11f38688e)
2021-03-13 08:24:17 +00:00
Abduqodiri Qurbonzoda
77c263fcc4 Mark kt45410.kt with TARGET_BACKEND: JVM 2021-03-13 02:30:24 +03:00
Alexander Shabalin
391458c355 Fix CompileToBitcode's llvm-link invocation
Porting https://github.com/jetbrains/kotlin-native/pull/4536 which got
lost in c85c3ac123
2021-03-12 16:53:47 +00:00
Ilmir Usmanov
d3b42709fd Revert "Value Classes: Forbid var properties with value class receivers"
This reverts commit f43899086a.
2021-03-12 17:51:24 +01:00
Ilmir Usmanov
6429ac17d8 Revert "Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error"
This reverts commit bad197e075.
2021-03-12 17:51:21 +01:00
Roman Artemev
050db6d454 [KLIB] Add box test for generic annotations 2021-03-12 19:03:04 +03:00
Roman Artemev
0d8fff7186 [KLIB] Fix annotation type deserialization
Instead of hardcoded `Unit` restore it basing on annotation class and
constructor's type arguments
2021-03-12 19:03:04 +03:00
Roman Artemev
607a598f1a [IR] Add irText test for generic annotations 2021-03-12 19:02:29 +03:00
Roman Artemev
79935e29de [IR] Support type arguments in psi2ir 2021-03-12 19:02:29 +03:00
Roman Artemev
b60ebc0975 [IR] Support type arguments on annotations in IR render 2021-03-12 19:00:11 +03:00
Roman Artemev
ab8f64a3ee [FIR] Mute failing tests 2021-03-12 18:47:34 +03:00
Roman Artemev
92eac7e124 [IR] Fix irText test runner
Do not ignore compilation errors if they are existed
2021-03-12 18:36:33 +03:00
Anton Lakotka
d023f09bd4 Don't add common compiler plugin artifacts to native targets
Make native plugin configuration be non-transitive
2021-03-12 18:28:26 +03:00
Ilya Kirillov
f339748f5b FIR IDE: fix origin of synthetic functional interfaces
^KT-45312 fixed
2021-03-12 15:17:33 +01:00
Ilya Kirillov
41d1ef22b6 FIR: specify BODY_RESOLVE for synthetic functional interface 2021-03-12 15:15:32 +01:00
Alexander Likhachev
6b774b07e0 [Gradle, K/N] Fix broken iOS, watchOS, tvOS tests
They were broken in 2a8e2613a2
2021-03-12 16:36:18 +03:00
Alexander Likhachev
aedd8a104d [Gradle, K/N] Fix native test execution test on Macs 2021-03-12 15:56:03 +03:00
Mads Ager
8588412a56 [JVM IR] Support break in do-while condition.
This breaks from the loop itself which is inconsistent with
what happens for breaks in while conditions.

Also, the frontend will report that code after the loop is
unreachable, which it isn't. :-\

However, those issues are covered in
https://youtrack.jetbrains.com/issue/KT-17728, so for now
we follow the old backend to not "break" anyone. :)

Fixes KT-44412
2021-03-12 13:46:27 +01:00
Dmitry Petrov
d0d3b57366 Minor: mute test in FIR 2021-03-12 15:08:24 +03:00
Victor Petukhov
91d2f32a57 Don't lose upper non-expected type constraints to include them to intersection type during finding the result type of the fixing type variable 2021-03-12 14:36:54 +03:00
Victor Petukhov
b87c2a15b5 Don't stop constraints processing if all type variables have proper equality constraints
Those type variable may have other constraints after incorporation into which, the constraint error may appear

^KT-42042 Fixed
2021-03-12 14:36:54 +03:00
Victor Petukhov
7f7bb70596 Don't fix a type variable into the intersection type if there is an explicit expected type
^KT-43303 Fixed
^KT-42396 Fixed
^KT-42472 Fixed
2021-03-12 14:36:53 +03:00
pyos
e06bacafad JVM: fix inline cycle detection
1. use the correct descriptor in the old backend;
 2. clear the temporary variables for arguments in the IR backend.

 #KT-45292 Fixed
2021-03-12 11:49:42 +01:00
Ilya Kirillov
4e98d1b857 FIR IDE: update lazy resolve tests testdata 2021-03-12 11:44:00 +01:00
Ilya Kirillov
f8828abeba FIR: fix declaration phase updating in FirContractResolveTransformer 2021-03-12 11:44:00 +01:00
Ilya Kirillov
4dc040b91a FIR: update enum entry resolve phase in body resolve transformers 2021-03-12 11:44:00 +01:00
Ilya Kirillov
d49913944c FIR: add tests which checks that every declaration in file has body resolve phase after resolving the fiile 2021-03-12 11:44:00 +01:00
Ilya Kirillov
0dd18006e8 FIR: do not update phase from IMPLICIT_TYPES_BODY_RESOLVE to BODY_RESOLVE
This is not needed as such declarations are now marked with body resolve phase
2021-03-12 11:44:00 +01:00
Ilya Kirillov
fe207492b7 FIR: mark declarations resolved to BODY_RESOLVE with BODY_RESOLVE phase in implicit body transformer 2021-03-12 11:43:59 +01:00
Ilya Kirillov
ded234074d FIR: render value parameter/lambda/accessor resolve phase if RenderMode.renderDeclarationResolvePhase is enabled 2021-03-12 11:43:59 +01:00
Alexander Udalov
869a153327 Enable -Werror for buildSrc 2021-03-12 11:19:07 +01:00
Alexander Udalov
848b08a475 Minor, suppress 1.3 language version warnings 2021-03-12 11:18:57 +01:00
Ilya Goncharov
ead0b50107 [JS IR] In file:JsModule top level with fresh names 2021-03-12 12:57:56 +03:00
Ilya Kirillov
600e1725cb Do not run wizard project importing tests in TC
They will be run only in kotlin-ide plugin
2021-03-12 10:56:41 +01:00
Igor Yakovlev
023b7fbb8f [ULC] Fix invalid primitive type annotating
Fixed #KT-45417
2021-03-12 10:35:37 +01:00
Abduqodiri Qurbonzoda
ff5b2404af Introduce firstNotNullOf and firstNotNullOfOrNull #KT-12109 2021-03-12 09:27:14 +03:00
Abduqodiri Qurbonzoda
d4b3ae92cb [K/N] Strict version of String.toBoolean() #KT-42071 2021-03-12 09:26:58 +03:00
Abduqodiri Qurbonzoda
09ad5ca602 Strict version of String.toBoolean() #KT-42071 2021-03-12 09:26:55 +03:00
Abduqodiri Qurbonzoda
5f4a4fd8ae Introduce assertContentEquals in kotlin-test #KT-32996 2021-03-12 09:24:15 +03:00
Dmitry Petrov
44e6483090 JVM_IR Spill stack on array constructor call
KT-42932
2021-03-12 09:18:35 +03:00
Alexander Likhachev
dbfe45993a [Build] Fix test distribution plugin applying condition 2021-03-12 08:02:44 +03:00
Anton Lakotka
99ce047733 Add separate Plugin Classpaths per compilation
Make them extend the common CP for sake of backward compatibility
^KT-45020 Fixed
2021-03-11 22:34:21 +01:00
Tianyu Geng
9476175cc2 FIR: add mapping to partially resolved arg list
Initially I tried adding `mapping` field to `FirArgumentList` but it
seems to be very difficult to make it flexible enough to do what I want.

So instead, I am creating a `FirPartialResolvedArgumentList`, which
seems to be very simple.
2021-03-11 22:57:58 +03:00
Mikhail Glukhikh
5d3afbad54 Rename: BadNamedArgumentsTarget -> ForbiddenNamedArgumentsTarget 2021-03-11 22:57:57 +03:00
Tianyu Geng
be0dd84a06 FIR: check NAMED_ARGUMENTS_NOT_ALLOWED
The check has already been partially implemented in
org.jetbrains.kotlin.fir.resolve.calls.FirCallArgumentsProcessor. This
change completes the missing piece that determines if a `FirFunction`
has stable parameter names.
2021-03-11 22:57:57 +03:00
Tianyu Geng
0d4e9ca0b9 FIR: allow reporting multiple FirDiagnostics from a ConeDiagnostic 2021-03-11 22:57:57 +03:00
Mikhail Glukhikh
1f15ce2d26 FIR diagnostics: extract mapUnsafeCallError 2021-03-11 22:57:57 +03:00
Mark Punzalan
bb790195a2 FIR IDE: Enable ChangeVariableMutabilityFix for MUST_BE_INITIALIZED. 2021-03-11 16:31:40 +01:00
Ilya Chernikov
09fb2cd746 [minor] disable implicits test on IR, see added comments for details 2021-03-11 15:50:33 +01:00
Ilya Chernikov
e05c8ac57b Add script metedata flag 2021-03-11 15:50:33 +01:00
Ilya Chernikov
7c63105bb7 Mark script result expression as used to avoid coercion to unit 2021-03-11 15:50:32 +01:00
Ilya Chernikov
7d07010785 Fix handling of lambdas in top-level destructuring declarations 2021-03-11 15:50:32 +01:00
Ilya Chernikov
22f1814911 Fix CFA for destructuring declarations in scripts
in particular without the fix, the CFA skipped marking of the used
result values in lambdas and they were coerced to unit in IR
2021-03-11 15:50:31 +01:00
Ilya Chernikov
10567d9a37 [minor] fix scripting test dependencies 2021-03-11 15:50:31 +01:00
Ilya Chernikov
9c786a9cd9 [minor] uncomment 2 scripting tests:
Tests were failing before, but now fixed, most likely by switching to
default target 1.8 and some changes in scripting IR support.
#KT-44471 fixed
2021-03-11 15:50:31 +01:00
Ilya Chernikov
ef01411d20 [minor] fix script util tests 2021-03-11 15:50:30 +01:00
Ilya Chernikov
375441832e Implement REPL support in IR scripting 2021-03-11 15:50:30 +01:00
Ilya Chernikov
c066b7843c Fix provided properties generation in ir scripting 2021-03-11 15:50:07 +01:00
Ilya Chernikov
bc6c17d4b2 Enable IR in jvm scripting host tests 2021-03-11 15:50:06 +01:00
Ilya Chernikov
e9da385f7c Implement property for passing argumens to isolated script compiler 2021-03-11 15:50:06 +01:00
Ilya Chernikov
43d7536a28 Protect scripts compilation from passing -Xuse-ir via configuration
as well as other options that require changes in the compilation setup
before compiler options from the configuration could be processed
2021-03-11 15:50:06 +01:00
Ilya Chernikov
bac6a7346e Extend GeneratorExtensions with previous script, implemt it for JS REPL
also refactor JS REPL for better compatibility with the generic
REPL/scripting infrastructure
2021-03-11 15:50:01 +01:00
Ilya Chernikov
83da5f61fd [minor] Implement in-process test for main.kts cache
mainly to ease debugging
2021-03-11 15:49:46 +01:00
Ilya Chernikov
4dc228a0a3 Implement proper call to the base class ctor in ir script lowering 2021-03-11 15:49:46 +01:00
Ilya Chernikov
32d0c99289 Implement metadata handling for IR scripts 2021-03-11 15:49:45 +01:00
Ilya Chernikov
4c6b5ff0b8 Implement IR backend support in scripting tests, enable for some tests 2021-03-11 15:49:44 +01:00
Alexander Likhachev
d1ee05c7f6 Revert "[Build] Fix configuration cache issues with install task"
This reverts commit 078849d1
2021-03-11 17:22:37 +03:00
Yahor Berdnikau
543ab3fa2a Fix issues in Android test projects setup. 2021-03-11 16:36:54 +03:00
Yahor Berdnikau
590bab82e2 Remove not-needed test task validation.
Now all test 'install' dependencies are added via centralized 'dependsOnKotlinGradlePluginInstall()' method.
2021-03-11 16:36:53 +03:00
Yahor Berdnikau
3f953bcdfc Use lazy query for KGP test SourceSet output. 2021-03-11 16:36:52 +03:00
Yahor Berdnikau
7e7552bf5d Use JUnit 5 platform to run KGP tests.
Enabled vintage engine, so existing tests could run without any
modification.

^KT-45353 In Progress
2021-03-11 16:36:50 +03:00
Tianyu Geng
9bdae40ad8 FIR IDE: check generated primary constructor
Currently the IDE skips checking the delegated constructor call because
the primary constructor is generated if it's declared with the class.
2021-03-11 14:30:54 +01:00
Svyatoslav Scherbina
2b994e1b66 Native: fix links in RELEASE_NOTES.md 2021-03-11 13:25:42 +00:00
Jinseong Jeon
55561fad37 FIR CFG: correct target and label for rethrow in try expression
^KT-45385 Fixed
2021-03-11 16:19:16 +03:00
Jinseong Jeon
4f20d2dccf Reproduce KT-45385: false positive MUST_BE_INITIALIZED_* after rethrow 2021-03-11 16:19:15 +03:00
Alexander Udalov
f4c63c8ba2 Update public API dump for stdlib 2021-03-11 14:17:33 +01:00
Michael Hoisie
83383ab9e5 Make kotlin.jvm.internal.DefaultConstructorMarker public
DefaultConstructorMarker is used as a marker to ensure that a
constructor is unique for companion objects. Prior to this change,
DefaultConstructorMarker was package private.

Being package private worked when calling the
DefaultConstructorMarker-marked constsructor using `invokespecial`,
likely because the JVM may not perform strict access checks in this
situation.

However, when access checks are performed, trying to call a
DefaultConstructorMarker-marked constructor will fail. This could happen
if the constructor was called using reflection or the MethodHandle API.
These APIs may be used by tools that perform bytecode instrumentation
on Kotlin JVM bytecode, such as Robolectric. It also caused problems
when using ByteBuddy validation.

Fixes https://youtrack.jetbrains.com/issue/KT-20869
2021-03-11 14:17:33 +01:00
Alexander Likhachev
78ed758704 [Gradle, K/N] Rework environment input on test tasks
Provide method `trackEnvironment` to track environment variables. Use only tracked environment variables as task input.
#KT-44059 Fixed
2021-03-11 15:44:37 +03:00
Alexander Likhachev
c5a9f20a6f [Gradle, K/N] Don't add unsupported targets to default fat frameworks task 2021-03-11 15:37:36 +03:00
Alexander Udalov
bc5fc122c5 JVM, JVM IR: report error if not all parts of multifile class are @JvmSynthetic
#KT-41884 Fixed
2021-03-11 13:33:25 +01:00
Alexander Udalov
75850a618c Minor, move bytecodeListing tests on JvmMultifileClass 2021-03-11 13:33:25 +01:00
Steven Schäfer
057ead358c JVM: Add FILE target to the JvmSynthetic annotation (#4149) 2021-03-11 13:33:07 +01:00
Victor Petukhov
b45d5abeb1 [jspecify] Change annotations' package from org.jspecify.annotations to org.jspecify.nullness, and DefaultNonNull to NullMarked
^KT-45409 Fixed
2021-03-11 15:32:14 +03:00
Alexander Likhachev
2ae7740c46 Set explicit lang version 1.3 for kotlin-native-utils & kotlin-util-io
Without explicit version we cannot use those modules in buildscripts with Gradle 6.8+ because Gradle doesn't set flag `skipPrereleaseCheck` (previously was named `skipMetadataVersionCheck`). This way we make it compatible with all supported versions of Gradle.
2021-03-11 14:12:38 +03:00
Alexander Likhachev
875cf1acf9 [Build] Add https://nodejs.org/dist to cache redirector
https://nodejs.org/dist repository is being added by Gradle Node plugin (com.github.node-gradle.node) at configuration phase in project.afterEvaluate so we need to wrap it once more to setup redirection later than repository is added
2021-03-11 14:12:37 +03:00
Alexander Likhachev
35df00e071 [Build] Apply :idea:idea-gradle classpath modification on JPS build only
This modification is incompatible with Gradle configuration cache
Relates to #KT-44611
2021-03-11 14:12:37 +03:00
Alexander Likhachev
57f5939f5e [Build] Fix configuration cache issues (part 7)
* Read system property "disable.verification.tasks" using Gradle provider
* Fix compileTestKotlin tasks with instrumented classes
* Read Gradle property "kotlin.test.maxParallelForks" using Gradle provider
* Change :idea:performanceTests jackson version to fixed ones
Relates to #KT-44611
2021-03-11 14:12:37 +03:00
Alexander Likhachev
6bd44df861 [Build] Fix configuration cache issues (part 6)
Make DexMethodCountStats task class, tasks :examples:kotlin-jsr223-daemon-local-eval-example:test,:idea:idea-fir:test, :idea:idea-fir-performance-tests:test, :idea:idea-frontend-fir:test, :idea:idea-frontend-fir:idea-fir-low-level-api:test, :kotlin-compiler-client-embeddable:test, :kotlin-compiler-embeddable:test, :kotlin-stdlib-js-ir:compileTestKotlinJs, :plugins:android-extensions-compiler:test, :plugins:parcelize:parcelize-compiler:test, :compiler:test compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev
1751b5182b [Build] Apply test distribution plugin conditionally only if it's needed
This buildscript logic change is motivated by configuration cache incompatibility of the plugin
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev
9be06da045 [Build] Make Gradle IT buildscript property reads via Gradle providers
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev
ca7dfe02b2 [Build] Replace deprecated configurations usage :tools:kotlinp 2021-03-11 14:12:36 +03:00
Alexander Likhachev
078849d133 [Build] Fix configuration cache issues with install task
* `install` task provided by `maven` plugin doesn't support configuration cache so replace `maven` plugin with `maven-publish` and use task that is subtype of PublishToMavenRepository. `maven-publish` partially support configuration cache, see https://github.com/gradle/gradle/issues/13468
* Apply `signing` plugin only if it really needed. The plugin doesn't support configuration cache. See https://github.com/gradle/gradle/issues/13470
Relates to #KT-44611
2021-03-11 14:12:35 +03:00
Alexander Likhachev
46b056c929 [Build] Fix configuration cache issues (part 5)
Make Project.configureFormInstrumentation and Task.useAndroidConfiguration extensions, :dependencies:android-sdk unzip tasks compatible with configuration cache

Relates to #KT-44611
2021-03-11 14:12:35 +03:00
Alexander Likhachev
da6544ae3c [Build] Make projectTest() extension compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:35 +03:00
Alexander Likhachev
ce49664366 [Build] Bump test-retry plugin version to 1.2.0 to support conf cache
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
74ab5c21a8 [Build] Fix configuration cache issues (part 4)
Make :kotlin-stdlib-js:prepareComparableSource, :kotlin-stdlib-js:prepareBuiltinsSources, :kotlin-stdlib-js:compileJs, :kotlin-stdlib-js:compileJs, :prepare:build.version:writeBuildNumber, :kotlin-compiler:distKotlinc compatible with configuration cache

Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
5f10c98a38 [Build] Fix configuration cache issues (part 3)
* Make IntelliJInstrumentCodeTask compatible with configuration cache
* Make CoreXmlShadingTransformer compatible with configuration cache
* Make :kotlin-reflect:relocateCoreSources compatible with configuration cache
* Copy some properties to not capture it's owning object into lambda to support configuration cache
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
0e4e90dc13 [Build] Bump gradle-node-plugin version to 3.0.1 to support conf cache
:kotlin-test:kotlin-test-js:kotlin-test-js-it will still have old version as integration test run logic cannot be fully refactored to the new version (approximately till 3.1)
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
89a78a02d4 [Build] Make generatePom tasks compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:33 +03:00
Alexander Likhachev
2a49dcab47 [Build] Bump shadow plugin version to 6.1.0 to support configuration cache
Relates to #KT-44611
2021-03-11 14:12:33 +03:00
Alexander Likhachev
faf9600ff0 [Build] Fix configuration cache issues (part 2)
* Make WriteCopyrightToFile task compatible with configuration cache
* Configure shadowJar task in compatible with configuration cache way
* Configure compileJava9Java task in compatible with configuration cache way
* Make :js:js.tests buildscript compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:33 +03:00
Alexander Likhachev
ce19063e43 [Build] Disable reporters when configuration cache is enabled
Relates to #KT-44611
2021-03-11 14:12:32 +03:00
Alexander Likhachev
27956adf3f [Build] Fix configuration cache issues (part 1)
* Make `clean` task compatible with configuration cache
* Make Java compile instrumentation compatible with configuration cache
* Make settings.gradle compatible with configuration cache
* Initial work on making IntelliJInstrumentCodeTask compatible with configuration cache
* Make writeStdlibVersion task compatible with configuration cache
* Copy some properties to not capture it's owning object into lambda to support configuration cache

Relates to #KT-44611
2021-03-11 14:12:28 +03:00
Mikhail Glukhikh
111e67dc8d Use DECLARATION_NAME strategy for FirErrors.PRIMARY_CONSTRUCTOR_REQUIRED 2021-03-11 13:25:52 +03:00
Tianyu Geng
6e8bad6ef6 FIR: Implement data class constructor checker 2021-03-11 13:25:51 +03:00
Jinseong Jeon
d2da15e039 FIR checker: report (expected|unnecessary) lateinit 2021-03-11 13:25:51 +03:00
Dmitriy Novozhilov
815e40620c [FIR-IDE] Update testdata after previous changes about java nullability enhancement 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov
dceb8b2991 [FIR] Don't render ! at the end of ConeFlexibleType 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov
932eed2c14 [FIR] Fix determining nullability of arguments during enhancement 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov
65ea4e184a [FIR] Fix enhancement of FlexibleNullability and EnhancedNullability
- Add utilities to add new attribute to ConeAttributes
- Get rid of FlexibleNullability attribute (it can be easily inferred
    for any flexible type at any moment)
- Fix determining of EnhancedNullability attribute
2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
0108f8a1b4 [FIR2IR] Don't create implicit not null cast on IrGetEnumValue 2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
01e8019c4c [FIR] Properly handle friend modules in modularized and full-pipeline tests 2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
f82c7c4678 [FIR] Cleanup session creation utils 2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
f1edca8ca8 Move default gradle run configurations to separate folders 2021-03-11 13:10:03 +03:00
Dmitriy Novozhilov
8995fe36f3 Add .idea/csv-plugin.xml to .gitignore 2021-03-11 13:10:03 +03:00
Vladimir Dolzhenko
fbe18164b4 Filter KtAnnotated on-the-fly diagnostic elements
Relates to #KTIJ-1760
Relates to #KT-45254
2021-03-11 08:43:36 +00:00
Dmitriy Novozhilov
cba63f2c12 Regenerate tests 2021-03-11 00:58:26 +03:00
Dmitriy Novozhilov
74118930b4 [FE] Don't fail with exception if ESVisitor tries to visit ESLambda
#KT-45243 Fixed
2021-03-11 00:58:24 +03:00
Mikhail Glukhikh
f3135baba9 FIR: eliminate replaceSource usages in transformTypeToArrayType 2021-03-10 22:23:21 +03:00
Dmitry Petrov
0cca07fa19 Bump d8 used in box tests to 2.1.75 2021-03-10 21:04:12 +03:00
Dmitry Petrov
737fbe271f JVM_IR Do not generate generic signatures for lifted lambda methods 2021-03-10 21:04:11 +03:00
Dmitry Petrov
00a335129b JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+ 2021-03-10 21:04:08 +03:00
Alexander Udalov
bf844aa8e4 JVM IR: prevent behavior change with operator dot calls on literals
#KT-42321 Fixed
2021-03-10 18:46:30 +01:00
Alexander Udalov
c7498dd74d Remove one layer of nested exceptions in JVM backend 2021-03-10 18:44:11 +01:00
Igor Chevdar
6608ca5795 [K/N][IR] Fixed bug with parents setting
Fixes IR_VALIDATION warning as a side effect
2021-03-10 21:29:11 +05:00
Andrey Zinovyev
d941d41776 [KAPT] Fix broken incremental test 2021-03-10 17:30:10 +03:00
Alexander Udalov
a3a745e7a5 Fix ParallelBuildTest for Windows
Enclose file paths in raw strings. Otherwise in the string
"C:\Users\...", "\U" was detected as an illegal escape which led to an
error.
2021-03-10 14:25:06 +01:00
Roman Golyshev
5d0760c685 KT-44756 Ignore annotations on value parameters if metadata says so
There is a `gradle-api-impldep.jar` created by Gradle which contains
our nullability annotations, but relocated in the
`org.gradle.internal.impldep` package

In the deserialization process we use a `HAS_ANNOTATIONS` flag, and
if it is present on the declaration, we do not try to build annotations
for it, even when they are actually present and even when they are
relocated
(see usages of Flags.HAS_ANNOTATIONS in org.jetbrains.kotlin.serialization.deserialization.MemberDeserializer)

In the stubs builder we also use this HAS_ANNOTATIONS flag, but we did
not use it for the value parameters. This commit fixes that - now, if
the `org.jetbrains.annotations` packages are relocated, it should not
cause `Stub Mismatch Error` for the value parameters

Lets consider two possible cases:

1. If the value parameter has a user-defined annotation,
it will be marked as having annotations (HAS_ANNOTATIONS == true), and
both stubs and deserialized descriptors will have to
use all available annotations (even a relocated ones)

2. If, for example, the value parameter is of non-nullable type, it will
have a `@NotNull` annotation on it, but will be marked as having
no annotations at all (HAS_ANNOTATIONS == false), since `NotNull` is
considered as auxiliary by the compiler. Because of the flag, both stubs
and descriptors will ignore all present annotations (even if they were
relocated)

In the both cases, the stubs and the descriptors will completely match

^KT-44756 Fixed

See IDEA-262971 about fixing the Gradle jar and the details

N.B. This does not fixes the cases when `kotlin.Metadata` and similar
annotations are relocated (e.g. KT-25709)
2021-03-10 11:53:33 +00:00
Elena Lepilkina
f7099d34d4 [K/N] Fixed build of performance server project 2021-03-10 11:49:39 +00:00
Dmitriy Dolovov
cd2f55ea2f [Commonizer] Minor. Remove unused utility functions 2021-03-10 13:50:00 +03:00
Dmitriy Dolovov
c1848a26c3 [Commonizer] Use more compact interner based on THashSet 2021-03-10 13:49:54 +03:00
Dmitriy Dolovov
7a11c722c6 [Commonizer] Introduce CirProvided.ExportedForwardDeclarationClass
To represent classifiers that are actually exported forward declarations
2021-03-10 13:49:48 +03:00
Dmitriy Dolovov
76d93b6dca [Commonizer] Read exported forward declarations for every C-interop module 2021-03-10 13:49:41 +03:00
Ilya Gorbunov
a7fda66fa1 Suggest duration static factories instead of number extension properties
Introduce Duration companion functions to convert numbers to Duration.
Deprecate number extension properties and propose to use these
new functions instead.
2021-03-10 13:23:32 +03:00
Ilya Gorbunov
ca99fc4fed Make more lambda-taking functions in kotlin-test inline-only
So that the lambda can contain non-local control flow, such as suspend
calls. Inline-only helps preserving line numbers in the failed assertion
stack traces.

KT-44717
2021-03-10 12:15:45 +03:00
Mikhael Bogdanov
66a29c70bf Use compatibility accessors only in compatibility stubs 2021-03-10 09:09:10 +00:00
Mikhael Bogdanov
efceb89b98 Don't generate private members in compatibility mode in DefaultImpls 2021-03-10 09:09:09 +00:00
Mikhael Bogdanov
f648d86d2b Generate stubs for private function with default arguments as public in interfaces 2021-03-10 09:09:08 +00:00
Andrey Zinovyev
7edbf79b4b [KAPT] Don't fail on empty InsnList
Fix failing on empty methods inline methods (after light generation)

#KT-45032 Fixed
2021-03-10 10:58:35 +03:00
Dmitry Petrov
02b5b931d4 Revert "JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+"
This reverts commit 679756ad
2021-03-10 07:39:29 +03:00
Vasily Levchenko
ba3f27b5ce [performance] performace includes kotlinx.cli compositelly 2021-03-09 20:21:25 +00:00
Vasily Levchenko
8f97ba97f2 [kotlinx.cli] dually depends on kotlin artifacts
- in kotlin build this is project dependency
- in performace build this is artifact dependency
2021-03-09 20:21:25 +00:00
Vasily Levchenko
f159a424f5 [build][plugin] kotlin native benchmarking plugin adds dependency kotlinx.cli as project dependency 2021-03-09 20:21:24 +00:00
Vasily Levchenko
0858a92b12 [build-tools] util to substitute dependency notation as artifact or project dependency 2021-03-09 20:21:23 +00:00
Vasily Levchenko
3935c290a9 [performance] prerequisite checks added 2021-03-09 20:21:23 +00:00
Vasily Levchenko
72bb1f5b30 [kotlin-native][performance][plugin] clean up 2021-03-09 20:21:22 +00:00
Sergey Bogolepov
eb54689801 Update coverage sample documentation.
We need to invoke `llvm-profdata` tool from
the same toolchain as Clang (on macOS we use the one from Xcode).

(cherry picked from commit 91665b36af68b7fb3a56c0e7ed7ebb7d819adfb2)
2021-03-09 20:19:37 +00:00
Alexander Shabalin
e53c8ba6ca Add FinalizerQueue to ObjectFactory (#4725)
(cherry picked from commit af70866594c31c81dfcc41b2e8b33c7a0cdc38f5)
2021-03-09 20:19:36 +00:00
Sergey Bogolepov
f840b45ae1 Add hack for kotlinx-datetime:0.1.1 linkage
Provide a `std::system_category` wrapper with
the same mangling as in GCC 4.8.5

(cherry picked from commit ec5828a1f375a74a09aa49182571201e1f67b4fa)
2021-03-09 20:19:35 +00:00
LepilkinaElena
fcbb921194 [LEGACY MM] Escape making extra increments and decrements during coping to the same array (#4731)
(cherry picked from commit 8b601d8e2c6bc772386ebd88d303a032a6f54237)
2021-03-09 20:19:34 +00:00
Igor Chevdar
f9f948fea6 [IR] Fixed problems with nested inline classes
Fixes https://youtrack.jetbrains.com/issue/KT-45139 as well

(cherry picked from commit 44916e39bfa69325a9ab73cb4533bd2612fb4e56)
2021-03-09 20:19:34 +00:00
Sergey Bogolepov
f5f7e976f6 Fix #KT-45094
Rebuild linux toolchains with an older OS.

(cherry picked from commit 1d249ad7b592573dc4478f0f6cefe2766c323e12)
2021-03-09 20:19:33 +00:00
Sergey Bogolepov
357f2be14e [Toolchain] Archive versioning
Allow toolchain builder to add a suffix to toolchain name.
It is useful for rebuilding the same toolchain in different environment.

(cherry picked from commit 83148fc5bb4e8bcc5afcf119df53ec1bc854be17)
2021-03-09 20:19:32 +00:00
Florian Kistner
bd614aba0b Retain typed generics in ObjC export stubs (#4727)
* Add ObjC export test with disabled generics
* Retain typed generics in ObjC export stubs
* Introduce ObjC variance enum to decouple stubs from Kotlin variance

(cherry picked from commit 4d7c78b952a467ca3318c8c49d36b768fdc1ef9c)
2021-03-09 20:19:31 +00:00
LepilkinaElena
6641b4f029 [LEGACY MM] Fixed types in messages for tracing GC (#4729)
(cherry picked from commit 2f34b0f98e77226f02809a685a96ebb683a69e9d)
2021-03-09 20:19:30 +00:00
Dmitry Petrov
679756ad07 JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+ 2021-03-09 23:16:11 +03:00
Alexander Udalov
8294aed40c IR: add descriptor to "unbound symbols not allowed" message
This will help in diagnosing problems such as KT-45236.
2021-03-09 21:07:53 +01:00
Alexander Udalov
e3dc112c5f Add original KotlinType to rendered IrErrorType
Also improve an error message in `IrType.erasedUpperBound`, which seems
like a frequent first place where the JVM IR backend crashes in case an
error type has made it past psi2ir.

This will help in diagnosing problems such as KT-45016.
2021-03-09 21:07:53 +01:00
Alexander Udalov
cd9463ae8d Minor, add toString for GeneratedFile 2021-03-09 21:07:53 +01:00
Alexander Udalov
bdaeaca5ae Psi2ir: do not generate default accessor body for expect properties
Because generateDefaultGetterBody/generateDefaultSetterBody reference
the property's backing field, which in case of extension properties
leads to an error "Unbound symbols not allowed" because extension
property cannot have a backing field.

In some way, this check is similar to the `isExpect` check in
`generatePrimaryConstructor`.
2021-03-09 20:51:02 +01:00
Alexander Udalov
5fc9f3bc17 Minor, add box test for unreachable uninitialized property
#KT-44496
2021-03-09 20:50:39 +01:00
Alexander Udalov
247efb220c Do not require backing fields for extension properties
This has no effect on correct code because extension properties cannot
have a backing field anyway and that is checked separately. But this
function is used in psi2ir to determine whether or not to create a
backing field for a property, and in case the code where the property is
declared is unreachable like in KT-44496 and has no explicit getter or
setter, it would previously return true for extension properties, which
on JVM would result in an actual field in the class file, which made no
sense.

After this change, the compiler will actually crash with an exception in
the IR validaton step because the symbol for the field is unbound. That
is a bit better than proceeding to generate potentially invalid
bytecode, but of course a proper fix would be to report an error in the
frontend.

 #KT-44496
2021-03-09 20:50:39 +01:00
Ilya Kirillov
81baf4fae5 FIR IDE: collect diagnostics under read lock 2021-03-09 18:30:35 +01:00
Ilya Kirillov
770468c78e FIR IDE: refactor designated lazy transformers 2021-03-09 18:30:35 +01:00
Pavel Kirpichenkov
4bc019736b [MPP] Add KotlinSDK to the set of predefined test SDKs
^KT-45145 Fixed
2021-03-09 20:05:32 +03:00
Ilya Kirillov
d8a3dacdc5 FIR: return back supertypeRefs list recreation 2021-03-09 15:41:42 +01:00
Pavel Punegov
efa43052db Fix Kotlin/Native dist path setting in Klib tests 2021-03-09 14:38:59 +00:00
Vladimir Ivanov
fd02802028 [Native] Export KDoc into generated native header 2021-03-09 16:50:23 +03:00
Jinseong Jeon
6427117a35 FIR CFG: correct edge label from a node that returns Nothing
If it's not within a try/catch/finally, that should be an uncaught
exception path.

^KT-45327 Fixed
2021-03-09 14:44:42 +03:00
Jinseong Jeon
d8fb54c6bd Reproduce KT-45327: false positive MUST_INITIALIZED_OR_BE_ABSTRACT after conditional exitProcess 2021-03-09 14:44:42 +03:00
Alexander Udalov
628d75c7cd JVM: fix EnclosingMethod information for SAMs in inline lambdas
Pass parentContext to SamWrapperCodegen from the outside instead of
using the one from parentCodegen. The difference is that in case of an
inline lambda, we're creating an InlineLambdaContext whose parent is a
ClosureContext, but the codegen for that lambda has that latter
ClosureContext as its context. So the getNonInlineOuterContext call in
SamWrapperCodegen.generateInnerClassInformation wasn't able to identify
that this is a context of a lambda that needs to be skipped, and
generated it as EnclosingMethod, which caused Java reflection to fail
because once that lambda was inlined, it was removed and thus didn't
make it to runtime.

 #KT-44827 Fixed
2021-03-09 11:43:11 +01:00
Nikolay Krasko
9e5bf7e05c Increase amount of memory for Gradle Importing Tests
We have OOM in recent tests executions
2021-03-09 13:32:27 +03:00
Dmitriy Dolovov
1a3515dbab [Commonizer] Use Flag.Class.IS_VALUE instead of Flag.Class.IS_INLINE
Also: Rename CirClass.isInline to CirClass.isValue
2021-03-09 13:13:30 +03:00
Dmitriy Dolovov
0fb99f1bf2 [Commonizer] Rename: entityBuilders.kt to CirSerializers.kt 2021-03-09 13:13:24 +03:00
Dmitriy Dolovov
b41cc57ff7 [Commonizer] Rename: Cir<Entity>.build<Entity> to Cir<Entity>.serialize<Entity> 2021-03-09 13:13:18 +03:00
Dmitriy Dolovov
010ea39417 [Commonizer] Rename: MetadataBuilder -> CirTreeSeralizer 2021-03-09 13:13:13 +03:00
Dmitriy Dolovov
4f33abf5e4 [Commonizer] Minor. Rename: CirTypeProjectionImpl -> CirRegularTypeProjection 2021-03-09 13:13:06 +03:00
Dmitriy Dolovov
6b0f080ed8 [Commonizer] Rename: TypeParameterResolver -> CirTypeParameterResolver 2021-03-09 13:12:59 +03:00
Dmitriy Dolovov
d07ede7305 [Commonizer] Move all CIR deserialization logic to CirDeserializers.kt 2021-03-09 13:12:53 +03:00
Dmitriy Dolovov
1737bdd4d4 [Commonizer] Extract CirTypeResolver to a separate file 2021-03-09 13:12:47 +03:00
Dmitriy Dolovov
6697c4d197 [Commonizer] Put all CIR utils to a single file 2021-03-09 13:12:42 +03:00
Dmitriy Dolovov
20ab88c001 [Commonizer] Extract CirStandardTypes from CirTypeFactory 2021-03-09 13:12:37 +03:00
Dmitriy Dolovov
298b595826 [Commonizer] Move TA expander to 'commonizer.metadata' package 2021-03-09 13:12:32 +03:00
Dmitriy Dolovov
82589c0898 [Commonizer] Move recursion markers to 'commonizer.cir' package 2021-03-09 13:12:26 +03:00
Dmitriy Dolovov
f0669c752f [Commonizer] Extract creation of CirProperty from CirPropertyFactory 2021-03-09 13:12:21 +03:00
Dmitriy Dolovov
3778d1d631 [Commonizer] Extract creation of CirFunction from CirFunctionFactory 2021-03-09 13:12:15 +03:00
Dmitriy Dolovov
d3c60ab72e [Commonizer] Extract creation of CirClass from CirClassFactory 2021-03-09 13:12:09 +03:00
Dmitriy Dolovov
fa9285aac7 [Commonizer] Extract creation of CirTypeAlias from CirTypeAliasFactory 2021-03-09 13:12:04 +03:00
Dmitriy Dolovov
52d0250dc6 [Commonizer] Extract creation of CirClassConstructor from CirClassConstructorFactory 2021-03-09 13:11:59 +03:00
Dmitriy Dolovov
cdba0d029e [Commonizer] Extract creation of CirExtensionReceiver from CirExtensionReceiverFactory 2021-03-09 13:11:52 +03:00
Dmitriy Dolovov
885026f6db [Commonizer] Extract creation of CirTypeParameter from CirTypeParameterFactory 2021-03-09 13:11:47 +03:00
Dmitriy Dolovov
b30ebe2842 [Commonizer] Drop CirPackageFactory 2021-03-09 13:11:41 +03:00
Dmitriy Dolovov
bfe0623837 [Commonizer] Drop CirModuleFactory 2021-03-09 13:11:35 +03:00
Dmitriy Dolovov
1f17d238f8 [Commonizer] Drop CirRootFactory 2021-03-09 13:11:30 +03:00
Dmitriy Dolovov
d7ed8ff804 [Commonizer] Encapsulate interning inside of CIR entities: CirTypeAliasType 2021-03-09 13:11:24 +03:00
Dmitriy Dolovov
36294352ef [Commonizer] Encapsulate interning inside of CIR entities: CirClassType 2021-03-09 13:11:19 +03:00
Dmitriy Dolovov
c6d8cddcd9 [Commonizer] Encapsulate interning inside of CIR entities: CirTypeParameterType 2021-03-09 13:11:14 +03:00
Dmitriy Dolovov
3012839f49 [Commonizer] Encapsulate interning inside of CIR entities: CirAnnotation 2021-03-09 13:11:08 +03:00
Dmitriy Dolovov
f7d977d7c4 [Commonizer] Encapsulate interning inside of CIR entities: CirPropertySetter 2021-03-09 13:11:02 +03:00
Dmitriy Dolovov
f1739980d3 [Commonizer] Encapsulate interning inside of CIR entities: CirPropertyGetter 2021-03-09 13:10:57 +03:00
Dmitriy Dolovov
ec1e4fb26e [Commonizer] Encapsulate interning inside of CIR entities: CirFunctionModifiers 2021-03-09 13:10:51 +03:00
Dmitriy Dolovov
5e41a7c66b [Commonizer] Encapsulate interning inside of CIR entities: CirValueParameter 2021-03-09 13:10:46 +03:00
Dmitriy Dolovov
f43626d545 [Commonizer] Drop no more necessary logic for forward declarations 2021-03-09 13:10:40 +03:00
Dmitriy Dolovov
12be9c99ca [Commonizer] Replace DescriptorVisibilit[y,ies] by Visibilit[y,ies] 2021-03-09 13:10:35 +03:00
Dmitriy Dolovov
7bdbc893a0 [Commonizer] Move test-specific logic to 'tests' module 2021-03-09 13:10:30 +03:00
Dmitriy Dolovov
a0baecc6e4 [Commonizer] Rename: CirTreeMergerV2 -> CirTreeMerger 2021-03-09 13:10:24 +03:00
Dmitriy Dolovov
126b634529 [Commonizer] Drop support of descriptors, part 2 2021-03-09 13:10:18 +03:00
Dmitriy Dolovov
607568fb73 [Commonizer] Rework mocks for tests to drop descriptors 2021-03-09 13:10:13 +03:00
Dmitriy Dolovov
e96dd3b301 [Commonizer] Drop support of descriptors, part 1 2021-03-09 13:10:07 +03:00
Dmitriy Dolovov
eddeef1d51 [Commonizer] Build CIR tree directly from metadata 2021-03-09 13:10:01 +03:00
sebastian.sellmair
3d6893e518 [Commonizer] Implement safe SharedCommonizerTarget factory function
Do not try to instantiate SharedCommonizerTarget with no leaves
^KT-45350 Verification Pending
2021-03-09 10:02:00 +00:00
sebastian.sellmair
6527452143 [Commonizer] Add CommonizerIT test for ^KT-45350
Adding a test project containing commonization targets for
ios, linux and windows to test behaviour if at least one commonizer group
is fully not supported.
2021-03-09 10:02:00 +00:00
2559 changed files with 90849 additions and 18059 deletions

5
.gitignore vendored
View File

@@ -32,6 +32,8 @@ build/
.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/runConfigurations/PILL_*.xml
.idea/runConfigurations/_FP_*.xml
.idea/runConfigurations/_MT_*.xml
.idea/libraries
.idea/modules.xml
.idea/gradle.xml
@@ -54,6 +56,7 @@ build/
.idea/artifacts/kotlin_test_js_ir_*
.idea/artifacts/kotlin_stdlib_wasm_*
.idea/jarRepositories.xml
.idea/csv-plugin.xml
kotlin-ultimate/
node_modules/
.rpt2_cache/
@@ -63,4 +66,4 @@ buildSrcTmp/
distTmp/
outTmp/
/test.output
/kotlin-native/dist
/kotlin-native/dist

View File

@@ -1,8 +1,6 @@
<component name="ArtifactManager">
<artifact type="jar" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT">
<output-path>$PROJECT_DIR$/kotlin-native/endorsedLibraries/kotlinx.cli/build/libs</output-path>
<root id="archive" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT.jar">
<element id="module-output" name="kotlin.kotlin-native.endorsedLibraries.kotlinx.cli.jvmMain" />
</root>
<root id="archive" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT.jar" />
</artifact>
</component>

View File

@@ -0,0 +1,8 @@
<component name="ProjectDictionaryState">
<dictionary name="sebastiansellmair">
<words>
<w>cinterops</w>
<w>interops</w>
</words>
</dictionary>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -21,4 +21,4 @@
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/kotlin-stdlib-gen" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true">
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -16,4 +16,4 @@
<option name="vmOptions" value="" />
</ExternalSystemSettings>
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method v="2" />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/binary-compatibility-validator" />
@@ -18,4 +18,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -19,4 +19,4 @@
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>
</component>

View File

@@ -106,6 +106,8 @@ To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run p
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
To build Kotlin/Native, see
[kotlin-native/README.md](kotlin-native/README.md#building-from-source).
### Building for different versions of IntelliJ IDEA and Android Studio
@@ -145,28 +147,6 @@ From this root project there are Run/Debug Configurations for running `IDEA` or
* Run the `IDEA` run configuration in the project
* A child IntelliJ IDEA with the Kotlin plugin will then startup
### Including into composite build
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle.kts`
```Kotlin
includeBuild("/path/to/kotlin") {
dependencySubstitution {
substitute(module("org.jetbrains.kotlin:kotlin-compiler"))
.with(project(":include:kotlin-compiler"))
}
}
```
or in `settings.gradle`
```Groovy
includeBuild('/path/to/kotlin') {
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
}
}
```
# License
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.

View File

@@ -92,18 +92,16 @@ benchmark {
}
}
tasks.named("classes") {
doLast {
tasks.named("mainBenchmarkJar", Zip::class.java) {
isZip64 = true
archiveName = "benchmarks.jar"
}
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
tasks.named(it, JavaExec::class.java) {
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
}
}
tasks.matching { it is Zip && it.name == "mainBenchmarkJar" }.configureEach {
this as Zip
isZip64 = true
archiveFileName.set("benchmarks.jar")
}
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
tasks.matching { it is JavaExec && it.name in benchmarkTasks }.configureEach {
this as JavaExec
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
tasks.register<JavaExec>("runBenchmark") {

View File

@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.context.withProject
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.createSession
import org.jetbrains.kotlin.fir.createSessionForTests
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
@@ -150,7 +150,7 @@ abstract class AbstractSimpleFileBenchmark {
private fun analyzeGreenFileIr(bh: Blackhole) {
val scope = GlobalSearchScope.filesScope(env.project, listOf(file.virtualFile))
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSession(env, scope)
val session = createSessionForTests(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)

View File

@@ -26,11 +26,13 @@ open class GeneratedFile(
val outputFile: File
) {
val sourceFiles = sourceFiles.sortedBy { it.path }
override fun toString(): String = "${this::class.java.simpleName}: $outputFile"
}
class GeneratedJvmClass (
sourceFiles: Collection<File>,
outputFile: File
class GeneratedJvmClass(
sourceFiles: Collection<File>,
outputFile: File
) : GeneratedFile(sourceFiles, outputFile) {
val outputClass = LocalFileKotlinClass.create(outputFile).sure {
"Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations"

View File

@@ -27,7 +27,7 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
@@ -159,6 +159,7 @@ rootProject.apply {
from(rootProject.file("gradle/checkArtifacts.gradle.kts"))
from(rootProject.file("gradle/checkCacheability.gradle.kts"))
from(rootProject.file("gradle/retryPublishing.gradle.kts"))
from(rootProject.file("gradle/modularizedTestConfigurations.gradle.kts"))
}
IdeVersionConfigurator.setCurrentIde(project)
@@ -182,7 +183,7 @@ 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.3"
extra["versions.r8"] = "2.0.88"
extra["versions.r8"] = "2.1.75"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -565,10 +566,13 @@ allprojects {
}
}
gradle.buildFinished {
val taskGraph = gradle?.taskGraph
if (taskGraph != null) {
taskGraph.allTasks
if ((gradle.startParameter as? org.gradle.api.internal.StartParameterInternal)?.isConfigurationCache != true) {
// TODO: remove it once Gradle is bumped to 6.8:
// See https://docs.gradle.org/6.8/release-notes.html#more-cache-hits-when-empty-directories-are-present
gradle.buildFinished {
val taskGraph = gradle?.taskGraph
if (taskGraph != null) {
taskGraph.allTasks
.filterIsInstance<SourceTask>()
.filter { it.didWork }
.forEach {
@@ -578,6 +582,7 @@ gradle.buildFinished {
}
}
}
}
}
}
@@ -621,17 +626,12 @@ val ideaPlugin by task<Task> {
}
tasks {
named("clean") {
doLast {
delete("$buildDir/repo")
delete(distDir)
}
named<Delete>("clean") {
delete += setOf("$buildDir/repo", distDir)
}
register("cleanupArtifacts") {
doLast {
delete(artifactsDir)
}
register<Delete>("cleanupArtifacts") {
delete = setOf(artifactsDir)
}
listOf("clean", "assemble", "install").forEach { taskName ->
@@ -730,10 +730,12 @@ tasks {
register("scriptingTest") {
dependsOn("dist")
dependsOn(":kotlin-script-util:test")
dependsOn(":kotlin-scripting-compiler-embeddable:test")
dependsOn(":kotlin-scripting-compiler:test")
dependsOn(":kotlin-scripting-compiler:testWithIr")
dependsOn(":kotlin-scripting-common:test")
dependsOn(":kotlin-scripting-jvm:test")
dependsOn(":kotlin-scripting-jvm-host-test:test")
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
dependsOn(":kotlin-scripting-dependencies:test")
dependsOn(":kotlin-scripting-dependencies-maven:test")
dependsOn(":kotlin-scripting-jsr223-test:test")
@@ -741,6 +743,7 @@ tasks {
// dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest")
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
dependsOn(":kotlin-main-kts-test:test")
dependsOn(":kotlin-main-kts-test:testWithIr")
dependsOn(":kotlin-scripting-ide-services-test:test")
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
dependsOn(":kotlin-scripting-js-test:test")
@@ -892,17 +895,11 @@ tasks {
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
":libraries:tools:new-project-wizard:new-project-wizard-cli:test"
)
}
}
register("ideaIntegrationsTests") {
if (Ide.IJ()) {
dependsOn(":idea:idea-new-project-wizard:test")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
@@ -1209,7 +1206,8 @@ val Jar.outputFile: File
val Project.sourceSetsOrNull: SourceSetContainer?
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
val disableVerificationTasks = providers.systemProperty("disable.verification.tasks")
.forUseAtConfigurationTime().orNull?.toBoolean() ?: false
if (disableVerificationTasks) {
gradle.taskGraph.whenReady {
allTasks.forEach {

View File

@@ -11,10 +11,8 @@ buildscript {
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
} else {
jcenter()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
}
@@ -24,7 +22,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -84,10 +82,9 @@ extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build"
repositories {
jcenter()
mavenCentral()
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://kotlin.bintray.com/kotlinx")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
@@ -147,8 +144,8 @@ java {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
implementation("com.gradle.publish:plugin-publish-plugin:0.13.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
@@ -161,7 +158,7 @@ dependencies {
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("org.gradle:test-retry-gradle-plugin:1.2.0")
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
compileOnly(gradleApi())
@@ -199,6 +196,7 @@ java {
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += listOf(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xskip-runtime-version-check",
@@ -262,4 +260,4 @@ gradlePlugin {
implementationClass = "org.jetbrains.kotlin.NativeInteropPlugin"
}
}
}
}

View File

@@ -20,7 +20,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
}
}

View File

@@ -0,0 +1,51 @@
import org.gradle.api.Action
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withGroovyBuilder
/*
* 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.
*/
class InstrumentJava(@Transient val javaInstrumentator: Configuration, @Transient val sourceSet: SourceSet) : Action<Task> {
private val instrumentatorClasspath: String by lazy {
javaInstrumentator.asPath
}
private val srcDirs: FileCollection by lazy {
sourceSet.allJava.sourceDirectories
}
override fun execute(task: Task) {
require(task is JavaCompile) { "$task is not of type JavaCompile!" }
task.doLast {
task.ant.withGroovyBuilder {
"taskdef"(
"name" to "instrumentIdeaExtensions",
"classpath" to instrumentatorClasspath,
"loaderref" to "java2.loader",
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
)
}
val javaSourceDirectories = srcDirs.filter { it.exists() }
task.ant.withGroovyBuilder {
javaSourceDirectories.forEach { directory ->
"instrumentIdeaExtensions"(
"srcdir" to directory,
"destdir" to task.destinationDir,
"classpath" to task.classpath.asPath,
"includeantruntime" to false,
"instrumentNotNull" to true
)
}
}
}
}
}

View File

@@ -25,7 +25,6 @@ import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.Upload
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
import plugins.KotlinBuildPublishingPlugin

View File

@@ -8,48 +8,37 @@ package tasks
import groovy.util.Node
import groovy.util.XmlParser
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File
import java.util.*
open class WriteCopyrightToFile : DefaultTask() {
abstract class WriteCopyrightToFile : DefaultTask() {
@InputFile
var path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
val path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
@OutputFile
var outputFile: File? = null
@get:OutputFile
abstract val outputFile: RegularFileProperty
@Input
var commented: Boolean = true
@get:Input
val commented: Property<Boolean> = project.objects.property(Boolean::class.java).convention(true)
@TaskAction
fun write() {
if (commented) {
outputFile!!.writeText(project.readCopyrightCommented())
} else {
outputFile!!.writeText(project.readCopyright())
}
val file = outputFile.asFile.get()
file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright())
}
fun Project.readCopyright(): String {
val file = rootDir.resolve(".idea/copyright/apache.xml")
assert(file.exists()) {
"File $file with copyright not found"
private fun readCopyright(): String {
assert(path.exists()) {
"File $path with copyright not found"
}
val xmlParser = XmlParser()
val node = xmlParser.parse(file)
val node = xmlParser.parse(path)
assert(node.attribute("name") == "CopyrightManager") {
"Format changed occasionally?"
}
@@ -59,7 +48,7 @@ open class WriteCopyrightToFile : DefaultTask() {
return noticeNode.attribute("value").toString().replace("&#36;today.year", GregorianCalendar()[Calendar.YEAR].toString())
}
fun Project.readCopyrightCommented(): String {
private fun readCopyrightCommented(): String {
return "/*\n" + readCopyright().prependIndent(" * ") + "\n */"
}
}

View File

@@ -128,7 +128,6 @@ fun Project.rewriteDepsToShadedJar(
archiveClassifier.set("original")
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
shadowJarTask.configure {
dependsOn(originalJarTask)
@@ -136,7 +135,8 @@ fun Project.rewriteDepsToShadedJar(
// When Gradle traverses the inputs, reject the shaded compiler JAR,
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile }
exclude { it.file == compilerDummyJarFile.get() }
archiveClassifier.set("original")
body()

View File

@@ -21,15 +21,18 @@ import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.internal.ConventionTask
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.tasks.*
import org.gradle.api.tasks.compile.AbstractCompile
import org.gradle.kotlin.dsl.*
import java.io.File
import javax.inject.Inject
fun Project.configureFormInstrumentation() {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.configureEach {
// When we change the output classes directory, Gradle will automatically configure
// the test compile tasks to use the instrumented classes. Normally this is fine,
// however, it causes problems for Kotlin projects:
@@ -42,31 +45,36 @@ fun Project.configureFormInstrumentation() {
// This fails when we change the classes dir. The easiest fix is to prepend the
// classes from the "friendly directory" to the compile classpath.
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
testCompile?.doFirst {
val originalClassesDirs = files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy"))
if (!tasks.names.contains("compileTestKotlin")) return@configureEach
testCompile.classpath = (testCompile.classpath
- mainSourceSet.output.classesDirs
+ originalClassesDirs)
tasks.named<AbstractCompile>("compileTestKotlin") {
val objects = project.objects
val classesDirs = project.mainSourceSet.output.classesDirs
val classesDirsCopy = project.provider { (mainSourceSet as ExtensionAware).extra.get("classesDirsCopy") }
doFirst {
val originalClassesDirs = objects.fileCollection().from(classesDirsCopy)
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
// -Xfriend-paths compiler argument as well.
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
classpath = (classpath
- classesDirs
+ originalClassesDirs)
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
// -Xfriend-paths compiler argument as well.
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
}
addFreeCompilerArgs(this as AbstractCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
}
addFreeCompilerArgs(testCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
}
}
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
@@ -76,7 +84,7 @@ fun Project.configureFormInstrumentation() {
}
afterEvaluate {
sourceSets.all { sourceSetParam ->
sourceSets.forEach { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
@@ -88,66 +96,82 @@ fun Project.configureFormInstrumentation() {
(sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir)
val instrumentTask =
project.tasks.register(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java) {
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
sourceSet = sourceSetParam
instrumentationClasspath = instrumentationClasspathCfg
originalClassesDirs = classesDirsCopy
output = instrumentedClassesDir
outputs.dir(instrumentedClassesDir)
dependsOn(sourceSetParam.classesTaskName)
compileClasspath.from(sourceSetParam.compileClasspath)
sourceDirs.from(project.files({ sourceSetParam.allSource.srcDirs.filter { !sourceSetParam.resources.contains(it) && it.exists() } }))
instrumentationClasspathConfiguration = instrumentationClasspathCfg
originalClassesDirs.from(classesDirsCopy)
output.set(instrumentedClassesDir)
}
// Ensure that our task is invoked when the source set is built
sourceSetParam.compiledBy(instrumentTask)
@Suppress("UNUSED_EXPRESSION")
true
}
}
}
@CacheableTask
open class IntelliJInstrumentCodeTask : ConventionTask() {
abstract class IntelliJInstrumentCodeTask : ConventionTask() {
companion object {
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
private const val LOADER_REF = "java2.loader"
}
@Classpath
var instrumentationClasspath: Configuration? = null
@Transient
@Internal
lateinit var instrumentationClasspathConfiguration: Configuration
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
var originalClassesDirs: FileCollection? = null
@get:Classpath
val instrumentationClasspath: String by lazy {
instrumentationClasspathConfiguration.asPath
}
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:SkipWhenEmpty
abstract val originalClassesDirs: ConfigurableFileCollection
@get:Input
var instrumentNotNull: Boolean = false
@Internal
var sourceSet: SourceSet? = null
@get:InputFiles
@get:Classpath
abstract val compileClasspath: ConfigurableFileCollection
// Instrumentation needs to have access to sources of forms for inclusion
private val depSourceDirectorySets by lazy {
project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
}
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
val sourceDirs: FileCollection
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
abstract val sourceDirs: ConfigurableFileCollection
@get:OutputDirectory
lateinit var output: File
abstract val output: RegularFileProperty
@get:Inject
abstract val fs: FileSystemOperations
@TaskAction
fun instrumentClasses() {
logger.info(
"input files are: ${originalClassesDirs?.joinToString(
"; ",
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })}"
"input files are: ${
originalClassesDirs.joinToString(
"; ",
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })
}"
)
output.deleteRecursively()
output.asFile.get().deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath!!
val classpath = instrumentationClasspath
ant.withGroovyBuilder {
"taskdef"(
"name" to "instrumentIdeaExtensions",
"classpath" to classpath.asPath,
"classpath" to classpath,
"loaderref" to LOADER_REF,
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
)
@@ -155,14 +179,14 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
logger.info("Compiling forms and instrumenting code with nullability preconditions")
if (instrumentNotNull) {
prepareNotNullInstrumenting(classpath.asPath)
prepareNotNullInstrumenting(classpath)
}
instrumentCode(sourceDirs, instrumentNotNull)
}
private fun copyOriginalClasses() {
project.copy {
fs.copy {
from(originalClassesDirs)
into(output)
}
@@ -181,12 +205,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
val headlessOldValue = System.setProperty("java.awt.headless", "true")
val output = output.get().asFile
// Instrumentation needs to have access to sources of forms for inclusion
val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
val instrumentationClasspath =
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
depSourceDirectorySets.fold(compileClasspath as FileCollection) { acc, v -> acc + v }.asPath.also {
logger.info("Using following dependency source dirs: $it")
}

View File

@@ -10,31 +10,16 @@ import java.io.File
import org.gradle.api.Project
open class PillExtension {
/*
* Here's how you can specify a custom variant:
* `./gradlew pill -Dpill.variant=<NAME>`
*/
enum class Variant {
// Default variant (./gradlew pill)
BASE() {
override val includes = setOf(BASE)
},
// Full variant (./gradlew pill -Dpill.variant=full)
FULL() {
override val includes = setOf(BASE, FULL)
},
// Do not import the project to JPS model, but set some options for it
NONE() {
override val includes = emptySet<Variant>()
},
// 'BASE' if the "jps-compatible" plugin is applied, 'NONE' otherwise
DEFAULT() {
override val includes = emptySet<Variant>()
};
abstract val includes: Set<Variant>
BASE, // Includes compiler and IDE (default)
FULL, // Includes compiler, IDE and Gradle plugin
}
open var variant: Variant = Variant.DEFAULT
open var variant: Variant? = null
open var excludedDirs: List<File> = emptyList()
@@ -45,7 +30,7 @@ open class PillExtension {
@Suppress("unused")
fun serialize() = mapOf<String, Any?>(
"variant" to variant.name,
"variant" to variant?.name,
"excludedDirs" to excludedDirs
)
}

View File

@@ -64,6 +64,9 @@ private fun createMavenMarkerPublication(
): MavenPublication {
return publications.create<MavenPublication>(declaration.name.toString() + "PluginMarkerMaven") {
val pluginId: String = declaration.id
val cGroupId = coordinates.groupId
val cArtifactId = coordinates.artifactId
val cVersion = coordinates.version
artifactId = pluginId + PLUGIN_MARKER_SUFFIX
groupId = pluginId
pom.withXml {
@@ -72,11 +75,11 @@ private fun createMavenMarkerPublication(
val dependencies = root.appendChild(document.createElement("dependencies"))
val dependency = dependencies.appendChild(document.createElement("dependency"))
val groupId = dependency.appendChild(document.createElement("groupId"))
groupId.textContent = coordinates.groupId
groupId.textContent = cGroupId
val artifactId = dependency.appendChild(document.createElement("artifactId"))
artifactId.textContent = coordinates.artifactId
artifactId.textContent = cArtifactId
val version = dependency.appendChild(document.createElement("version"))
version.textContent = coordinates.version
version.textContent = cVersion
}
pom.name.set(declaration.displayName)

View File

@@ -6,12 +6,15 @@
import com.jakewharton.dex.*
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.jvm.tasks.Jar
import java.io.File
@CacheableTask
open class DexMethodCount : DefaultTask() {
abstract class DexMethodCount : DefaultTask() {
data class Counts(
val total: Int,
@@ -24,16 +27,18 @@ open class DexMethodCount : DefaultTask() {
@Classpath
lateinit var jarFile: File
@Optional
@Input
var ownPackages: List<String>? = null
@get:Optional
@get:Input
abstract val ownPackages: ListProperty<String>
@Internal
var artifactName: String? = null
private val projectName = project.name
@get:Input
val artifactOrArchiveName: String
get() = artifactName ?: project.name
get() = artifactName ?: projectName
fun from(jar: Jar) {
jarFile = jar.archiveFile.get().asFile
@@ -45,8 +50,9 @@ open class DexMethodCount : DefaultTask() {
lateinit var counts: Counts
@get:OutputFile
val detailOutputFile: File
get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
val detailOutputFile: File by lazy {
project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
}
@TaskAction
fun invoke() {
@@ -59,9 +65,9 @@ open class DexMethodCount : DefaultTask() {
val byPackage = this.groupingBy { it.`package` }.eachCount()
val byClass = this.groupingBy { it.declaringType }.eachCount()
val ownPackages = ownPackages?.map { "$it." }
val byOwnPackages = if (ownPackages != null) {
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
val ownPackages = ownPackages.map { list -> list.map { "$it." } }
val byOwnPackages = if (ownPackages.isPresent) {
this.partition { method -> ownPackages.get().any { method.declaringType.startsWith(it) } }.let {
it.first.size to it.second.size
}
} else (null to null)
@@ -78,7 +84,7 @@ open class DexMethodCount : DefaultTask() {
private fun outputDetails(counts: Counts) {
detailOutputFile.printWriter().use { writer ->
writer.println("${counts.total.padRight()}\tTotal methods")
ownPackages?.let { packages ->
ownPackages.orNull?.let { packages ->
writer.println("${counts.totalOwnPackages?.padRight()}\tTotal methods from packages ${packages.joinToString { "$it.*" }}")
writer.println("${counts.totalOtherPackages?.padRight()}\tTotal methods from other packages")
}
@@ -96,23 +102,24 @@ open class DexMethodCount : DefaultTask() {
}
}
open class DexMethodCountStats : DefaultTask() {
@Internal
lateinit var from: TaskProvider<DexMethodCount>
abstract class DexMethodCountStats : DefaultTask() {
@get:InputFile
internal val inputFile
get() = from.get().detailOutputFile
internal abstract val inputFile: RegularFileProperty
@get:Input
internal abstract val artifactOrArchiveName: Property<String>
@get:Input
@get:Optional
internal abstract val ownPackages: ListProperty<String>
@TaskAction
private fun printStats() {
val artifactOrArchiveName = from.get().artifactOrArchiveName
inputFile.reader().useLines { lines ->
val artifactOrArchiveName = artifactOrArchiveName.get()
inputFile.get().asFile.reader().useLines { lines ->
fun String.getStatValue() = substringBefore("\t").trim()
val ownPackages = from.get().ownPackages
val statsLineCount = if (ownPackages == null) 1 else 3
val statsLineCount = if (!ownPackages.isPresent) 1 else 3
val stats = lines.take(statsLineCount).map { it.getStatValue() }.toList()
val total = stats[0]
@@ -122,7 +129,7 @@ open class DexMethodCountStats : DefaultTask() {
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='$total']")
}
ownPackages?.let { packages ->
ownPackages.map { packages ->
val totalOwnPackages = stats[1]
val totalOtherPackages = stats[2]
@@ -141,7 +148,9 @@ open class DexMethodCountStats : DefaultTask() {
fun Project.printStats(dexMethodCount: TaskProvider<DexMethodCount>) {
val dexMethodCountStats = tasks.register("dexMethodCountStats", DexMethodCountStats::class.java) {
dependsOn(dexMethodCount)
from = dexMethodCount
inputFile.set(dexMethodCount.flatMap { objects.fileProperty().apply { set(it.detailOutputFile) } })
artifactOrArchiveName.set(dexMethodCount.map { it.artifactOrArchiveName })
ownPackages.set(dexMethodCount.flatMap { it.ownPackages })
}
dexMethodCount.configure {

View File

@@ -9,11 +9,14 @@
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.support.serviceOf
import java.io.File
import java.lang.Character.isLowerCase
import java.lang.Character.isUpperCase
@@ -43,6 +46,7 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
":kotlin-gradle-subplugin-example",
":kotlin-stdlib-common",
":kotlin-stdlib",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-stdlib-js",
":examples:annotation-processor-example",
@@ -80,129 +84,141 @@ fun Project.projectTest(
shortenTempRootName: Boolean = false,
jUnit5Enabled: Boolean = false,
body: Test.() -> Unit = {}
): TaskProvider<Test> = getOrCreateTask(taskName) {
doFirst {
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
val patterns = filter.includePatterns + commandLineIncludePatterns
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
patterns.forEach { pattern ->
var isClassPattern = false
val maybeMethodName = pattern.substringAfterLast('.')
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
pattern.substringBeforeLast('.')
} else {
isClassPattern = true
pattern
}
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
return@forEach
}
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
val classFileName = "$classFileNameWithoutExtension.class"
if (isClassPattern) {
val innerClassPattern = "$pattern$*"
if (pattern in commandLineIncludePatterns) {
commandLineIncludePatterns.add(innerClassPattern)
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
} else {
filter.includePatterns.add(innerClassPattern)
}
}
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 {
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
): TaskProvider<Test> {
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
.forUseAtConfigurationTime().orNull?.toBoolean() != true
if (shouldInstrument) {
evaluationDependsOn(":test-instrumenter")
}
if (project.findProperty("kotlin.test.instrumentation.disable")?.toString()?.toBoolean() != true) {
return getOrCreateTask<Test>(taskName) {
doFirst {
val agent = tasks.findByPath(":test-instrumenter:jar")!!.outputs.files.singleFile
val args = project.findProperty("kotlin.test.instrumentation.args")?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
}
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
val patterns = filter.includePatterns + commandLineIncludePatterns
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
patterns.forEach { pattern ->
var isClassPattern = false
val maybeMethodName = pattern.substringAfterLast('.')
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
pattern.substringBeforeLast('.')
} else {
isClassPattern = true
pattern
}
jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseCodeCacheFlushing",
"-XX:ReservedCodeCacheSize=256m",
"-Djna.nosys=true"
)
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
return@forEach
}
maxHeapSize = "1600m"
systemProperty("idea.is.unit.test", "true")
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
systemProperty("java.awt.headless", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath)
environment("PROJECT_BUILD_DIR", buildDir)
systemProperty("jps.kotlin.home", rootProject.extra["distKotlinHomeDir"]!!)
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (rootProject.hasProperty("skipMutedTests")) "true" else "false")
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
val classFileName = "$classFileNameWithoutExtension.class"
if (Platform[202].orHigher()) {
systemProperty("idea.ignore.disabled.plugins", "true")
}
if (isClassPattern) {
val innerClassPattern = "$pattern$*"
if (pattern in commandLineIncludePatterns) {
commandLineIncludePatterns.add(innerClassPattern)
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
} else {
filter.includePatterns.add(innerClassPattern)
}
}
var subProjectTempRoot: Path? = null
doFirst {
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
(teamcity?.get("teamcity.build.tempDir") as? String)
?: System.getProperty("java.io.tmpdir")
systemTempRoot.let {
val prefix = (project.name + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
}
}
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()
doLast {
subProjectTempRoot?.let {
try {
delete(it)
} catch (e: Exception) {
project.logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
include { treeElement ->
val path = treeElement.path
if (treeElement.isDirectory) {
classFileNameWithoutExtension.startsWith(path)
} else {
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
}
}
if (parallel && !jUnit5Enabled) {
maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
body()
if (shouldInstrument) {
val instrumentationArgsProperty = project.providers.gradleProperty("kotlin.test.instrumentation.args")
val testInstrumenterOutputs = project.tasks.findByPath(":test-instrumenter:jar")!!.outputs.files
doFirst {
val agent = testInstrumenterOutputs.singleFile
val args = instrumentationArgsProperty.orNull?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
}
jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseCodeCacheFlushing",
"-XX:ReservedCodeCacheSize=256m",
"-Djna.nosys=true"
)
maxHeapSize = "1600m"
systemProperty("idea.is.unit.test", "true")
systemProperty("idea.home.path", project.intellijRootDir().canonicalPath)
systemProperty("java.awt.headless", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
environment("PROJECT_CLASSES_DIRS", project.testSourceSet.output.classesDirs.asPath)
environment("PROJECT_BUILD_DIR", project.buildDir)
systemProperty("jps.kotlin.home", project.rootProject.extra["distKotlinHomeDir"]!!)
systemProperty("kotlin.ni", if (project.rootProject.hasProperty("newInferenceTests")) "true" else "false")
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (project.rootProject.hasProperty("skipMutedTests")) "true" else "false")
if (Platform[202].orHigher()) {
systemProperty("idea.ignore.disabled.plugins", "true")
}
var subProjectTempRoot: Path? = null
val projectName = project.name
val teamcity = project.rootProject.findProperty("teamcity") as? Map<*, *>
doFirst {
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
(teamcity?.get("teamcity.build.tempDir") as? String)
?: System.getProperty("java.io.tmpdir")
systemTempRoot.let {
val prefix = (projectName + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
}
}
val fs = project.serviceOf<FileSystemOperations>()
doLast {
subProjectTempRoot?.let {
try {
fs.delete {
delete(it)
}
} catch (e: Exception) {
logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
}
}
}
if (parallel && !jUnit5Enabled) {
maxParallelForks =
project.providers.gradleProperty("kotlin.test.maxParallelForks").forUseAtConfigurationTime().orNull?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (project.kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
}.apply { configure(body) }
}
private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(first())
@@ -229,18 +245,25 @@ private fun Task.useAndroidConfiguration(systemPropertyName: String, configName:
val configuration = with(project) {
configurations.getOrCreate(configName)
.also {
dependencies.add(
configName,
dependencies.project(":dependencies:android-sdk", configuration = configName)
)
if (it.allDependencies.matching { dep ->
dep is ProjectDependency &&
dep.targetConfiguration == configName &&
dep.dependencyProject.path == ":dependencies:android-sdk"
}.count() == 0) {
dependencies.add(
configName,
dependencies.project(":dependencies:android-sdk", configuration = configName)
)
}
}
}
dependsOn(configuration)
if (this is Test) {
val androidFilePath = configuration.singleFile.canonicalPath
doFirst {
systemProperty(systemPropertyName, configuration.singleFile.canonicalPath)
systemProperty(systemPropertyName, androidFilePath)
}
}
}

View File

@@ -9,13 +9,13 @@ import org.gradle.internal.os.OperatingSystem
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
if (extensions.findByType(TestDistributionExtension::class.java) == null) return
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)
enabled.set(true)
maxRemoteExecutors.set(20)
if (isTeamcityBuild) {
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))

View File

@@ -116,6 +116,12 @@ object AbstractTypeMapper {
return asmType
}
typeConstructor.isScript() -> {
val asmType = AsmTypes.JAVA_CLASS_TYPE
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 ->

View File

@@ -51,7 +51,6 @@ interface BaseExpressionCodegen {
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
@JvmDefault
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
with(typeSystem) {
val (typeParameter, second) = extractReificationArgument(type) ?: return

View File

@@ -52,13 +52,14 @@ import org.jetbrains.org.objectweb.asm.Type;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.getMappingFileName;
public class ClassFileFactory implements OutputFileCollection {
private final GenerationState state;
private final ClassBuilderFactory builderFactory;
private final Map<String, OutAndSourceFileList> generators = new LinkedHashMap<>();
private final Map<String, OutAndSourceFileList> generators = Collections.synchronizedMap(new LinkedHashMap<>());
private boolean isDone = false;
@@ -346,7 +347,9 @@ public class ClassFileFactory implements OutputFileCollection {
@Override
public byte[] asBytes(ClassBuilderFactory factory) {
return factory.asBytes(classBuilder);
synchronized(this) {
return factory.asBytes(classBuilder);
}
}
@Override

View File

@@ -88,6 +88,7 @@ import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContextImpl;
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS;
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
import org.jetbrains.kotlin.types.model.TypeParameterMarker;
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
import org.jetbrains.kotlin.util.OperatorNameConventions;
@@ -5532,4 +5533,11 @@ The "returned" value of try expression with no finally is either the last expres
parentCodegen.getReifiedTypeParametersUsages().addUsedReifiedParameter(typeParameterDescriptor.getName().asString());
}
}
@Override
public void putReifiedOperationMarkerIfTypeIsReifiedParameter(
@NotNull KotlinTypeMarker type, @NotNull ReifiedTypeInliner.OperationKind operationKind
) {
BaseExpressionCodegen.DefaultImpls.putReifiedOperationMarkerIfTypeIsReifiedParameter(this, type, operationKind);
}
}

View File

@@ -1152,8 +1152,10 @@ public class FunctionCodegen {
// $default methods are never private to be accessible from other class files (e.g. inner) without the need of synthetic accessors
// $default methods are never protected to be accessible from subclass nested classes
// TODO: maybe best to generate private default in interface as private
int visibilityFlag =
DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor)
(!isInterface(functionDescriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) &&
(DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor))
? AsmUtil.NO_FLAG_PACKAGE_PRIVATE : Opcodes.ACC_PUBLIC;
int flags = visibilityFlag | getDeprecatedAccessFlag(functionDescriptor) | ACC_SYNTHETIC;
if (!(functionDescriptor instanceof ConstructorDescriptor &&
@@ -1689,7 +1691,7 @@ public class FunctionCodegen {
return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) ||
(kind == OwnerKind.DEFAULT_IMPLS &&
(isSyntheticInCompatibilityOrJvmDefault ||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))) && !DescriptorVisibilities.isPrivate(memberDescriptor.getVisibility()));
} else {
switch (kind) {
case DEFAULT_IMPLS: return true;

View File

@@ -34,9 +34,13 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtTypeAlias
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
@@ -125,8 +129,19 @@ class MultifileClassCodegenImpl(
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
var attributes = FACADE_CLASS_ATTRIBUTES
val nonJvmSyntheticParts = files.filterNot { it.isJvmSynthetic() }
if (nonJvmSyntheticParts.isEmpty()) {
attributes = attributes or Opcodes.ACC_SYNTHETIC
} else if (nonJvmSyntheticParts.size < files.size) {
for (part in nonJvmSyntheticParts) {
state.diagnostics.report(ErrorsJvm.NOT_ALL_MULTIFILE_CLASS_PARTS_ARE_JVM_SYNTHETIC.on(part.packageDirective ?: part))
}
}
defineClass(
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
singleSourceFile, state.classFileVersion, attributes,
facadeClassType.internalName, null, superClassForFacade, emptyArray()
)
if (singleSourceFile != null) {
@@ -146,6 +161,13 @@ class MultifileClassCodegenImpl(
}
}
private fun KtFile.isJvmSynthetic(): Boolean {
return annotationEntries.any { entry ->
val descriptor = state.bindingContext[BindingContext.ANNOTATION, entry]
descriptor?.annotationClass?.let(DescriptorUtils::getFqNameSafe) == JVM_SYNTHETIC_ANNOTATION_FQ_NAME
}
}
override fun generate() {
assert(delegateGenerationTasks.isEmpty()) { "generate() is called twice for facade class $facadeFqName" }

View File

@@ -36,14 +36,16 @@ class SamWrapperClasses(private val state: GenerationState) {
expressionCodegen: ExpressionCodegen,
contextDescriptor: CallableMemberDescriptor
): Type {
val isInsideInline = InlineUtil.isInlineOrContainingInline(expressionCodegen.context.contextDescriptor) ||
isInsideInlineLambdaContext(expressionCodegen.context, state)
val parentContext = expressionCodegen.context
val isInsideInline = InlineUtil.isInlineOrContainingInline(parentContext.contextDescriptor) ||
isInsideInlineLambdaContext(parentContext, state)
return samInterfaceToWrapperClass.getOrPut(WrapperKey(samType, file, isInsideInline)) {
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, isInsideInline).genWrapper(file, contextDescriptor)
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, parentContext, isInsideInline)
.genWrapper(file, contextDescriptor)
}
}
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState):Boolean {
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState): Boolean {
var parent: CodegenContext<*>? = context
while (parent != null && parent != state.rootContext) {
if (parent is InlineLambdaContext) return true

View File

@@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
import org.jetbrains.kotlin.codegen.context.ClassContext;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.config.LanguageFeature;
@@ -64,6 +63,7 @@ public class SamWrapperCodegen {
private final KotlinTypeMapper typeMapper;
private final SamType samType;
private final MemberCodegen<?> parentCodegen;
private final CodegenContext<?> parentContext;
private final int visibility;
private final int classFlags;
public static final String SAM_WRAPPER_SUFFIX = "$0";
@@ -72,6 +72,7 @@ public class SamWrapperCodegen {
@NotNull GenerationState state,
@NotNull SamType samType,
@NotNull MemberCodegen<?> parentCodegen,
@NotNull CodegenContext<?> parentContext,
boolean isInsideInline
) {
this.state = state;
@@ -79,6 +80,7 @@ public class SamWrapperCodegen {
this.typeMapper = state.getTypeMapper();
this.samType = samType;
this.parentCodegen = parentCodegen;
this.parentContext = parentContext;
visibility = isInsideInline ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
int synth = state.getLanguageVersionSettings().supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) ? ACC_SYNTHETIC : 0;
classFlags = visibility | ACC_FINAL | ACC_SUPER | synth;
@@ -170,7 +172,6 @@ public class SamWrapperCodegen {
private void generateInnerClassInformation(@NotNull KtFile file, Type asmType, ClassBuilder cv) {
parentCodegen.addSyntheticAnonymousInnerClass(new SyntheticInnerClassInfo(asmType.getInternalName(), classFlags));
FieldOwnerContext<?> parentContext = parentCodegen.context;
CodegenContext<?> outerContext = MemberCodegen.getNonInlineOuterContext(parentContext);
assert outerContext != null :
"Outer context for SAM wrapper " + asmType.getInternalName() + " is null, parentContext:" + parentContext;

View File

@@ -9,15 +9,16 @@ import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.utils.threadLocal
import java.util.*
class GlobalInlineContext(private val diagnostics: DiagnosticSink) {
// Ordered set of declarations and inline calls being generated right now.
// No call in it should point to a declaration that's before it in the stack.
private val inlineCallsAndDeclarations = LinkedList<Any? /* CallableDescriptor | PsiElement? */>()
private val inlineDeclarationSet = mutableSetOf<CallableDescriptor>()
private val inlineCallsAndDeclarations by threadLocal { LinkedList<Any? /* CallableDescriptor | PsiElement? */>() }
private val inlineDeclarationSet by threadLocal { mutableSetOf<CallableDescriptor>() }
private val typesUsedInInlineFunctions = LinkedList<MutableSet<String>>()
private val typesUsedInInlineFunctions by threadLocal { LinkedList<MutableSet<String>>() }
fun enterDeclaration(descriptor: CallableDescriptor) {
assert(descriptor.original !in inlineDeclarationSet) { "entered inlining cycle on $descriptor" }

View File

@@ -28,12 +28,14 @@ class InlineCache {
}
inline fun <K, V : Any> SLRUMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V {
val value = get(key)
return if (value == null) {
val answer = defaultValue()
put(key, answer)
answer
} else {
value
synchronized(this) {
val value = get(key)
return if (value == null) {
val answer = defaultValue()
put(key, answer)
answer
} else {
value
}
}
}

View File

@@ -6,7 +6,6 @@
package org.jetbrains.kotlin.codegen.inline
import com.intellij.psi.PsiElement
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive
@@ -108,11 +107,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
)
}
protected fun generateStub(resolvedCall: ResolvedCall<*>?, codegen: BaseExpressionCodegen) {
protected fun generateStub(text: String, codegen: BaseExpressionCodegen) {
leaveTemps()
assert(resolvedCall != null)
val message = "Call is part of inline cycle: " + resolvedCall!!.call.callElement.text
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message)
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", "Call is part of inline cycle: $text")
}
protected fun endCall(result: InlineResult, registerLineNumberAfterwards: Boolean) {
@@ -601,14 +598,6 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
return (directMember as? ImportedFromObjectCallableDescriptor<*>)?.callableFromObject ?: directMember
}
private fun cloneMethodNode(methodNode: MethodNode): MethodNode {
methodNode.instructions.resetLabels()
return MethodNode(
Opcodes.API_VERSION, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature,
ArrayUtil.toStringArray(methodNode.exceptions)
).also(methodNode::accept)
}
private fun doCreateMethodNodeFromCompiled(
callableDescriptor: CallableMemberDescriptor,
state: GenerationState,

View File

@@ -60,8 +60,8 @@ class PsiInlineCodegen(
callDefault: Boolean,
codegen: ExpressionCodegen
) {
if (!state.globalInlineContext.enterIntoInlining(resolvedCall?.resultingDescriptor, resolvedCall?.call?.callElement)) {
generateStub(resolvedCall, codegen)
if (!state.globalInlineContext.enterIntoInlining(functionDescriptor, resolvedCall?.call?.callElement)) {
generateStub(resolvedCall?.call?.callElement?.text ?: "<no source>", codegen)
return
}
try {

View File

@@ -625,3 +625,13 @@ fun MethodNode.preprocessSuspendMarkers(forInline: Boolean, keepFakeContinuation
}
}
}
fun cloneMethodNode(methodNode: MethodNode): MethodNode {
synchronized(methodNode) {
methodNode.instructions.resetLabels()
return MethodNode(
Opcodes.API_VERSION, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature,
methodNode.exceptions.toTypedArray()
).also(methodNode::accept)
}
}

View File

@@ -57,6 +57,8 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
override fun onUseAsTainted() {
hazard = true
}
fun canRewrite() = !hazard && initCallInsn != null
}
private class Transformer(private val internalClassName: String, private val methodNode: MethodNode) {
@@ -72,7 +74,7 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
assignLocalVars(frames)
for (refValue in refValues) {
if (!refValue.hazard) {
if (refValue.canRewrite()) {
rewriteRefValue(refValue)
}
}

View File

@@ -61,7 +61,7 @@ class InsnSequence(val from: AbstractInsnNode, val to: AbstractInsnNode?) : Sequ
}
}
fun InsnList.asSequence() = InsnSequence(this)
fun InsnList.asSequence(): Sequence<AbstractInsnNode> = if (size() == 0) emptySequence() else InsnSequence(this)
fun MethodNode.prepareForEmitting() {
stripOptimizationMarkers()

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.codegen.optimization.transformer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
import org.jetbrains.org.objectweb.asm.tree.analysis.*;
@@ -31,7 +32,7 @@ public abstract class MethodTransformer {
return analyzer.analyze(internalClassName, node);
}
catch (AnalyzerException e) {
throw new RuntimeException(e);
throw ExceptionUtilsKt.rethrow(e);
}
}

View File

@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import java.util.concurrent.ConcurrentHashMap
class BuilderFactoryForDuplicateClassNameDiagnostics(
@@ -29,7 +30,7 @@ class BuilderFactoryForDuplicateClassNameDiagnostics(
private val diagnostics: DiagnosticSink
) : ClassNameCollectionClassBuilderFactory(builderFactory) {
private val className = hashMapOf<String, JvmDeclarationOrigin> ()
private val className = ConcurrentHashMap<String, JvmDeclarationOrigin>()
override fun handleClashingNames(internalName: String, origin: JvmDeclarationOrigin) {
val another = className.getOrPut(internalName, { origin })

View File

@@ -213,13 +213,13 @@ class GenerationState private constructor(
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
if (fromConfig != null && target >= fromConfig.minJvmTarget)
fromConfig
else {
// TODO wait for KT-44844 (properly support 'invokedynamic' in JPS incremental compilation)
// Use JvmClosureGenerationScheme.INDY if
// JVM target is at least JVM_1_8 &&
// SamWrapperClassesAreSynthetic language feature is supported
else if (
target >= JvmClosureGenerationScheme.INDY.minJvmTarget &&
languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic)
)
JvmClosureGenerationScheme.INDY
else
JvmClosureGenerationScheme.CLASS
}
}
val lambdasScheme = run {

View File

@@ -49,7 +49,6 @@ dependencies {
testCompile(projectTests(":compiler:fir:raw-fir:light-tree2fir"))
testCompile(projectTests(":compiler:fir:fir2ir"))
testCompile(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests"))
testCompile(projectTests(":compiler:visualizer"))
testCompile(projectTests(":generators:test-generator"))
testCompile(project(":compiler:ir.ir2cfg"))
testCompile(project(":compiler:ir.tree")) // used for deepCopyWithSymbols call that is removed by proguard from the compiler TODO: make it more straightforward
@@ -103,8 +102,11 @@ projectTest(parallel = true) {
workingDir = rootDir
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
val antLauncherJarPathProvider = project.provider {
antLauncherJar.asPath
}
doFirst {
systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
systemProperty("kotlin.ant.classpath", antLauncherJarPathProvider.get())
systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
}
}

View File

@@ -42,6 +42,8 @@ found top-level declarations to <destination dir> (*.kotlin_builtins files)"""
assert(missing.isEmpty()) { "These source directories are missing: $missing" }
BuiltInsSerializer(dependOnOldBuiltIns = false).serialize(destDir, srcDirs, listOf()) { totalSize, totalFiles ->
println("Total bytes written: $totalSize to $totalFiles files")
if (System.getProperty("kotlin.builtins.serializer.log") == "true") {
println("Total bytes written: $totalSize to $totalFiles files")
}
}
}

View File

@@ -74,7 +74,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(
value = "-jvm-target",
valueDescription = "<version>",
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8"
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15 or 16), default is 1.8"
)
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)
@@ -84,8 +84,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
// Advanced options
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.WARNING)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument(value = "-Xuse-ir", description = "Use the IR backend")
@Argument(
value = "-Xuse-ir",
description = "Use the IR backend. This option has no effect unless the language version less than 1.5 is used"
)
var useIR: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@@ -489,6 +493,7 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
result[JvmAnalysisFlags.useIR] = useIR
return result
}

View File

@@ -13,6 +13,7 @@ import com.intellij.psi.search.PsiSearchScopeUtil
import com.intellij.util.SmartList
import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport
import org.jetbrains.kotlin.asJava.classes.*
import org.jetbrains.kotlin.config.JvmAnalysisFlags
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
import org.jetbrains.kotlin.load.java.components.FilesByFacadeFqNameIndexer
@@ -109,7 +110,7 @@ class CliKotlinAsJavaSupport(
}
override fun getLightClass(classOrObject: KtClassOrObject): KtLightClass? =
KtLightClassForSourceDeclaration.create(classOrObject)
KtLightClassForSourceDeclaration.create(classOrObject, traceHolder.languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode))
override fun getLightClassForScript(script: KtScript): KtLightClassForScript? =
KtLightClassForScript.create(script)

View File

@@ -283,7 +283,7 @@ class KotlinCoreEnvironment private constructor(
fun addKotlinSourceRoots(rootDirs: List<File>) {
val roots = rootDirs.map { KotlinSourceRoot(it.absolutePath, isCommon = false) }
sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots)
sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots).toSet() - sourceFiles
}
fun createPackagePartProvider(scope: GlobalSearchScope): JvmPackagePartProvider {

View File

@@ -57,9 +57,7 @@ import org.jetbrains.kotlin.fir.analysis.FirAnalyzerFacade
import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendClassResolver
import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendExtension
import org.jetbrains.kotlin.fir.checkers.registerExtendedCommonCheckers
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
import org.jetbrains.kotlin.fir.session.FirJvmModuleInfo
import org.jetbrains.kotlin.fir.session.FirSessionFactory
import org.jetbrains.kotlin.fir.createSessionWithDependencies
import org.jetbrains.kotlin.ir.backend.jvm.jvmResolveLibraries
import org.jetbrains.kotlin.javac.JavacWrapper
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
@@ -318,25 +316,26 @@ object KotlinToJVMBytecodeCompiler {
if (!checkKotlinPackageUsage(environment, ktFiles)) return false
val moduleConfiguration = projectConfiguration.applyModuleProperties(module, buildFile)
val scope = GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
val sourceScope = GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project))
val provider = FirProjectSessionProvider()
val librariesModuleInfo = FirJvmModuleInfo.createForLibraries()
val librariesScope = ProjectScope.getLibrariesScope(project)
FirSessionFactory.createLibrarySession(
librariesModuleInfo, provider, librariesScope,
project, environment.createPackagePartProvider(librariesScope)
)
val moduleInfo = FirJvmModuleInfo(module, listOf(librariesModuleInfo))
val session = FirSessionFactory.createJavaModuleBasedSession(moduleInfo, provider, scope, project) {
val languageVersionSettings = moduleConfiguration.languageVersionSettings
val session = createSessionWithDependencies(
module,
project,
languageVersionSettings,
sourceScope,
librariesScope,
environment::createPackagePartProvider
) {
if (extendedAnalysisMode) {
registerExtendedCommonCheckers()
}
}
val firAnalyzerFacade = FirAnalyzerFacade(session, moduleConfiguration.languageVersionSettings, ktFiles)
val firAnalyzerFacade = FirAnalyzerFacade(session, languageVersionSettings, ktFiles)
firAnalyzerFacade.runResolution()
val firDiagnostics = firAnalyzerFacade.runCheckers().values.flatten()

View File

@@ -74,6 +74,7 @@ internal class K2MetadataKlibSerializer(private val metadataVersion: BuiltInsBin
configuration.languageVersionSettings,
metadataVersion,
project,
exportKDoc = false,
skipExpects = false,
includeOnlyModuleContent = true
).serializeModule(module)

View File

@@ -1,6 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "Compiler runner + daemon client"
plugins {

View File

@@ -25,8 +25,9 @@ tasks.withType<JavaCompile> {
}
tasks.named<ProcessResources>("processResources") {
inputs.property("compilerVersion", kotlinVersion)
val kotlinVersionLocal = kotlinVersion
inputs.property("compilerVersion", kotlinVersionLocal)
filesMatching("META-INF/compiler.version") {
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to kotlinVersion))
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to kotlinVersionLocal))
}
}

View File

@@ -33,6 +33,9 @@ object JvmAnalysisFlags {
@JvmStatic
val enableJvmPreview by AnalysisFlag.Delegates.Boolean
@JvmStatic
val useIR by AnalysisFlag.Delegates.Boolean
private object Delegates {
object JavaTypeEnhancementStateWarnByDefault {
operator fun provideDelegate(instance: Any?, property: KProperty<*>): AnalysisFlag.Delegate<JavaTypeEnhancementState> =

View File

@@ -32,6 +32,7 @@ enum class JvmTarget(
JVM_13("13", Opcodes.V12 + 1),
JVM_14("14", Opcodes.V12 + 2),
JVM_15("15", Opcodes.V12 + 3),
JVM_16("16", Opcodes.V12 + 4),
;
companion object {

View File

@@ -601,6 +601,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/tryInLambda.kt");
}
@TestMetadata("typeMismatchOnExpectedJavaMap.kt")
public void testTypeMismatchOnExpectedJavaMap() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/typeMismatchOnExpectedJavaMap.kt");
}
@TestMetadata("untouchedReturnInIf.kt")
public void testUntouchedReturnInIf() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/untouchedReturnInIf.kt");
@@ -745,6 +750,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/syntheticPropertiesWrongImplicitReceiver.kt");
}
@TestMetadata("twoLocalLambdasWithSameName.kt")
public void testTwoLocalLambdasWithSameName() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/twoLocalLambdasWithSameName.kt");
}
@TestMetadata("typeAliasWithNotNullBound.kt")
public void testTypeAliasWithNotNullBound() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/typeAliasWithNotNullBound.kt");

View File

@@ -38,7 +38,7 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirLoadBinariesTest() {
val environment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
prepareProjectExtensions(environment.project)
val sessionWithDependency = createSession(environment, GlobalSearchScope.EMPTY_SCOPE)
val sessionWithDependency = createSessionForTests(environment, GlobalSearchScope.EMPTY_SCOPE)
val testDataDirectoryPath =
"compiler/fir/analysis-tests/testData/loadCompiledKotlin/" +

View File

@@ -18,7 +18,7 @@ class BuiltInsDeserializationForFirTestCase : AbstractFirLoadBinariesTest() {
fun testBuiltInPackagesContent() {
val moduleDescriptor = BuiltinsTestUtils.compileBuiltinsModule(environment)
val session = createSession(environment, GlobalSearchScope.allScope(project))
val session = createSessionForTests(environment, GlobalSearchScope.allScope(project))
for (packageFqName in BuiltinsTestUtils.BUILTIN_PACKAGE_NAMES) {
val path = "compiler/fir/analysis-tests/testData/builtIns/" + packageFqName.asString().replace('.', '-') + ".txt"
checkPackageContent(session, packageFqName, moduleDescriptor, path)

View File

@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.fir.FirRenderer
import org.jetbrains.kotlin.fir.createSession
import org.jetbrains.kotlin.fir.createSessionForTests
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
import org.jetbrains.kotlin.fir.resolve.symbolProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirCompositeSymbolProvider
@@ -131,7 +131,7 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
val scope = GlobalSearchScope.filesScope(project, virtualFiles)
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project))
val session = createSession(environment, scope)
val session = createSessionForTests(environment, scope)
val topPsiClasses = psiFiles.flatMap { it.getChildrenOfType<PsiClass>().toList() }

View File

@@ -1,5 +1,5 @@
public/*package*/ open class ArraysUtilJVM : R|kotlin/Any| {
public/*package*/ open static fun <T : R|ft<@FlexibleNullability kotlin/Any, kotlin/Any?>!|> asList(p0: T[]): java.util.List<T>
public/*package*/ open static fun <T : R|ft<kotlin/Any, kotlin/Any?>|> asList(p0: T[]): java.util.List<T>
public/*package*/ constructor(): R|kotlin/collections/ArraysUtilJVM|
@@ -304,4 +304,3 @@ public abstract class ShortIterator : R|kotlin/collections/Iterator<kotlin/Short
public constructor(): R|kotlin/collections/ShortIterator|
}

View File

@@ -3,9 +3,9 @@
}
public open class NonNullNever : R|kotlin/Any| {
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) public open field field: R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) public open field field: R|kotlin/String?|
@R|MyNullable|() public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) x: R|@FlexibleNullability kotlin/String?|, @R|MyNullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
@R|MyNullable|() public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) x: R|kotlin/String?|, @R|MyNullable|() y: R|kotlin/CharSequence?|): R|kotlin/String?|
public constructor(): R|NonNullNever|

View File

@@ -1,7 +1,7 @@
public open class Simple : R|kotlin/Any| {
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open field field: R|kotlin/String?|
@R|javax/annotation/Nullable|() public open fun foo(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open fun foo(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|kotlin/CharSequence?|): R|kotlin/String?|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|

View File

@@ -1,7 +1,7 @@
public open class Strange : R|kotlin/Any| {
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) public open field field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) public open field field: R|ft<kotlin/String, kotlin/String?>|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.ALWAYS|()) x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.ALWAYS|()) x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) y: R|kotlin/CharSequence?|): R|kotlin/String?|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|

View File

@@ -1,9 +1,9 @@
@R|FieldsAreNullable|() public open class A : R|kotlin/Any| {
public open field field: R|@FlexibleNullability kotlin/String?|
public open field field: R|kotlin/String?|
@R|javax/annotation/Nonnull|() public open field nonNullField: R|@EnhancedNullability kotlin/String|
public open fun foo(q: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open fun foo(q: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|

View File

@@ -1,7 +1,7 @@
@R|spr/NonNullApi|() public open class A : R|kotlin/Any| {
public open fun foo(x: R|@FlexibleNullability kotlin/String|, @R|spr/Nullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String|
public open fun foo(x: R|@EnhancedNullability kotlin/String|, @R|spr/Nullable|() y: R|kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String|
@R|spr/ForceFlexibility|() public open fun bar(x: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() y: R|@EnhancedNullability kotlin/CharSequence|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
@R|spr/ForceFlexibility|() public open fun bar(x: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() y: R|@EnhancedNullability kotlin/CharSequence|): R|ft<kotlin/String, kotlin/String?>|
public constructor(): R|A|

View File

@@ -1,11 +1,11 @@
@R|spr/NonNullApi|() public open class A : R|kotlin/Any|, R|B| {
@R|spr/ForceFlexibility|() public open fun foo(x: R|@FlexibleNullability kotlin/String|): R|kotlin/Unit|
@R|spr/ForceFlexibility|() public open fun foo(x: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit|
public open fun bar(@R|spr/ForceFlexibility|() x: R|@FlexibleNullability kotlin/String|): R|kotlin/Unit|
public open fun bar(@R|spr/ForceFlexibility|() x: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit|
public open fun baz(@R|spr/UnknownNullability|() x: R|@FlexibleNullability kotlin/String|): R|kotlin/Unit|
public open fun baz(@R|spr/UnknownNullability|() x: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit|
public open fun foobar(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) x: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
public open fun foobar(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) x: R|ft<kotlin/String, kotlin/String?>|): R|kotlin/Unit|
public constructor(): R|A|

View File

@@ -1,55 +1,55 @@
@R|NonNullApi|() public open class A : R|kotlin/Any| {
public open fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public open fun foo2(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun foo2(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public open fun foo3(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun foo3(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
@R|javax/annotation/Nullable|() public open fun bar1(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open fun bar1(@R|javax/annotation/Nullable|() x: R|kotlin/String?|): R|kotlin/String?|
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|kotlin/String?|): R|kotlin/String?|
public open fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public constructor(): R|A|
}
@R|NonNullApi|() public abstract interface AInt : R|kotlin/Any| {
public abstract fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
public abstract fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
public abstract fun foo2(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
public abstract fun foo2(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
public abstract fun foo3(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
public abstract fun foo3(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
@R|javax/annotation/Nullable|() public abstract fun bar1(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/CharSequence?|
@R|javax/annotation/Nullable|() public abstract fun bar1(@R|javax/annotation/Nullable|() x: R|kotlin/String?|): R|kotlin/CharSequence?|
@R|javax/annotation/Nullable|() public abstract fun bar2(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/CharSequence?|
@R|javax/annotation/Nullable|() public abstract fun bar2(@R|javax/annotation/Nullable|() x: R|kotlin/String?|): R|kotlin/CharSequence?|
public abstract fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
public abstract fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
}
@R|NullableApi|() public open class B : R|A|, R|AInt| {
public open fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
@R|javax/annotation/Nonnull|() public open fun foo2(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public open fun bar1(x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
public open fun bar1(x: R|kotlin/String?|): R|kotlin/String?|
public open fun baz(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun baz(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public constructor(): R|B|
}
@R|NonNullApi|() public open class C : R|A|, R|AInt| {
public open fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public open fun foo2(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun foo2(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public open fun bar1(x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
public open fun bar1(x: R|kotlin/String?|): R|kotlin/String?|
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|kotlin/String?|): R|kotlin/String?|
public open fun baz(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
public open fun baz(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
public constructor(): R|C|

View File

@@ -1,13 +1,13 @@
@R|NonNullApi|() public open class A : R|kotlin/Any| {
public open field field: R|@FlexibleNullability kotlin/String|
public open field field: R|@EnhancedNullability kotlin/String|
public open fun foo(x: R|@FlexibleNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String|
public open fun foo(x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String|
@R|NullableApi|() public open fun foobar(x: R|@FlexibleNullability kotlin/String?|, @R|NonNullApi|() y: R|@FlexibleNullability kotlin/CharSequence|): R|@FlexibleNullability kotlin/String?|
@R|NullableApi|() public open fun foobar(x: R|kotlin/String?|, @R|NonNullApi|() y: R|@EnhancedNullability kotlin/CharSequence|): R|kotlin/String?|
public open fun bar(): R|@FlexibleNullability kotlin/String|
public open fun bar(): R|@EnhancedNullability kotlin/String|
@R|javax/annotation/Nullable|() public open fun baz(): R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?, kotlin/collections/List<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?>?|
@R|javax/annotation/Nullable|() public open fun baz(): R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>?, kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
public constructor(): R|A|

View File

@@ -1,7 +1,7 @@
@R|javax/annotation/ParametersAreNonnullByDefault|() public open class A : R|kotlin/Any| {
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open field field: R|kotlin/String?|
public open fun foo(q: R|@FlexibleNullability kotlin/String|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open fun foo(q: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|

View File

@@ -1,7 +1,7 @@
public open class A : R|kotlin/Any| {
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open field field: R|kotlin/String?|
public open fun foo(q: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open fun foo(q: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
@@ -9,9 +9,9 @@ public open class A : R|kotlin/Any| {
}
public open class A2 : R|kotlin/Any| {
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open field field: R|kotlin/String?|
public open fun foo(q: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open fun foo(q: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|

View File

@@ -1,11 +1,11 @@
@R|spr/NonNullApi|() public open class A : R|kotlin/Any| {
public open field field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open field field: R|ft<kotlin/String, kotlin/String?>|
public open fun foo(x: R|@FlexibleNullability kotlin/String|, @R|spr/Nullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String|
public open fun foo(x: R|@EnhancedNullability kotlin/String|, @R|spr/Nullable|() y: R|kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String|
public open fun bar(): R|@FlexibleNullability kotlin/String|
public open fun bar(): R|@EnhancedNullability kotlin/String|
@R|spr/Nullable|() public open fun baz(): R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?, kotlin/collections/List<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?>?|
@R|spr/Nullable|() public open fun baz(): R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>?, kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
public constructor(): R|A|

View File

@@ -1,11 +1,11 @@
public open class A : R|kotlin/Any| {
public open field field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open field field: R|ft<kotlin/String, kotlin/String?>|
public open fun foo(x: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|spr/Nullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open fun foo(x: R|ft<kotlin/String, kotlin/String?>|, @R|spr/Nullable|() y: R|kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
public open fun bar(): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
public open fun bar(): R|ft<kotlin/String, kotlin/String?>|
@R|spr/Nullable|() public open fun baz(): R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?, kotlin/collections/List<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?>?|
@R|spr/Nullable|() public open fun baz(): R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>?, kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
public constructor(): R|test/A|

View File

@@ -1,4 +1,4 @@
public abstract class AbstractMap : R|kotlin/Any|, R|kotlin/collections/MutableMap<ft<@FlexibleNullability kotlin/String, kotlin/String?>!, ft<@FlexibleNullability kotlin/String, kotlin/String?>!>| {
public abstract class AbstractMap : R|kotlin/Any|, R|kotlin/collections/MutableMap<ft<kotlin/String, kotlin/String?>, ft<kotlin/String, kotlin/String?>>| {
public constructor(): R|AbstractMap|
}

View File

@@ -1,6 +1,5 @@
public final fun array(a: R|kotlin/Array<kotlin/Int>|): R|ft<kotlin/Array<ft<kotlin/Int, kotlin/Int?>!>, kotlin/Array<out ft<kotlin/Int, kotlin/Int?>!>?>!|
public final fun array(a: R|kotlin/Array<kotlin/Int>|): R|ft<kotlin/Array<ft<kotlin/Int, kotlin/Int?>>, kotlin/Array<out ft<kotlin/Int, kotlin/Int?>>?>|
public final fun list(): R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>!>, kotlin/collections/List<ft<kotlin/String, kotlin/String?>!>?>!|
public final fun printStream(): R|ft<java/io/PrintStream, java/io/PrintStream?>!|
public final fun list(): R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>, kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
public final fun printStream(): R|ft<java/io/PrintStream, java/io/PrintStream?>|

View File

@@ -1,4 +1,4 @@
FILE: main.kt
public final fun test(list: R|kotlin/collections/List<kotlin/String>|, string: R|kotlin/String|): R|kotlin/Unit| {
R|/Matchers.assertThat|<R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>!|>(R|<local>/list|, R|/Matchers.hasItem|<R|ft<kotlin/String, kotlin/String?>!|>(R|<local>/string|))
R|/Matchers.assertThat|<R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>|>(R|<local>/list|, R|/Matchers.hasItem|<R|ft<kotlin/String, kotlin/String?>|>(R|<local>/string|))
}

View File

@@ -7,7 +7,7 @@ FILE: main.kt
public abstract interface PsiClass : R|kotlin/Any| {
}
public final fun test(): R|kotlin/Unit| {
lval processor: R|AdapterProcessor<ft<PsiMethod, PsiMethod?>!, ft<PsiClass, PsiClass?>!>| = R|/AdapterProcessor.AdapterProcessor|<R|ft<PsiMethod, PsiMethod?>!|, R|ft<PsiClass, PsiClass?>!|>(R|/Function|<R|ft<PsiMethod, PsiMethod?>!|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
lval processor: R|AdapterProcessor<ft<PsiMethod, PsiMethod?>, ft<PsiClass, PsiClass?>>| = R|/AdapterProcessor.AdapterProcessor|<R|ft<PsiMethod, PsiMethod?>|, R|ft<PsiClass, PsiClass?>|>(R|/Function|<R|ft<PsiMethod, PsiMethod?>|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
^ R|<local>/method|?.{ $subj$.R|/PsiMethod.containingClass| }
}
))

View File

@@ -0,0 +1,4 @@
FILE: main.kt
public final fun <T> test(executor: R|BuildActionExecuter<T>|, modelType: R|java/lang/Class<T>|, env: R|kotlin/collections/Map<kotlin/String, kotlin/String>|): R|kotlin/Unit| {
lval model: R|ft<BuildActionExecuter<ft<T, T?>>, BuildActionExecuter<ft<T, T?>>?>| = R|<local>/executor|.R|SubstitutionOverride</BuildActionExecuter.setEnvironmentVariables: R|ft<BuildActionExecuter<ft<T, T?>>, BuildActionExecuter<ft<T, T?>>?>|>|(R|<local>/env|)
}

View File

@@ -0,0 +1,26 @@
// FULL_JDK
// FILE: LongRunningOperation.java
import java.util.Map;
import org.jetbrains.annotations.Nullable;
public interface LongRunningOperation {
LongRunningOperation setEnvironmentVariables(@Nullable Map<String, String> envVariables);
}
// FILE: ConfigurableLauncher.java
import java.util.Map;
public interface ConfigurableLauncher<T extends ConfigurableLauncher<T>> extends LongRunningOperation {
@Override
T setEnvironmentVariables(Map<String, String> envVariables);
}
// FILE: BuildActionExecuter.java
public interface BuildActionExecuter<T> extends ConfigurableLauncher<BuildActionExecuter<T>> {}
// FILE: main.kt
fun <T> test(executor: BuildActionExecuter<T>, modelType: Class<T>, env: Map<String, String>) {
val model = executor.setEnvironmentVariables(env)
}

View File

@@ -0,0 +1,19 @@
FILE: twoLocalLambdasWithSameName.kt
public abstract interface R : R|kotlin/Any| {
}
public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| {
}
public final fun test(fn: R|R.() -> kotlin/String|): R|kotlin/Unit| {
lval renderer: R|<anonymous>| = object : R|R| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public final fun render(fn: R|R.() -> kotlin/Int|): R|kotlin/Unit| {
lval result: R|kotlin/Int| = R|<local>/fn|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Int|>|(this@R|/<anonymous>|)
R|/takeInt|(R|<local>/result|)
}
}
}

View File

@@ -0,0 +1,13 @@
// ISSUE: KT-45316
interface R
fun takeInt(x: Int) {}
fun test(fn: R.() -> String) { // (1)
val renderer = object : R {
fun render(fn: R.() -> Int) { // (2)
val result = fn()
takeInt(result)
}
}
}

View File

@@ -84,7 +84,7 @@ digraph initBlock_kt {
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {28};
23 -> {28} [label=onUncaughtException];
23 -> {24} [style=dotted];
24 -> {25} [style=dotted];
25 -> {26} [style=dotted];

View File

@@ -72,7 +72,7 @@ digraph jumps_kt {
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {29};
18 -> {29} [label=onUncaughtException];
18 -> {19} [style=dotted];
19 -> {20} [style=dotted];
20 -> {21} [style=dotted];

View File

@@ -63,7 +63,7 @@ digraph lambdaReturningObject_kt {
}
13 -> {14};
14 -> {15};
15 -> {20};
15 -> {20} [label=onUncaughtException];
15 -> {16} [style=dotted];
16 -> {17} [style=dotted];
17 -> {20 18} [style=dotted];

View File

@@ -107,7 +107,7 @@ digraph propertiesAndInitBlocks_kt {
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {47};
44 -> {47} [label=onUncaughtException];
44 -> {45} [style=dotted];
45 -> {46} [style=dotted];
46 -> {47} [style=dotted];
@@ -138,7 +138,7 @@ digraph propertiesAndInitBlocks_kt {
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {58};
54 -> {58} [label=onUncaughtException];
54 -> {55} [style=dotted];
55 -> {56} [style=dotted];
56 -> {57} [style=dotted];
@@ -199,7 +199,7 @@ digraph propertiesAndInitBlocks_kt {
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {76};
73 -> {76} [label=onUncaughtException];
73 -> {74} [style=dotted];
74 -> {75} [style=dotted];
75 -> {76} [style=dotted];
@@ -246,7 +246,7 @@ digraph propertiesAndInitBlocks_kt {
28 -> {48 34} [color=green];
28 -> {48 34} [style=dashed];
29 -> {30};
30 -> {81};
30 -> {81} [label=onUncaughtException];
30 -> {31} [style=dotted];
31 -> {32} [style=dotted];
32 -> {33} [style=dotted];

View File

@@ -204,7 +204,8 @@ digraph returnValuesFromLambda_kt {
57 -> {65} [style=dashed];
58 -> {60} [style=dotted];
59 -> {60} [style=dotted];
60 -> {64 61} [style=dotted];
60 -> {61} [style=dotted];
60 -> {64} [style=dotted] [label=onUncaughtException];
61 -> {62} [style=dotted];
62 -> {63} [style=dotted];
63 -> {64} [style=dotted];

View File

@@ -20,13 +20,13 @@ FILE: main.kt
}
public final fun test_1(): R|kotlin/Unit| {
lval map: R|util/HashMap<ft<kotlin/Int, kotlin/Int?>!, ft<kotlin/Int, kotlin/Int?>!>| = R|util/HashMap.HashMap|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/Int, kotlin/Int?>!|>()
lval map: R|util/HashMap<ft<kotlin/Int, kotlin/Int?>, ft<kotlin/Int, kotlin/Int?>>| = R|util/HashMap.HashMap|<R|ft<kotlin/Int, kotlin/Int?>|, R|ft<kotlin/Int, kotlin/Int?>|>()
}
public final fun test_2(): R|kotlin/Unit| {
lval set: R|util/HashSet<kotlin/Int>| = R|util/HashSet.HashSet|<R|kotlin/Int|>()
}
public final fun test_3(): R|kotlin/Unit| {
lval list: R|foo/ArrayList<ft<kotlin/Int, kotlin/Int?>!>| = R|foo/ArrayList.ArrayList|<R|ft<kotlin/Int, kotlin/Int?>!|>()
lval list: R|foo/ArrayList<ft<kotlin/Int, kotlin/Int?>>| = R|foo/ArrayList.ArrayList|<R|ft<kotlin/Int, kotlin/Int?>|>()
}
public final fun test_4(): R|kotlin/Unit| {
lval list: R|foo/LinkedList<kotlin/Int>| = R|foo/LinkedList.LinkedList|<R|kotlin/Int|>()

View File

@@ -9,7 +9,7 @@ FILE: annotationArgumentKClassLiteralTypeError.kt
}
public final val <reified T> R|T|.test: R|kotlin/Any|
public get(): R|<anonymous><T>| {
public inline get(): R|<anonymous><T>| {
^ @R|Ann|(<implicitArrayOf>(<getClass>(R|T|), <getClass>(Q|kotlin/Array|))) object : R|kotlin/Any| {
private constructor(): R|<anonymous><T>| {
super<R|kotlin/Any|>()

View File

@@ -1,9 +1,9 @@
data class A {}
data <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>class A<!> {}
<!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>data class B {
data <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>class B<!> {
constructor()
}<!>
}
<!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>data class C {
data <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>class C<!> {
constructor(x: Int)
}<!>
}

View File

@@ -5,7 +5,7 @@ FILE: KotlinImporterComponent.kt
}
public final class State : R|kotlin/Any| {
public constructor(directories: R|kotlin/collections/List<kotlin/String>| = R|java/util/ArrayList.ArrayList|<R|ft<kotlin/String, kotlin/String?>!|>()): R|simulation/KotlinImporterComponent.State| {
public constructor(directories: R|kotlin/collections/List<kotlin/String>| = R|java/util/ArrayList.ArrayList|<R|ft<kotlin/String, kotlin/String?>|>()): R|simulation/KotlinImporterComponent.State| {
super<R|kotlin/Any|>()
}

View File

@@ -15,7 +15,7 @@ FILE: main.kt
}
public final fun test_1(): R|kotlin/Unit| {
lval e: R|ft<@FlexibleNullability E, E?>!| = Q|Utils|.R|/Utils.getEnum|()
lval e: R|ft<E, E?>| = Q|Utils|.R|/Utils.getEnum|()
lval s: R|kotlin/String| = when (R|<local>/e|) {
==($subj$, Null(null)) -> {
^test_1 Unit
@@ -34,7 +34,7 @@ FILE: main.kt
R|<local>/s|.R|kotlin/String.length|
}
public final fun test_2(): R|kotlin/Unit| {
lval e: R|ft<@FlexibleNullability E, E?>!| = Q|Utils|.R|/Utils.getEnum|()
lval e: R|ft<E, E?>| = Q|Utils|.R|/Utils.getEnum|()
lval s: R|kotlin/String| = when (R|<local>/e|) {
==($subj$, Q|E|.R|/E.A|) -> {
String()

View File

@@ -13,10 +13,10 @@ FILE: test.kt
lval element: R|DE| = R|<local>/d|.R|/Diagnostic.element|
R|/Fix.Fix|(R|<local>/element|)
}
private final val DERIVED_FACTORY: R|DiagnosticFactory0<ft<DerivedElement, DerivedElement?>!>| = R|/DiagnosticFactory0.DiagnosticFactory0|<R|ft<DerivedElement, DerivedElement?>!|>()
private get(): R|DiagnosticFactory0<ft<DerivedElement, DerivedElement?>!>|
private final val DERIVED_FACTORY: R|DiagnosticFactory0<ft<DerivedElement, DerivedElement?>>| = R|/DiagnosticFactory0.DiagnosticFactory0|<R|ft<DerivedElement, DerivedElement?>|>()
private get(): R|DiagnosticFactory0<ft<DerivedElement, DerivedElement?>>|
public final fun createViaFactory(d: R|EmptyDiagnostic|): R|kotlin/Unit| {
lval casted: R|@FlexibleNullability Diagnostic<ft<DerivedElement, DerivedElement?>!>| = R|/DERIVED_FACTORY|.R|SubstitutionOverride</DiagnosticFactory0.cast: R|@FlexibleNullability Diagnostic<ft<DerivedElement, DerivedElement?>!>|>|(R|<local>/d|)
lval casted: R|Diagnostic<ft<DerivedElement, DerivedElement?>>| = R|/DERIVED_FACTORY|.R|SubstitutionOverride</DiagnosticFactory0.cast: R|Diagnostic<ft<DerivedElement, DerivedElement?>>|>|(R|<local>/d|)
lval element: R|DerivedElement| = R|<local>/casted|.R|/Diagnostic.element|
R|/Fix.Fix|(R|<local>/element|)
}

View File

@@ -1,5 +1,5 @@
FILE: test.kt
public final fun test(): R|kotlin/Unit| {
lval staticReference: R|kotlin/reflect/KMutableProperty0<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>| = Q|JavaClass|::R|/JavaClass.staticField|
lval nonStaticReference: R|kotlin/reflect/KMutableProperty1<JavaClass, ft<@FlexibleNullability kotlin/String, kotlin/String?>!>| = Q|JavaClass|::R|/JavaClass.nonStaticField|
lval staticReference: R|kotlin/reflect/KMutableProperty0<ft<kotlin/String, kotlin/String?>>| = Q|JavaClass|::R|/JavaClass.staticField|
lval nonStaticReference: R|kotlin/reflect/KMutableProperty1<JavaClass, ft<kotlin/String, kotlin/String?>>| = Q|JavaClass|::R|/JavaClass.nonStaticField|
}

View File

@@ -37,7 +37,7 @@ FILE: O.kt
}
public final fun local(): R|kotlin/Unit| {
lval y: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = this@R|/O.Derived|.R|/Base.foo|()
lval y: R|ft<kotlin/String, kotlin/String?>| = this@R|/O.Derived|.R|/Base.foo|()
}
public final val oo: R|<anonymous>| = object : R|kotlin/Any| {
@@ -66,7 +66,7 @@ FILE: O.kt
}
public final fun local(): R|kotlin/Unit| {
lval y: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = this@R|/O.Derived|.R|/Base.foo|()
lval y: R|ft<kotlin/String, kotlin/String?>| = this@R|/O.Derived|.R|/Base.foo|()
}
}

View File

@@ -20,7 +20,7 @@ FILE: test.kt
R|<local>/x|.R|/AnotherClass.bar|
}
public final fun test2(x: R|SomeClass?|): R|kotlin/Unit| {
lval bar: R|@FlexibleNullability kotlin/CharSequence| = R|<local>/x|?.{ $subj$.R|/SomeClass.bar| } ?: ^test2 Unit
lval bar: R|kotlin/CharSequence| = R|<local>/x|?.{ $subj$.R|/SomeClass.bar| } ?: ^test2 Unit
R|<local>/x|.R|/SomeClass.bar|
}
public final fun test3(x: R|AnotherClass?|): R|kotlin/Unit| {
@@ -33,7 +33,7 @@ FILE: test.kt
}
public final fun test4(x: R|SomeClass?|): R|kotlin/Unit| {
lval bar: R|@FlexibleNullability kotlin/CharSequence?| = R|<local>/x|?.{ $subj$.R|/SomeClass.bar| }
lval bar: R|kotlin/CharSequence?| = R|<local>/x|?.{ $subj$.R|/SomeClass.bar| }
when () {
!=(R|<local>/bar|, Null(null)) -> {
R|<local>/x|.R|/SomeClass.bar|.<Inapplicable(INAPPLICABLE_WRONG_RECEIVER): kotlin/CharSequence.length>#

View File

@@ -1,6 +1,6 @@
FILE: flexibleTypeBug.kt
public final fun foo(): R|kotlin/Unit| {
lvar list1: R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>!>, kotlin/collections/List<ft<kotlin/String, kotlin/String?>!>?>!| = Q|java/util/Collections|.R|java/util/Collections.emptyList|<R|ft<kotlin/String, kotlin/String?>!|>()
lvar list1: R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>, kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>| = Q|java/util/Collections|.R|java/util/Collections.emptyList|<R|ft<kotlin/String, kotlin/String?>|>()
lval list2: R|kotlin/collections/List<kotlin/String>| = R|kotlin/collections/listOf|<R|kotlin/String|>(String(b))
R|<local>/list1| = R|<local>/list1|.R|kotlin/collections/plus|<R|ft<kotlin/String, kotlin/String?>!|>(R|<local>/list2|)
R|<local>/list1| = R|<local>/list1|.R|kotlin/collections/plus|<R|ft<kotlin/String, kotlin/String?>|>(R|<local>/list2|)
}

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