Compare commits

...

3850 Commits

Author SHA1 Message Date
anastasiia.spaseeva
a6b7a38bc0 test 2 2021-04-19 17:18:27 +02:00
anastasiia.spaseeva
25386aa0e0 Merge branch '1.5.0-github-testing' of https://github.com/JetBrains/kotlin into 1.5.0-github-testing 2021-04-19 17:10:12 +02:00
anastasiia.spaseeva
e6ec318425 test 2021-04-19 17:09:48 +02:00
Stanislav Erokhin
3cdad07fe4 add file2 2021-04-19 17:08:56 +02:00
Stanislav Erokhin
572f93de06 add file 2021-04-19 16:59:48 +02:00
Ilmir Usmanov
d0fa40cc5f Generate return when generating continuation class for expression body
Otherwise, the function will return Unit instead of correct value.
 #KT-46007 Fixed
2021-04-19 09:57:31 +02:00
Ilmir Usmanov
bd2d6c8083 Add 'value' modifier to modifier order
Otherwise, there will be unfixable 'non-canonical modifier order'
warning
 #KT-46088
 #KTIJ-5636 Fixed
2021-04-19 09:55:26 +02:00
Dmitry Petrov
5b6a57be15 JVM_IR KT-45934 don't generate declaration stubs for delegates
(cherry picked from commit e89ab71bf8)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
dd2a9e11c0 JVM_IR KT-46092 fix array spread operator in Kotlin->Java call
(cherry picked from commit cc415f62b5)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
a7592b93f2 PSI2IR KT-46069 resolve IR-based type parameter descriptors to symbols
(cherry picked from commit f1eeb72c01)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
d88bb951a4 JVM_IR KT-46060 'contains' operator without receiver is non-optimizable
(cherry picked from commit 531a0de399)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
22e6c88fba JVM_IR KT-45187 use Arrays.copyOf to copy an array in spread operator
Creating a new array (and copying data into it with System.arraycopy)
doesn't work in generic case, because the actual array class depends on
call site.

(cherry picked from commit 7d62f0b5aa)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
efa79b3519 JVM_IR KT-45853 include return type into Java method IdSignature
This is a hack required to accept [potentially] incorrect input
provided by the front-end; see KT-46042.

(cherry picked from commit 7e03f8ea80)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
98aced50ef JVM_IR KT-45967 generate accessor for argument of indy intrinsic
TODO handle inaccessible constructors gracefully

(cherry picked from commit f59b49db68)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
9c571af0d4 JVM_IR KT-45868 look for parent for delegating lambda in scope stack
(cherry picked from commit ed88aa43a4)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
08bc150a56 JVM_IR KT-45920 don't add special bridge if it clashes with known method
(cherry picked from commit c2a5b0b6e2)
2021-04-16 12:28:39 +03:00
Ilya Gorbunov
8663fe580a Support Char.code in constant evaluator, KT-46036
But do not consider Char.code a pure integer constant.

(cherry picked from commit 8041c3aa1d)
2021-04-16 04:31:05 +03:00
Leonid Startsev
bba22e8330 Support new inline(value) class syntax in serialization plugin
Use .isInlineClass() instead of .isInline + .isValue

 #KT-45783 Fixed

(cherry picked from commit f94e8f95d1)
2021-04-15 14:32:04 +03:00
Andrei Klunnyi
892b597041 KT-46049 Java-Kotlin sealed inheritors inspection: refactoring
(cherry picked from commit 73d2e1a42d)
2021-04-15 13:28:24 +02:00
Andrei Klunnyi
ef6102565d KT-46049 Java-Kotlin sealed inheritors inspection: false positive for type parameter
^KT-46049 Fixed

(cherry picked from commit 2fce968de0)
2021-04-15 13:28:23 +02:00
Ilya Goncharov
60ef5b385a [Gradle, JS] Mark visited dependencies inside dependency graph traversing
(cherry picked from commit 266daed2cb)
2021-04-15 13:15:40 +03:00
Ilmir Usmanov
aa09f7ba03 Minor. Change warning message 2021-04-15 12:10:51 +02:00
Yahor Berdnikau
7514aced27 Fix plugin is using deprecated method that is removed in AGP 7.0.
^KT-45950 Fixed
2021-04-15 11:08:00 +02:00
Yahor Berdnikau
a118653e35 Set Android Gradle Plugin dependency version to 3.4.0.
This is required to get method deprecations and new proposed methods.
2021-04-15 11:07:56 +02:00
Nikolay Krasko
2cae6756ce Add dependencies verification for prepareSonatypeStaging.gradle
File is applied conditionally when sonatype publication is enabled.
2021-04-13 17:50:04 +03:00
Margarita Bobova
e84e667929 Add changelog for 1.5.0-RC 2021-04-13 16:31:26 +03:00
anastasiia.spaseeva
952f11287d Add changelog for 1.5.0-M2 2021-04-13 16:30:27 +03:00
Svyatoslav Scherbina
eea18585b9 Update Kotlin/Native: 1.5-rc1-41 2021-04-12 18:26:17 +03:00
Victor Petukhov
275f8fcf63 Avoid subtype checking between type variable of self type and captured star projection only for invariant positions
Subtyping with non-invariant positions may produce useful constraints

^KT-46001 Fixed
2021-04-12 13:40:21 +03:00
Svyatoslav Scherbina
8f80deefc3 Update Kotlin/Native: 1.5-rc1-17 2021-04-09 10:51:31 +03:00
Abduqodiri Qurbonzoda
7fe4eb767c Remove deprecated JQuery
(cherry picked from commit 46338224e1)
2021-04-08 19:35:12 +03:00
Abduqodiri Qurbonzoda
db7649d635 Migrate compiler and idea-completion testData 2021-04-08 18:32:21 +03:00
Abduqodiri Qurbonzoda
89d7383365 Migrate stdlib, tests and samples to new case conversion api 2021-04-08 18:32:20 +03:00
Abduqodiri Qurbonzoda
36c788b57c Deprecate old Char and String case conversion api #KT-43023 2021-04-08 18:32:20 +03:00
Abduqodiri Qurbonzoda
0a9d6ad30e Deprecate sumBy and sumByDouble with WARNING
(cherry picked from commit 33b44585c4)
2021-04-08 15:32:11 +03:00
Renee Vandervelde
cc23d0bad9 Add assertEquals and assertNotEquals for floating point numbers to kotlin-test #KT-8364
(cherry picked from commit d520c37454)
2021-04-08 14:39:04 +03:00
Abduqodiri Qurbonzoda
c57f367040 Introduce assertContains in kotlin-test #KT-45582
(cherry picked from commit ff59b1c2ef)
2021-04-08 14:39:02 +03:00
Ilya Gorbunov
2027fff626 Deprecate Char-to-Number conversions in stdlib (JVM and JS)
- Int.toChar was left non-deprecated because the replacement is not intrinsic yet.
- Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar.

KT-23451

(cherry picked from commit b64b96eee6)
2021-04-08 13:36:27 +03:00
Abduqodiri Qurbonzoda
aef884efe1 Disable Werror in the release branch
This is to avoid migrating all the usages that will become deprecated
 after the following changes.
2021-04-08 13:36:25 +03:00
Alexander Udalov
c81ce8637a Add kotlin.build.disable.werror to disable -Werror locally
This can be placed, for example, in `local.properties` to temporarily
disable `-Werror` in compiler/stdlib/plugin/test modules during
development.

(cherry picked from commit 496d857db1)
2021-04-08 13:07:33 +03:00
Ilya Gorbunov
52846e7722 Hide deprecated JS Math object from public API and rename to JsMath
KT-41318

- Rename Math to JsMath and remove unused functions
- Fix return types, remove duplicating JsMath from longjs.kt

Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
(cherry picked from commit d70edeb38b)
2021-04-08 13:00:45 +03:00
Abduqodiri Qurbonzoda
1902be18a1 Mute a failing test of the old J2K, the old J2K is removed in master 2021-04-08 12:50:21 +03:00
Abduqodiri Qurbonzoda
97399e5269 Advance max/min(By/With) deprecation level to ERROR
(cherry picked from commit b0f1ddc91e)
2021-04-08 12:50:19 +03:00
Abduqodiri Qurbonzoda
8c2f1a5fc9 Advance deprecation level of mixed Int/FP overloads of ClosedRange.contains to HIDDEN KT-22423
(cherry picked from commit d9ab96126d)
2021-04-08 12:50:18 +03:00
Abduqodiri Qurbonzoda
ff223a4901 Advance String(CharArray) deprecation level to ERROR in Common and JS 2021-04-08 12:50:17 +03:00
Abduqodiri Qurbonzoda
44a18616b0 Remove deprecated Clock and ClockMark
(cherry picked from commit 29040d6f53)
2021-04-08 12:50:16 +03:00
Abduqodiri Qurbonzoda
a77ddbe6d8 Remove deprecated scanReduce and scanReduceIndexed
(cherry picked from commit abcc572b97)
2021-04-08 12:50:14 +03:00
Abduqodiri Qurbonzoda
6c7d4b1905 Remove DefaultAsserter() constructor-like function in kotlin-test
(cherry picked from commit c46d71d4ac)
2021-04-08 12:50:13 +03:00
Abduqodiri Qurbonzoda
6a2da4bb4b Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360
(cherry picked from commit 968099fbec)
2021-04-08 12:50:12 +03:00
Abduqodiri Qurbonzoda
c62d099d60 Advance deprecation level of InputStream.readBytes(estimatedSize) to ERROR
(cherry picked from commit e8992c5d19)
2021-04-08 12:50:12 +03:00
Dmitriy Novozhilov
9e4ff58aac Support actualization of expect sealed class with typealias in CliSealedClassInheritorsProvider 2021-04-08 11:38:01 +03:00
Dmitriy Novozhilov
9e2a1a404d Refine expect classes in CliSealedClassInheritorsProvider
KT-45796 Fixed
2021-04-08 11:38:01 +03:00
Ilya Gorbunov
991afb382f Fix case-insensitive character-wise comparison KT-45496
- Step 1: add failing tests
- Step 2: fix common case insensitive Char.equals
- Step 3: fix case insensitive String.equals in K/JS
- Step 4: enable unicode case folding in K/JS Regexes and
  string replacement (KT-45928)

(cherry picked from commit 22ca412dd2)
2021-04-07 14:49:12 +03:00
Ilya Gorbunov
376b250482 Add description for kotlin.io.path package
(cherry picked from commit f1cdd0e2ed)
2021-04-06 14:34:10 +03:00
Ilya Gorbunov
28d469aeec Stabilize existing Path API and annotate with @Throws where appropriate
KT-45913

(cherry picked from commit 81f2aea316)
2021-04-06 14:34:09 +03:00
Ilya Gorbunov
4673fd1e90 Stabilize new string and char case conversion API KT-45873
(cherry picked from commit 35ae913a5e)
2021-04-06 14:33:19 +03:00
Ilya Gorbunov
ab24019e40 Support all digit chars in digitToInt on JVM KT-23451
(cherry picked from commit 256f634e61)
2021-04-06 14:32:53 +03:00
Ilya Gorbunov
a95d69a9a8 Stabilize Char-to-Int conversions KT-45874
(cherry picked from commit 8b85bae020)
2021-04-06 14:32:49 +03:00
Ilya Gorbunov
b273bc17fe Duration: inWholeUnits properties instead of inUnits
Introduce conversion properties returning Long values,
deprecate the old ones returning Doubles.

(cherry picked from commit 0e93924ff3)
2021-04-02 19:10:49 +03:00
Ilya Gorbunov
809e85f9b4 Make Duration storage ranges symmetric and non-overlapping
Increase accuracy of multiplication and division.

(cherry picked from commit 11d15f3343)
2021-04-02 19:10:46 +03:00
Ilya Gorbunov
dc7d6021b6 Advance TestTimeSource more precisely
Change durations in its test so that they hold precise number
of nanoseconds

(cherry picked from commit 4fd2254f3f)
2021-04-02 19:10:43 +03:00
Ilya Gorbunov
5c82d8cd33 Store Duration value as a multi-range Long
Now precision loss happens at bigger durations.

This changes the binary API due different underlying type of Duration.

(cherry picked from commit fa7460ba48)
2021-04-02 19:10:39 +03:00
Ilmir Usmanov
b3e556e662 Enable suspend in fun interfaces by default
#KT-45836 Fixed
2021-04-02 14:40:46 +02:00
Ilya Muradyan
c14039cd37 [Scripting] Fix Bintray-dependent test 2021-04-01 16:47:55 +03:00
Nikolay Krasko
58d5b1bd26 Update verification data with older versions 2021-04-01 16:20:28 +03:00
Nikolay Krasko
46c68b4d1e Disable verification in IDE bunches 2021-04-01 16:15:56 +03:00
Nikolay Krasko
c8dfb1d6f5 CodeConformanceTest for no Bintray except jcenter (KTI-528)
(cherry picked from commit 7f60cd81fe)
2021-04-01 16:06:04 +03:00
Nikolay Krasko
ee5d677b19 Drop scripts for uploading to plugin repository (KTI-528)
(cherry picked from commit b48ede4a62)
2021-04-01 16:05:39 +03:00
Nikolay Krasko
ea394f4de4 Bintray dukat -> Space kotlin/kotlin-dependencies (KTI-528)
(cherry picked from commit 35ad28c372)
2021-04-01 16:05:25 +03:00
Nikolay Krasko
86b9fbbc14 Drop Bintray from maven inspections tests (KTI-528)
(cherry picked from commit d10f4ad718)
2021-04-01 16:05:11 +03:00
Nikolay Krasko
81733beb6a Stop using Bintray in ignored test in MavenResolverTest (KTI-528)
(cherry picked from commit 03c0a81a33)
2021-04-01 16:04:56 +03:00
Nikolay Krasko
607742de8c Drop Bintray from wizards (KTI-528)
(cherry picked from commit c868116535)
2021-04-01 16:04:42 +03:00
Nikolay Krasko
01f095adbc Move testResolveDependencyOnMppInCustomConfiguration to library from maven central (KTI-528)
(cherry picked from commit c74a3bd2b1)
2021-04-01 16:04:30 +03:00
Nikolay Krasko
0e28db28f3 Drop bintray from Gradle inspections and fixes tests (KTI-528)
(cherry picked from commit 1547d4f516)
2021-04-01 16:04:16 +03:00
Nikolay Krasko
6de5c408ff Drop bootstrap mentioning from CodeConformanceTest
(cherry picked from commit 7a9c2c1d17)
2021-04-01 16:04:14 +03:00
Nikolay Krasko
f4b464c126 Drop custom private Bintray Android Studio repository (KTI-528)
(cherry picked from commit 529fc352b3)
2021-04-01 16:04:01 +03:00
Nikolay Krasko
8d06261a9d Drop bintray kotlin-dev (KTI-528)
(cherry picked from commit 5631481747)
2021-04-01 16:03:47 +03:00
Nikolay Krasko
c8e0f3399a Drop bintray jetbrains markdown (KTI-528)
(cherry picked from commit 1cedc7e93e)
2021-04-01 16:03:33 +03:00
Nikolay Krasko
31ae15d19b Replace intellij-third-party-dependencies repository (KTI-528)
(cherry picked from commit 832523e23f)
2021-04-01 16:03:30 +03:00
Nikolay Krasko
f4cb821f08 Rearrange list of repositories - move jcenter to the end
(cherry picked from commit 87d509a7aa)
2021-04-01 16:01:00 +03:00
Nikolay Krasko
59cd8c5c5d Update cache redirector for more complex aliases
For example:
"https://packages.jetbrains.team/maven/p/ij/intellij-dependencies" to "https://cache-redirector.jetbrains.com/intellij-dependencies",

(cherry picked from commit 818855d6f0)
2021-04-01 16:00:57 +03:00
Nikolay Krasko
33eb57043e Fix build of benchmarks module
Fix after 998a65d1cb

(cherry picked from commit c680ee8525)
2021-04-01 15:58:54 +03:00
Nikolay Krasko
65b7365684 Move Bintray js-externals to Space (KTI-528)
(cherry picked from commit a5e445492f)
2021-04-01 15:58:29 +03:00
Nikolay Krasko
880c628a69 Drop kotin/kotlinx and kotlin/kotlinx.html bintray usages (KTI-528)
(cherry picked from commit b903f87704)
2021-04-01 15:58:14 +03:00
Nikolay Krasko
c56025572c Bump version of kotlinx.benchmark plugin 0.2.0-dev-7 -> 0.3.0 (KTI-528)
(cherry picked from commit 998a65d1cb)
2021-04-01 15:57:49 +03:00
Nikolay Krasko
712c79c270 Minor: investigate j2objc-annotations:1.1 verification trace
(cherry picked from commit 455773299b)
2021-04-01 15:57:45 +03:00
Nikolay Krasko
117a88f7ba Add dependency verification description to ReadMe.md
(cherry picked from commit ddc12834cb)
2021-04-01 15:57:42 +03:00
Nikolay Krasko
113ff90c5b 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
(cherry picked from commit 1558bd7373)
2021-04-01 15:54:59 +03:00
Nikolay Krasko
7145b524bf 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
(cherry picked from commit 73bc16896d)
2021-04-01 15:54:57 +03:00
Nikolay Krasko
d41652b42b Trust javadoc and sources artifacts as the shouldn't be used in builds (KTI-493)
(cherry picked from commit efcb071f24)
2021-04-01 15:54:44 +03:00
Nikolay Krasko
8f877b33ba Trust kotlin-native-prebuild-* (KTI-493)
Need more investigation for this artifact

(cherry picked from commit fd921f1dc0)
2021-04-01 15:54:38 +03:00
Nikolay Krasko
0cfbeffaeb Trust kotlin artifacts for bootstrapping (KTI-493)
Can't predict exact version after build

(cherry picked from commit fae1215881)
2021-04-01 15:54:36 +03:00
Nikolay Krasko
0bc77f90dd Trust ivy xml files as they are constantly regenerated (KTI-493)
(cherry picked from commit 4bbba74360)
2021-04-01 15:54:33 +03:00
Nikolay Krasko
fd9b5f8c27 Add dependencies lock with md5 and sha256 (KTI-493)
Initial commit without explicit check or cleanup.

Includes Kotlin Native dependencies.

(cherry picked from commit 8240f5e459)
2021-04-01 15:54:31 +03:00
Ilya Gorbunov
e9e62622b6 Stabilize unsigned types KT-45653
Deprecate specialized unsigned iterators for removal.

Fix compiler tests:
- drop unsignedLiteralsOn1_2 because apiVersion 1.2 is no longer supported
- drop experimental unsigned literals diagnostic test

(cherry picked from commit 94240f7b21)
2021-04-01 14:56:36 +03:00
Victor Petukhov
f45a471457 Assert that the separation of two annotations on function type during rendering it, is any whitespace-like symbol, not only whitespace itself
E.g. in quick doc mode (HTML), it may be line break

^KT-38747 Fixed
2021-04-01 14:33:39 +03:00
Yahor Berdnikau
9d5b1dcd7a Fix Gradle 7 deprecation on adding associated compilation dependencies.
^KT-45787 Fixed
2021-04-01 10:50:54 +02:00
pyos
73147a7422 JVM_IR: cast bound property receivers to original type
Because the receiver type is used for determining where to put
accessors, and the type of fake overrides' receivers is the same as for
the original declaration, casting to the type of the parameter leads to
assertion errors.

 #KT-44658 Fixed

(cherry picked from commit 85aa6383ad)
2021-04-01 10:48:58 +02:00
Svyatoslav Scherbina
86f8c2ec5d Update Kotlin/Native: 1.5-eap-4 2021-03-31 15:17:32 +03:00
pyos
68f1925726 JVM_IR: do not inline @JvmStatic into their static proxies
(cherry picked from commit 66429cfb43)
2021-03-31 14:09:42 +02:00
pyos
b116597fd7 JVM_IR: remap calls to protected @JvmStatic in companions
Protected functions on unrelated classes cannot be called from outside
the current package, so in general, we can only call the static proxy,
not the original companion method.

This has an ABI compatibility implication in that removing `@JvmStatic`
from a protected companion method will require recompiling Kotlin use
sites (of course, this is already source- and binary-incompatible from
Java perspective).

 #KT-12063 Fixed

(cherry picked from commit a518a9407d)
2021-03-31 14:09:40 +02:00
Pavel Kirpichenkov
40d6d16b96 [IDE] Optimize stdlib cache for non-JVM modules
Consider only dependencies of JVM modules.
Cache found/missing stdlib dependencies for modules.

As of now, non-JVM platforms use default builtins in IDE.
For any non-JVM module indexed stdlib dependency is guaranteed
to be missing, searching for it is useless and costly.

^KTIJ-5666 Fixed
See also KT-44552
2021-03-31 14:09:21 +03:00
Andrey Zinovyev
6a2a1d7472 [parcelize] Fix codegen for generic classes
Replace type arguments with star projection in static methods
Fix IR function generation

^KT-42652  Fixed
2021-03-31 13:53:21 +03:00
Victor Petukhov
488d2206ef Regenerate tests 2021-03-31 11:12:46 +03:00
Victor Petukhov
10ba85d8c8 Mark some tests 'fir identical' 2021-03-31 11:12:46 +03:00
Matthew Gharrity
68554a0e93 KT-45676: fix backing field annotation resolve
(cherry picked from commit 2cb9d1f287)
2021-03-31 11:12:45 +03:00
Victor Petukhov
f641288fbe Report resolution ambiguity on '+=' by taking into account full resolution result including post type checking for '+'
^KT-45503 Fixed

(cherry picked from commit 5d78b0a962)
2021-03-31 11:12:45 +03:00
Victor Petukhov
a2d90ba39b Do subtyping between self types with captured type in special way
(cherry picked from commit bbf5c4412e)
2021-03-31 11:12:45 +03:00
Victor Petukhov
6ed1fe28d0 Propagate input type position across incorporation properly
^KT-45719 Fixed

(cherry picked from commit 7f2c5cde55)
2021-03-31 11:12:45 +03:00
Victor Petukhov
3ccf8e5aa5 Approximate types when only input types check is done. Otherwise given types are inconsistent with types obtained by ResultTypeResolver
^KT-45714 Fixed

(cherry picked from commit d06031ece3)
2021-03-31 11:12:45 +03:00
Victor Petukhov
86cdbf2328 Remove NonStrictOnlyInputTypesChecks LF and introduce opposite – StrictOnlyInputTypesChecks, set default as strict
(cherry picked from commit cc1cb463b2)
2021-03-31 11:12:45 +03:00
Victor Petukhov
c0ca5160ed Turn only input type warning to error
^KT-45482 Fixed

(cherry picked from commit b60056f11e)
2021-03-31 11:12:45 +03:00
Victor Petukhov
55e3ea9cfd Add compiler flag to enable strict mode for improvements in the type enhancement
^KT-45674 Fixed

(cherry picked from commit 9c38db754e)
2021-03-31 11:12:44 +03:00
Victor Petukhov
8b36ad6132 Rename LV ImprovementsAroundTypeEnhancement into TypeEnhancementImprovementsInStrictMode
(cherry picked from commit 731e3ebae1)
2021-03-31 11:12:44 +03:00
Victor Petukhov
91cd685616 Don't generate tests on top-down completion of the builder inference for WASM
(cherry picked from commit 4f1ed2f112)
2021-03-31 11:12:44 +03:00
Victor Petukhov
eacbe16965 Proper taking top level trace to pass it into completion
(cherry picked from commit 178910a2e5)
2021-03-31 11:12:44 +03:00
Victor Petukhov
36859d7eb1 Do updating calls for all nested builder inference sessions including at the same level
(cherry picked from commit e0a8e9a664)
2021-03-31 11:12:44 +03:00
Victor Petukhov
953b4880d5 Introduce hierarchy of inference sessions
(cherry picked from commit 999d1f982e)
2021-03-31 11:12:44 +03:00
Victor Petukhov
007e78100f Don't lose inference session in all the possible locations
(cherry picked from commit 80ac62864d)
2021-03-31 11:12:43 +03:00
Victor Petukhov
e33ecf0126 Rename CoroutineInferenceSession to BuilderInferenceSession
(cherry picked from commit b5d3f9ee31)
2021-03-31 11:12:43 +03:00
Victor Petukhov
25cb98e0d7 Implement top-down completion for nested builder inference calls
^KT-42742 Fixed

(cherry picked from commit 7a66e22bb2)
2021-03-31 11:12:43 +03:00
Victor Petukhov
035726372f Process captured types with type variable inside properly, in the operations related with the type variables fixation
(cherry picked from commit 60f2f85be7)
2021-03-31 11:12:43 +03:00
Victor Petukhov
d4db5eb818 Substitute captured types with type variables properly
^KT-44687 Fixed

(cherry picked from commit a2b1aa753b)
2021-03-31 11:12:42 +03:00
Victor Petukhov
371664caf3 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

(cherry picked from commit b87c2a15b5)
2021-03-31 11:12:42 +03:00
Ilmir Usmanov
372f412ffb JVM IR: IC coroutines: return boxed type from suspend function if
the function overrides function, returning type argument
 #KT-45451 Fixed
2021-03-31 01:19:19 +02:00
Alexander Udalov
dea37386c6 Workaround illegal access to JDK internals in DynamicBundle
This is basically a manual cherry-pick of
https://github.com/JetBrains/intellij-community/commit/547caebd980d.

 #KT-44624 Fixed

(cherry picked from commit 6e86df2f6d)
2021-03-30 20:36:58 +02:00
Alexander Udalov
8bc04c9465 Copy com.intellij.DynamicBundle to compiler/cli
This is needed to fix KT-44264 without updating the whole project to
intellij 203, which might take significant time.

In this commit, the file is copied as is from
27837dd8e6/platform/core-api/src/com/intellij/DynamicBundle.java.

(cherry picked from commit 8e1a70cff6)
2021-03-30 20:36:57 +02:00
Dmitriy Novozhilov
fb98338fb8 Add workaround for problem with incorrect bytecode generation for callable references
This commit may be removed after next bootstrap update
2021-03-30 18:21:32 +03:00
Dmitriy Novozhilov
43accd4127 Update testdata 2021-03-30 18:21:27 +03:00
Dmitriy Novozhilov
dcf2e0afc7 Advance bootstrap to 1.5.0-RC-556 2021-03-30 18:21:11 +03:00
Dmitriy Novozhilov
c3cfba6a8e Switch IS_PRE_RELEASE flag to false 2021-03-30 18:20:24 +03:00
Mikhail Zarechenskiy
5a410946e0 Fix add import quick fix for delegated property and missing extension
^KT-39199 Fixed
2021-03-30 17:02:44 +03:00
Steven Schäfer
6e8a5c88ad JVM IR: Avoid IndexOutOfBounds exceptions in TypeOperatorLowering
The code didn't account for SYNTHETIC_OFFSETs (KT-45688) and could
throw on IR containing broken line numbers (KT-44910).

(cherry picked from commit a7f8f0d903)
2021-03-30 14:35:10 +03:00
Dmitry Petrov
6cc687f16c JVM_IR fix receiver type for fake overrides
(cherry picked from commit 466e7b60b0)
2021-03-30 14:35:10 +03:00
Ilya Chernikov
cd97f2bcba Fix parameter index on IR script generation in REPL scenario
Before it, the wrong index lead to the validation error when repl
script definition had c-tor parameters (see test)
2021-03-26 18:24:20 +01:00
Ilya Chernikov
d0349731fa Fix arguments processing with scripting with old backend by default 2021-03-26 18:24:20 +01:00
Anton Yalyshev
de62199901 Add change-notes for 1.5-M2 release 2021-03-26 13:44:04 +03:00
Anton Yalyshev
aa10005b7a Add change-notes for 1.4.30 release
(cherry picked from commit 3e59adc7f3)
2021-03-26 13:44:03 +03:00
Ilya Goncharov
3df6559f30 [Gradle, JS] Fix packages with hardcoded display name
^KT-45621 fixed

[Gradle, JS] Use karma 6.0 API to set ping timeout

^KT-45621 fixed

[Gradle, JS] Changed API for warnings filter in Webpack 5

^KT-45621 fixed

[Gradle, JS] Add workaround for debugging with webpack 5

^KT-45621 fixed

[Gradle, JS] Use patch only for webpack 5

^KT-45621 fixed
2021-03-25 15:03:47 +03:00
Vladimir Dolzhenko
9423ba4ee1 Fix handling non ctor elements in SECONDARY_CONSTRUCTOR_DELEGATION_CALL
#KT-45339 Fixed

(cherry picked from commit 8068a5439f)
2021-03-24 21:20:00 +01:00
Andrei Klunnyi
712fe59d4b KT-44299 [Sealed Interfaces]: when exhaustiveness in IDE considers java inheritor
^KT-44299 fixed
2021-03-23 17:11:01 +01:00
Svyatoslav Kuzmich
0490fe79bb [JS IR] Fix kotlin.js.js with complex constant expressions
Use IR interpreter to evaluate complex constexprs
2021-03-23 19:06:49 +03:00
Victor Petukhov
c7666b173c Revert "Don't stop constraints processing if all type variables have proper equality constraints"
This reverts commit 8ba60d41
2021-03-23 18:33:25 +03:00
Alexander Udalov
bcb870f377 Write underlying property name & type for inline class to metadata
This will be used in the compiler starting from 1.5.20 instead of the
currently used approach of looking for the single value parameter of the
primary constructor. The problem with the current approach is that
primary constructor can be private (since 1.4.30) and the property could
always be private. Relying on private declarations from metadata is
dangerous; for example lazy IR doesn't usually create stubs for private
declarations, and it didn't create stubs for private inline class
constructors before b5f9b1df, which led to the problem reported in
KT-44723.

(cherry picked from commit ea01c97a8e)
2021-03-23 16:25:05 +01:00
Ilmir Usmanov
f6962dfb75 Allow Result return type and nullability operators on Result type
by default
2021-03-23 15:33:30 +01:00
Dmitry Petrov
ccba574e81 JVM_IR KT-45377 rewrite constants again after AddContinuationLowering 2021-03-23 17:17:06 +03:00
Ilya Goncharov
ae79455460 [Wizard, JS] Fix kotlin-redux version
(cherry picked from commit 0a444bbc43)
2021-03-23 15:13:12 +01:00
Alexander Udalov
df06c174d1 JVM IR: support inline classes with private constructors from other modules
#KT-44723 Fixed

(cherry picked from commit b5f9b1dfc0)
2021-03-23 15:02:54 +01:00
Ilmir Usmanov
69e8f77646 Check for backend when checking for suspend in fun interfaces 2021-03-23 12:35:30 +01:00
Dmitry Petrov
02ac4c49c5 Minor: regenerate compiler tests 2021-03-22 15:39:01 +03:00
Dmitry Petrov
643c9dffec JVM_IR KT-45581 generate H_INVOKEINTERFACE for interface method handles 2021-03-22 15:39:01 +03:00
Dmitry Petrov
42f382714d 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)

(cherry picked from commit 73d4fa65ea)
2021-03-22 15:39:01 +03:00
Dmitry Petrov
b3fa48e9a3 JVM_IR KT-45408 rewrite static calls recursively
(cherry picked from commit f6baabd98e)
2021-03-22 15:39:01 +03:00
Alexander Udalov
dab0e642fe 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

(cherry picked from commit 415d52fe54)
2021-03-22 11:12:56 +01:00
Alexander Udalov
4b3eacf3a1 JVM IR: minor, improve error messages for inline classes
It will help in diagnosing problems like KT-44723.

(cherry picked from commit e5f218859b)
2021-03-22 11:12:44 +01:00
Ilya Gorbunov
9e987cfbf5 kotlin-test: make assertIs<T> returning value cast to T KT-45296
(cherry picked from commit 42648d55a0)
2021-03-19 17:06:19 +03:00
Ilya Gorbunov
8688f89680 Compile and run common tests of kotlin-test in kotlin-test-js-ir build
(cherry picked from commit 85a0538f0a)
2021-03-19 17:06:19 +03:00
Ilya Gorbunov
70d64b5db1 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

(cherry picked from commit e66eeefe2a)
2021-03-19 17:06:18 +03:00
Ben Asher
5642780c88 kotlin-test: add assertIs and assertNotIs assertions KT-45296
(cherry picked from commit 3a0219d84c)
2021-03-19 17:06:18 +03:00
Sergey.Shanshin
d9cc6ccf1e Disabled deserialization fields check optimization for non-JVM platforms
Resolves KT-45440
2021-03-19 16:36:34 +03:00
Sergey.Shanshin
1635a258cc Revert lazy serializers for objects, sealed and abstract classes
Resolves KT-45440
2021-03-19 16:36:33 +03:00
Steven Schäfer
ee7a01e36b JVM IR: Resolve fake overrides when calculating return types (KT-44867)
(cherry picked from commit d0424465b8)
2021-03-19 11:56:06 +01:00
Dmitry Petrov
4a549af4b4 Minor: regenerate compiler tests 2021-03-19 12:54:08 +03:00
Dmitry Petrov
97d0170006 JVM_IR KT-45195 generate non-static annotation members as ACC_ABSTRACT 2021-03-19 12:54:08 +03:00
Dmitry Petrov
e9033aac9a Add bytecode listing tests for 'allopen' plugin with JVM_IR 2021-03-19 12:54:08 +03:00
Dmitry Petrov
4715dbc479 JVM_IR KT-36853 patch parents after tailrecPhase
(cherry picked from commit ac6232b4ba)
2021-03-19 12:54:08 +03:00
Ilya Goncharov
1967297d6f [Gradle, JS] Use one folder for sync tasks
[Gradle, JS] WA for tests with multiple binaries

^KT-45574 fixed
2021-03-19 12:48:02 +03:00
Ilya Goncharov
703cfabfd8 Add possibility to hardcode version
^KT-42921 fixed

[Gradle, JS] Adopt Gradle plugin to webpack 5

^KT-42921 fixed

[Gradle, JS] Update versions with karma-webpack 5.0.0

^KT-42921 fixed

[Gradle, JS] Webpack serve for webpack-dev-server

^KT-42921 fixed

[Gradle, JS] Fix of using format-util

^KT-42921 fixed

[Gradle, JS] Use compatible node version

^KT-42921 fixed

[Gradle, JS] Add compatibility with webpack 4

^KT-42921 fixed

[Gradle, JS] Support custom display name in npm versions generator

^KT-42921 fixed
2021-03-19 11:42:07 +03:00
Roman Artemev
847a9f247d [Psi2Ir] Fix generation of property references for synthetic java props
- Declare it on use-site
 - Fix export checker for that case
 - Fix KT-45297

(cherry picked from commit 44d03bc727)
2021-03-18 18:58:04 +03:00
Alexander Udalov
8cf8a31072 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.

(cherry picked from commit a3a745e7a5)
2021-03-18 16:19:52 +01:00
Mikhail Zarechenskiy
e4d5e4e7d8 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 15:25:54 +03:00
Mikhail Zarechenskiy
13df529a5a 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 15:25:54 +03:00
Mikhail Zarechenskiy
bd489bc04d Do not generate DefaultImpls for light classes if not needed
#KT-41130 In Progress
2021-03-18 15:25:50 +03:00
SokolovaMaria
a0c1d73fee Exclude kotlinx.atomicfu compiler plugin modules 2021-03-18 14:39:12 +03:00
Alexander Udalov
3ff2ff7b8a Add JVM target bytecode version 16
#KT-45515 Fixed

(cherry picked from commit 27174de891)
2021-03-18 11:56:04 +01:00
Alexander Udalov
baf8edc3ff 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

(cherry picked from commit 83a4b6396a)
2021-03-18 11:56:01 +01:00
Alexander Udalov
2e6b75a5d8 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

(cherry picked from commit fc36178f3a)
2021-03-18 11:55:57 +01:00
Anton Lakotka
8124a95467 Add separate Plugin Classpaths per compilation
Make them extend the common CP for sake of backward compatibility
^KT-45020 Fixed
2021-03-18 09:34:19 +01:00
Yahor Berdnikau
bf4a6492ae Fix issues in Android test projects setup.
(cherry picked from commit 543ab3fa2a)
2021-03-18 10:13:59 +03:00
Dmitry Petrov
60a4afc556 JVM_IR KT-45446 don't erase captured var if it's dead code 2021-03-17 15:57:43 +03:00
Dmitry Petrov
ad93189c4f JVM_IR KT-44993 preserve inner expression type when fusing if-null
(cherry picked from commit decfaa3ba5)
2021-03-17 15:57:43 +03:00
Dmitry Petrov
2dd73500af PSI2IR KT-44414 fix adapted reference to imported object member
(cherry picked from commit d74168fb8f)
2021-03-17 15:57:43 +03:00
Yaroslav Chernyshev
81e90f68a1 Fix infinite org.gradle.tooling.internal.adapter.TypeInspector.visit call on 201 platform 2021-03-17 13:28:57 +03:00
Yaroslav Chernyshev
e8dab960c5 Revert "Revert "loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception'""
This reverts commit 758cd9d2
2021-03-17 13:28:57 +03:00
Yaroslav Chernyshev
e6b5695265 Revert "Revert "Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData'""
This reverts commit e86ca3b4
2021-03-17 13:28:56 +03:00
Yaroslav Chernyshev
c83f02f4b7 Revert "Revert "Precise platform importing changes ported from new repository""
This reverts commit c38b48c7
2021-03-17 13:28:56 +03:00
Yaroslav Chernyshev
9f41993d1d Revert "Revert "Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies""
This reverts commit 2ff99611
2021-03-17 13:28:55 +03:00
Yaroslav Chernyshev
95666c55c2 Revert "Revert "HMPP import: add dependencies present on all compilation a jvm&android shared source set participates""
This reverts commit 18deb8eb
2021-03-17 13:28:55 +03:00
Stanislav Erokhin
18deb8eb3d Revert "HMPP import: add dependencies present on all compilation a jvm&android shared source set participates"
This reverts commit af07c48a
2021-03-16 15:12:11 +01:00
Stanislav Erokhin
2ff99611fb Revert "Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies"
This reverts commit e74eee55
2021-03-16 15:11:18 +01:00
Stanislav Erokhin
c38b48c7f1 Revert "Precise platform importing changes ported from new repository"
This reverts commit ee50a584
2021-03-16 15:11:10 +01:00
Stanislav Erokhin
e86ca3b49a Revert "Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData'"
This reverts commit 1741f0fc
2021-03-16 15:11:01 +01:00
Stanislav Erokhin
758cd9d268 Revert "loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception'"
This reverts commit 05144914
2021-03-16 15:10:27 +01:00
Dmitry Petrov
98ece21909 Minor: regenerate compiler tests 2021-03-15 17:43:44 +03:00
Dmitry Petrov
8d8745bd48 JVM_IR KT-44744 check accessibility of enum entry 'this' 2021-03-15 17:38:39 +03:00
Yaroslav Chernyshev
051449143c loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception'
(cherry picked from commit aff49c76a9)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
1741f0fc9d Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData'
(cherry picked from commit 116b11d8be)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
ee50a584a7 Precise platform importing changes ported from new repository
(cherry picked from commit d053ee33a8)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
e74eee55dd Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies
(cherry picked from commit 960a7dca45)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
af07c48a86 HMPP import: add dependencies present on all compilation a jvm&android shared source set participates
(cherry picked from commit 18a06dc37e)
2021-03-15 17:25:44 +03:00
Dmitry Savvinov
dbb6d03084 Minor: inline addDependsOnSourceSets in buildCompilation
(cherry picked from commit 96a4d19365)
2021-03-15 17:25:44 +03:00
Dmitry Savvinov
6d8a8bc20d Minor: rename KotlinCompilation.sourceSets -> allSourceSets
(cherry picked from commit 4927777ffb)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
3526ebfd88 Minor: add test on importing platform of commonMain in single-backend project
(cherry picked from commit 1143865e88)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
39b9ae7c5d 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

(cherry picked from commit c3f5d57d3b)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
da044135d9 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

(cherry picked from commit 7a5b4ccb9a)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
a9285389ac Minor: swap receiver and parameter for shouldCoerceToCommon
Otherwise, it reads as if KotlinSourceSet coerces ImportingContext,
which is in fact the other way around

(cherry picked from commit ef04ae041e)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
b28db4d6d8 Dont coerce platforms of source-sets in HMPP to set of available targets in project
(cherry picked from commit 7ddcdca6bb)
2021-03-15 17:25:43 +03:00
Andrey Uskov
71e41b7c48 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)

(cherry picked from commit 9c000000cf)
2021-03-15 16:02:56 +03:00
Ilmir Usmanov
76d7b4254c Minor. Ignore tests on WASM 2021-03-15 13:29:44 +01:00
Ilmir Usmanov
f89ff877de JVM_IR: Do not unbox Result argument inside java SAM adapters
#KT-45259
2021-03-15 13:29:41 +01:00
Ilmir Usmanov
1d36def10c JVM_IR: Do not unbox Result argument inside SAM adapters
#KT-45259 Fixed
2021-03-15 13:29:40 +01:00
Ilmir Usmanov
8d68e56a78 Revert "Value Classes: Forbid var properties with value class receivers"
This reverts commit f43899086a.
2021-03-15 13:23:59 +01:00
Ilmir Usmanov
71f79a1ffc Revert "Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error"
This reverts commit bad197e075.
2021-03-15 13:23:56 +01:00
Roman Golyshev
37b90108ac 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)

(cherry picked from commit 5d0760c685)
2021-03-15 12:40:02 +03:00
Abduqodiri Qurbonzoda
6bfd6c0afb Mark kt45410.kt with TARGET_BACKEND: JVM
(cherry picked from commit 77c263fcc4)
2021-03-15 12:10:02 +03:00
Mikhael Bogdanov
43bb78a566 Fix compilation after @JvmDefault deprecation
Suppress could be removed after switch to -Xjvm-default=all

(cherry picked from commit 6fab1305e9)
2021-03-15 09:13:08 +01:00
Mikhail Bogdanov
0a4a3b6480 Deprecate @JvmDefault
#KT-40392 Fixed

(cherry picked from commit c11f38688e)
(cherry picked from commit 95654bb9bc)
2021-03-15 09:13:07 +01:00
Abduqodiri Qurbonzoda
16d7b2ffbb Introduce firstNotNullOf and firstNotNullOfOrNull #KT-12109
(cherry picked from commit ff5b2404af)
2021-03-13 02:54:22 +03:00
Abduqodiri Qurbonzoda
67241f9760 Strict version of String.toBoolean() #KT-42071
(cherry picked from commit 09ad5ca602)
2021-03-13 02:54:19 +03:00
Abduqodiri Qurbonzoda
f22e90337e Introduce assertContentEquals in kotlin-test #KT-32996
(cherry picked from commit 5f4a4fd8ae)
2021-03-13 02:54:16 +03:00
pyos
7948533230 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

(cherry picked from commit e06bacafad)
2021-03-12 18:02:02 +01:00
SokolovaMaria
d83a4fec7e Unused lambda parameter removed 2021-03-12 18:17:01 +03:00
SokolovaMaria
7868dc1880 Fixed running box tests for kotlinx.atomicfu compiler plugin 2021-03-12 18:17:01 +03:00
Mads Ager
5972130ee0 [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

(cherry picked from commit 8588412a56)
2021-03-12 14:47:11 +01:00
SokolovaMaria
bd9d8614dd Fix for running box tests on JS_IR 2021-03-12 16:18:14 +03:00
Victor Petukhov
c14d5d70ba 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:58:07 +03:00
Victor Petukhov
8ba60d41e1 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:58:03 +03:00
Victor Petukhov
878b3a7616 Don't fix a type variable into the intersection type if there is an explicit expected type
^KT-43303 Fixed
^KT-42472 Fixed
2021-03-12 14:57:58 +03:00
Mikhael Bogdanov
9e979e1e65 Advance bootstrap to 1.5.0-RC-325 2021-03-12 11:04:15 +01:00
Igor Yakovlev
d4493104d2 [ULC] Fix invalid primitive type annotating
Fixed #KT-45417
2021-03-12 10:43:43 +01:00
Dmitry Petrov
16da790a04 JVM_IR Spill stack on array constructor call
KT-42932

(cherry picked from commit 44e6483090)
2021-03-12 11:36:43 +03:00
Ilya Goncharov
a775cd261e [JS IR] In file JsModule top level with fresh names
[JS IR] Fix name for external classes

^KT-39272 fixed
^KT-41650 fixed
2021-03-12 11:12:57 +03:00
Ilya Chernikov
ad0b1a1e26 [minor] disable implicits test on IR, see added comments for details 2021-03-11 18:31:24 +01:00
Ilya Chernikov
c2ae0e4887 Add script metedata flag 2021-03-11 18:31:24 +01:00
Ilya Chernikov
c16e0f1e83 Mark script result expression as used to avoid coercion to unit 2021-03-11 18:31:24 +01:00
Ilya Chernikov
92be633866 Fix handling of lambdas in top-level destructuring declarations 2021-03-11 18:31:23 +01:00
Ilya Chernikov
94b97ce950 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 18:31:23 +01:00
Ilya Chernikov
8e26173ac0 [minor] fix scripting test dependencies 2021-03-11 18:31:23 +01:00
Ilya Chernikov
831eaa3b96 [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 18:31:22 +01:00
Ilya Chernikov
9bd64c3976 [minor] fix script util tests 2021-03-11 18:31:22 +01:00
Ilya Chernikov
d7cc7f59fc Implement REPL support in IR scripting 2021-03-11 18:31:21 +01:00
Ilya Chernikov
1977cfa3a9 Fix provided properties generation in ir scripting 2021-03-11 18:31:20 +01:00
Ilya Chernikov
a8acfee1b1 Enable IR in jvm scripting host tests 2021-03-11 18:31:20 +01:00
Ilya Chernikov
a804bc2041 Implement property for passing argumens to isolated script compiler 2021-03-11 18:31:18 +01:00
Ilya Chernikov
a62cf77dcf 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 18:31:18 +01:00
Ilya Chernikov
91ea3b04d9 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 18:31:18 +01:00
Ilya Chernikov
113117b8d3 [minor] Implement in-process test for main.kts cache
mainly to ease debugging
2021-03-11 18:31:18 +01:00
Ilya Chernikov
11588cdb7a Implement proper call to the base class ctor in ir script lowering 2021-03-11 18:31:16 +01:00
Ilya Chernikov
349c00ca28 Implement metadata handling for IR scripts 2021-03-11 18:31:16 +01:00
Ilya Chernikov
36503922c2 Implement IR backend support in scripting tests, enable for some tests 2021-03-11 18:31:16 +01:00
SokolovaMaria
e02c089bd4 kotlinx.atomicfu compiler plugin for JS_IR
Support transformations of atomic operations introduced by the kotlinx.atomicfu library for the JS_IR backend. Compiler plugin is applied externally by the kotlinx.atomicfu gradle plugin.
2021-03-11 20:03:15 +03:00
Ilya Gorbunov
518173d63b 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.

(cherry picked from commit a7fda66fa1)
2021-03-11 17:54:57 +03:00
Ilya Gorbunov
c83988cc61 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

(cherry picked from commit ca99fc4fed)
2021-03-11 17:54:56 +03:00
Alexander Udalov
58e95e3af3 Fix compilation after cherry-picking 51edbfdd
It turns out that that commit depended on f332192d, which isn't
cherry-picked to 1.5.0.
2021-03-11 15:51:34 +01:00
Alexander Udalov
357a49a8c9 Update public API dump for stdlib
(cherry picked from commit f4c63c8ba2)
2021-03-11 15:11:33 +01:00
Michael Hoisie
d924303849 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

(cherry picked from commit 83383ab9e5)
2021-03-11 15:11:29 +01:00
Alexander Udalov
51edbfdd03 JVM, JVM IR: report error if not all parts of multifile class are @JvmSynthetic
#KT-41884 Fixed

(cherry picked from commit bc5fc122c5)
2021-03-11 13:55:18 +01:00
Alexander Udalov
fc630fe25b Minor, move bytecodeListing tests on JvmMultifileClass
(cherry picked from commit 75850a618c)
2021-03-11 13:55:16 +01:00
Steven Schäfer
96a90b431a JVM: Add FILE target to the JvmSynthetic annotation (#4149)
(cherry picked from commit 057ead358c)
2021-03-11 13:55:15 +01:00
Victor Petukhov
568bde81d2 [jspecify] Change annotations' package from org.jspecify.annotations to org.jspecify.nullness, and DefaultNonNull to NullMarked
^KT-45409 Fixed

(cherry picked from commit b45d5abeb1)
2021-03-11 15:33:14 +03:00
Alexander Udalov
c67541ef26 JVM IR: prevent behavior change with operator dot calls on literals
#KT-42321 Fixed

(cherry picked from commit bf844aa8e4)
2021-03-11 13:15:29 +01:00
Alexander Udalov
438bb71a15 Remove one layer of nested exceptions in JVM backend
(cherry picked from commit c7498dd74d)
2021-03-11 12:42:12 +01:00
Vladimir Dolzhenko
da5fa4d573 Filter KtAnnotated on-the-fly diagnostic elements
Relates to #KTIJ-1760
Relates to #KT-45254

(cherry picked from commit fbe18164b4)
2021-03-11 10:51:08 +01:00
Dmitry Petrov
19f34c11c8 Minor: regenerate tests 2021-03-11 12:03:22 +03:00
Dmitry Petrov
0798d32630 Bump d8 used in box tests to 2.1.75 2021-03-11 12:03:22 +03:00
Dmitry Petrov
7ce6f2f30b JVM_IR Do not generate generic signatures for lifted lambda methods 2021-03-11 12:03:22 +03:00
Dmitry Petrov
3df95bc536 JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+ 2021-03-11 12:03:22 +03:00
Dmitriy Novozhilov
d5fd91918a [FE] Don't fail with exception if ESVisitor tries to visit ESLambda
#KT-45243 Fixed
2021-03-11 11:27:08 +03:00
Alexander Udalov
54ddbab79e 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

(cherry picked from commit 628d75c7cd)
2021-03-10 19:57:37 +01:00
Alexander Udalov
18bcf6a375 IR: add descriptor to "unbound symbols not allowed" message
This will help in diagnosing problems such as KT-45236.

(cherry picked from commit 8294aed40c)
2021-03-10 12:30:29 +01:00
Alexander Udalov
3528b854ff 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.

(cherry picked from commit e3dc112c5f)
2021-03-10 12:30:26 +01:00
Alexander Udalov
f46b8220a1 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`.

(cherry picked from commit bdaeaca5ae)
2021-03-10 12:30:22 +01:00
Alexander Udalov
a2fd3a86d0 Minor, add box test for unreachable uninitialized property
#KT-44496

(cherry picked from commit 5fc9f3bc17)
2021-03-10 12:30:18 +01:00
Alexander Udalov
31d93fd3b3 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

(cherry picked from commit 247efb220c)
2021-03-10 12:30:14 +01:00
Mikhael Bogdanov
33fc319c83 Use compatibility accessors only in compatibility stubs
(cherry picked from commit 66a29c70bf)
2021-03-10 10:50:23 +01:00
Mikhael Bogdanov
4eb85174e0 Don't generate private members in compatibility mode in DefaultImpls
(cherry picked from commit efceb89b98)
2021-03-10 10:50:20 +01:00
Mikhael Bogdanov
33d4e6f4f0 Generate stubs for private function with default arguments as public in interfaces
(cherry picked from commit f648d86d2b)
2021-03-10 10:50:19 +01:00
Ilmir Usmanov
250092c78d Regenerate test 2021-03-09 21:38:14 +01:00
Mads Ager
7de71d6045 [IR] Make IrGetObjectValue copyable to avoid duplicate IR nodes.
Fixes KT-45170
2021-03-09 18:52:50 +03:00
Svyatoslav Scherbina
2504a1cea1 Update Kotlin/Native: 1.5-M2-eap-1 2021-03-09 17:10:09 +03:00
Igor Yakovlev
1532a92209 [ULC] Fix annotations with no site for ctor
Fixed #KT-45291
2021-03-09 13:56:15 +01:00
Igor Yakovlev
f98ceaf5a7 [ULC] Fix annotations invalid parents
Fixed #KT-45287
2021-03-09 13:56:01 +01:00
sebastian.sellmair
dc0aae2dde [Commonizer] Implement safe SharedCommonizerTarget factory function
Do not try to instantiate SharedCommonizerTarget with no leaves
^KT-45350 Verification Pending
2021-03-09 12:21:47 +01:00
sebastian.sellmair
dfa1794deb [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.

(cherry picked from commit 6527452143)
2021-03-09 12:21:47 +01:00
Ilmir Usmanov
209c18374c Extend LVT record of alive variables to end of next suspension point
Otherwise, arguments of suspend call become invisible in async stack
trace
 #KT-44714
2021-03-09 12:14:59 +01:00
Ilmir Usmanov
6c2e3af775 Make start label of LVT record the point where variable becomes alive
Otherwise, there will be overlapping LVT records, which leads to
removal of the whole LVT by R8.
 #KT-44714 Fixed
2021-03-09 12:14:48 +01:00
Ilmir Usmanov
e491e7e289 Do not remove dead variables' LVT records
Also, extend liveness of alive variable to nearest suspension points
 #KT-44714
2021-03-09 12:14:46 +01:00
Mikhael Bogdanov
733f4e7501 Fix EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE message
(cherry picked from commit 4d51d71699)
2021-03-09 12:06:49 +01:00
Mikhael Bogdanov
fcf75f60a1 Use actual implementation instead of inherited one in -Xjvm-default diagnostics
(cherry picked from commit 3568eba1b2)
2021-03-09 12:06:49 +01:00
Mikhael Bogdanov
389f489fda Fix checker for -Xjvm-defaults
(cherry picked from commit 71c134e54f)
2021-03-09 12:06:48 +01:00
Alexander Udalov
940469dc4f Add KClass.isValue to kotlin-reflect
#KT-44782 Fixed

(cherry picked from commit 6ddca4a592)
2021-03-09 11:45:48 +01:00
Alexander Udalov
d8b85debe6 Restore writing bytecode version to metadata for LV < 1.5
#KT-45323 Fixed

(cherry picked from commit 9970851684)
2021-03-08 11:19:12 +01:00
Alexander Udalov
ffe642c0b7 Revert "Do not write bytecode version to class file"
This reverts commit c6f5ce6837.

 #KT-45323

(cherry picked from commit a2200b5386)
2021-03-08 11:19:10 +01:00
Vladimir Dolzhenko
ee11ace111 Ignore when failed to get file text
Relates to #KTIJ-706

(cherry picked from commit 36ff952a0f)
2021-03-08 09:51:46 +01:00
Andrey Uskov
5aea142d3a Fixed loading Gradle script templates located on WSL2
#KT-45042 Fixed

(cherry picked from commit b7e13d677d)
2021-03-07 19:41:49 +03:00
Andrey Uskov
6794e4d54c Implemented collecting projectId from Gradle
#KT-45337 Fixed

(cherry picked from commit 63925ee018)
2021-03-07 19:41:44 +03:00
justin.wei
b63b1aee7a Support relocatable cache for InputCache
(cherry picked from commit 34274dd032)
2021-03-07 16:55:44 +03:00
Ivan Gavrilovic
c2bcc7be15 KAPT - Make StructureTransformAction cacheable
When computing classpath structure ignore absolute
paths and timestamps. This also makes the transform
cacheable and it should increase cache hit rate.

Test: existing BuildCacheRelocationIT
2021-03-07 16:55:41 +03:00
Ivan Gavrilovic
b2d4f0f9a2 KT-45168: Avoid generating stubs for generated Kotlin sources
Filter out Kotlin sources coming from KAPT-generated dirs.
Some annotation processors e.g Moshi, generate Kotlin sources,
and when generating stubs in non-incremental runs, stub generation
must ignore those sources. This fixes #KT-45168.

Test: Kapt3IT
(cherry picked from commit 08446e2371)
2021-03-07 16:55:39 +03:00
Yahor Berdnikau
96a91189b0 Distinguish outputs of JS IR tasks.
Now JS IR link and sync tasks will output produced artifacts based on
compilation name, binary name and binary mode. This will remove
Gradle 7 error about missing task dependencies, which should not depend
on each other.

^KT-44949 In Progress
2021-03-07 12:02:35 +01:00
Yahor Berdnikau
c34a05866e Fix test expects slightly different variant selection error message.
Error message was slightly changed on Gradle 7.

^KT-44949 In Progress
2021-03-07 12:02:34 +01:00
Yahor Berdnikau
99c24a8ce2 Update AGP tests.
Bump AGP version in some tests and ignore AGP 3.4 tests on Gradle 7.
AGP 3.4 is not compatible with Gradle 7.

^KT-44949 In Progress
2021-03-07 12:02:34 +01:00
Yahor Berdnikau
d393038762 Change source jar duplication error to warning.
For now Gradle 7 will print warnings on publishing sources jar containing
duplicate files.

Duplicates are coming from SourceSets SourceSet added to sources jar
task depends on. Such approach should be rethought.

^KT-44949 In Progress
2021-03-07 12:02:34 +01:00
Yahor Berdnikau
b1ddb612ee Fix test was using removed publication plugin.
Replace usage of removed 'maven' plugin with 'maven-publish'.

^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
6e5af9e6b6 Fix test project uses removed configuration for dependencies.
^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
11fc1dccaf Link task producing jar with sources to dukat tasks.
This required by Gradle 7 task validation.
Though in some cases sourcesJar task should not depend in some cases on Dukat tasks.

^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
d1b7f203d2 Split klib and cinterop outputs.
So Gradle 7 will not complain that some tasks using klib or cinterop
should depend on both tasks producing klib and cinterop, while they
don't need both.

^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
52454977ca Fix test was using old KMM dependency notation.
^KT-44949 In Progress
2021-03-07 12:02:32 +01:00
Yahor Berdnikau
e3833fedf1 Ensure compilation task depends on friend artifact producer task.
Without it Gradle 7.0 tasks dependency validation will fail.

Fix JS tasks are not cacheable due to friends inputs change.

^KT-44949 In Progress
2021-03-07 12:02:27 +01:00
Abduqodiri Qurbonzoda
906d434abb Fix @SinceKotlin in Common titlecase and titlecaseChar functions
(cherry picked from commit e7a45bba91)
2021-03-07 07:59:43 +03:00
Abduqodiri Qurbonzoda
476c157847 Mark with @SinceKotlin("1.5") the Common char category API
(cherry picked from commit 10b0d147af)
2021-03-07 07:59:41 +03:00
Cedric Champeau
b69dc5fde1 Fix File as input of an artifact transform
Using `File` as input of an artifact transform was deprecated.
With Gradle 7, this becomes an error. This commit fixes the
problem by using the proper replacement:

   Provider<FileSystemLocation>
2021-03-06 13:51:15 +01:00
Abduqodiri Qurbonzoda
f1503d8f10 Optimized toArray method for ArrayDeque and ListBuilder #KT-42720
(cherry picked from commit 421cb6971d)
2021-03-06 11:22:30 +03:00
Abduqodiri Qurbonzoda
54feaa8528 Commonize and generalize JVM-only String.contentEquals #KT-42840
(cherry picked from commit ed57bcb3b1)
2021-03-06 11:22:29 +03:00
Ilya Gorbunov
54d20b5768 Support mod and floorDiv extensions in constant evaluator
Ignore evaluation tests for floorDiv and mod with FIR for now.

(cherry picked from commit 9cc8f44390)
2021-03-06 02:02:32 +03:00
Ilya Gorbunov
8eaccb5d23 Rename test of rem operator evaluation
(cherry picked from commit 58e6f775bb)
2021-03-06 02:02:28 +03:00
Ilya Gorbunov
529e82cfcb Generate docs for floorDiv and mod and improve docs for div and rem
Refactor operator documentation generation for primitives and unsigned
types so that it is easier to specialize it.

Manually sync docs of numeric types in js-ir stdlib.

 KT-26234

(cherry picked from commit 7e2c365b79)
2021-03-06 02:02:25 +03:00
Ilya Gorbunov
28f632987a Floor division and remainder for numeric types KT-26234
- floorDiv/mod for unsigned types
- floorDiv/mod for signed types
- mod for floating point types

- mod return type: same as divisor for integer types

- Update JS API dump
- Avoid triggering division overflow in tests due to K/N
- Workaround failing test in JS-legacy

(cherry picked from commit 50d4979531)
2021-03-06 02:02:22 +03:00
Mads Ager
c34d2f979a [IR] Move annotations from original to new constructor declarations.
LocalDeclarationsLowering did not move annotations when creating
a new constructor declaration, thereby losing the annotations.

Fixes KT-45298

(cherry picked from commit e5631addf3)
2021-03-05 21:24:54 +01:00
Mads Ager
970ca5264c [JVM IR] Make upper bounds check recursive for ieee Equals.
Fixes KT-44402

(cherry picked from commit 965c118521)
2021-03-05 21:23:12 +01:00
Mikhael Bogdanov
55e7d4bf7a Reports warning on super calls in public-api inline functions
(cherry picked from commit 8ff0b1e243)
2021-03-05 20:29:18 +01:00
Alexander Udalov
48fe3a699a Add test which runs Kotlin compiler in parallel
This will be useful in diagnosing issues like KT-45007 in the future.

 #KT-45007

(cherry picked from commit 027df41740)
2021-03-05 17:59:16 +01:00
Alexander Udalov
dfa7dadac4 Revert "Fix KotlinCoreEnvironment projectCount disposable"
This reverts commit 99a6bdeec7.

 #KT-45007 Fixed

(cherry picked from commit e7e17cdaa9)
2021-03-05 17:59:14 +01:00
Alexander Likhachev
da5c625f6e [Gradle] Rework KotlinTestReport to be compatible with configuration cache
(cherry picked from commit ef890464d8)
2021-03-05 17:48:58 +03:00
Roman Artemev
0137f3e39f [KLIB] Support assignable value parameters in deserializer
- fix KT-44945
2021-03-05 17:13:04 +03:00
Yahor Berdnikau
81dd45ab86 Fix Jvm target tries to use removed configuration.
KT-44949 In Progress
KT-44957 Fixed
2021-03-05 14:32:25 +01:00
Yahor Berdnikau
63d48416b6 Fix JS target configuration triggers task creation too early.
This raised the problem that task, compilation task depends on, has not
been yet created and Gradle fails the build with exception.

KT-44949 In Progress
2021-03-05 14:32:13 +01:00
Yahor Berdnikau
a21266009c Migrate to the actual workers api available from Gradle 5.6.
Old api was removed in Gradle 7 and causes build crashes.

KT-44949 In Progress
2021-03-05 14:32:00 +01:00
Victor Turansky
147874be43 Use optimized Ktor client (-0.5MB)
[Details](https://youtrack.jetbrains.com/issue/KTOR-1084)
2021-03-05 13:11:12 +01:00
Victor Turansky
d25e48dbfe Use appropriate kotlin wrappers version (1.4.21 -> 1.4.30) 2021-03-05 13:11:11 +01:00
Bingran
b2489d87bb Update min supported gradle version to 6.1
This PR also updates the min agp version we test with because older agp
versions are using gradle apis which doesn't exist in gradle 6.0+.

GH PR: #4155
2021-03-05 12:42:41 +01:00
Alexander Likhachev
049580e639 [Gradle, JS] Make MultiplePluginDeclarationDetector compatible w/ conf cache 2021-03-05 12:41:13 +01:00
Alexander Likhachev
85d30c16f1 [Gradle] Replace deprecated dependencies configurations in buildscript
(cherry picked from commit ef458b20e1)
2021-03-05 14:05:42 +03:00
Ilya Gorbunov
d8de055767 Add runtime dependency on junit-jupiter-engine to kotlin-test-junit5
It is required to run tests authored with kotlin-test, so it seems
convenient to have it as a runtime dependency of kotlin-test-junit5
variant.

Depend on the version 5.6.0, which is approx. one year old.
Can be upgraded in the consumer project if necessary.

Also upgrade junit-jupiter-api dependency to 5.6.0, so that users could
use more recent JUnit functionality in JVM tests,
but continue compiling the artifact against 5.0.0 to leave a
possibility to downgrade JUnit platform dependency if needed.

KT-45107

(cherry picked from commit 284e6f5bb3)
2021-03-05 04:14:57 +03:00
Ilya Gorbunov
a7a4ccee0c Unify test package names in kotlin-stdlib tests
This makes 'test.' an implicit package prefix, thus fixing the inspection
"Package directive doesn't match file location" positive in almost all
test files.

(cherry picked from commit ca6ce151a2)
2021-03-05 04:12:01 +03:00
Nikolay Krasko
30f654c4ea Add fasutil to the list of package to relocate (KT-44758)
#KT-44758 Fixed

(cherry picked from commit 3022fb396b)
2021-03-04 23:03:53 +03:00
Mikhail Zarechenskiy
67e812cd28 Increase stub versions for major release
^KT-41056 Fixed
2021-03-04 22:12:22 +03:00
Abduqodiri Qurbonzoda
4a936324b5 Commonize Char.titlecaseChar() and Char.titlecase() #KT-44369
(cherry picked from commit 2266cd4631)
2021-03-04 20:43:35 +03:00
Abduqodiri Qurbonzoda
a2bdee74e1 Add String case conversion tests
(cherry picked from commit 0c9205423f)
2021-03-04 20:43:32 +03:00
Abduqodiri Qurbonzoda
48582b1caa Add Char case conversion tests
(cherry picked from commit 49ce776bf4)
2021-03-04 20:43:29 +03:00
Abduqodiri Qurbonzoda
6b5379e6c0 Implement String case conversion generators #KT-45213
(cherry picked from commit fc5e4c20c1)
2021-03-04 20:43:26 +03:00
Abduqodiri Qurbonzoda
ce0fe0358a Implement Char one-to-one and one-to-many case conversion generators #KT-45213
(cherry picked from commit 1066de1be6)
2021-03-04 20:43:24 +03:00
Pavel Kirpichenkov
825563d4f8 [MPP] Consider expect-actual inline/value classes interchangeable
^KT-44926 Fixed
2021-03-04 20:13:20 +03:00
Pavel Kirpichenkov
68b2a0931a Add test for KT-44926 2021-03-04 20:13:20 +03:00
Pavel Kirpichenkov
9f793dab35 Minor: refactor extended compiler checks
Use an analysis flag instead of a stub language feature
2021-03-04 20:13:20 +03:00
Pavel Kirpichenkov
df243ebd66 Provide additional information about missing supertypes
Add -X flag to report extra compiler diagnostics which migth break compatibility.
Use the flag to unconditionally check constructors without fear of
prematurely evaluating lazy supertypes.

KT-19234
KT-42404
KT-44583
2021-03-04 20:13:20 +03:00
Alexander Likhachev
bb558c5282 Update tests after compiler properties rework
#KT-43605 Fixed

(cherry picked from commit 70d434e992)
2021-03-04 19:52:49 +03:00
Alexander Likhachev
de62c4cde7 [Gradle] Read system properties at configuration time using Gradle providers
The change is a step to fully support Gradle configuration cache.
Relates to #KT-43605
Relates to #KT-44611

(cherry picked from commit 3537c699b5)
2021-03-04 19:52:44 +03:00
Alexander Likhachev
5c05860ad3 [Gradle, MPP] Rework build finished listener into build service
Registering build finished listeners is not supported by configuration cache
Relates to #KT-44611
#KT-44900 Fixed

(cherry picked from commit 67632a495b)
2021-03-04 19:39:56 +03:00
Alexander Likhachev
a372dd7660 [Gradle] Bump gradle-download-task version to 4.1.1 to support configuration cache
Relates to #KT-44611

(cherry picked from commit 3e09bb3d3f)
2021-03-04 19:39:34 +03:00
Alexander Likhachev
268e33fa49 [Gradle, JVM] Don't create deprecated compile/runtime configurations
Gradle also removes these configurations in 7.0. See gradle/gradle@2cb45cdbd0
#KT-44462 Fixed

(cherry picked from commit 683bd0ed38)
2021-03-04 19:38:10 +03:00
Margarita Bobova
8d71befde0 Add Changelog for 1.5-M1, 1.4.31, 1.4.30 2021-03-04 14:20:14 +03:00
Sergey Shanshin
43a6d7a180 Lazy delegate for serializer in objects, sealed and abstract classes
Fixes Kotlin/kotlinx.serialization#585

(cherry picked from commit bf6dda2d99)
2021-03-03 21:45:26 +03:00
Yahor Berdnikau
3a11ac6799 Replace, where possible in tests, jcenter() with mavenCentral().
In few places I have to leave bintray repository due to not all kotlin
dependencies where migrated to maven central.

^KT-44949 In progress
2021-03-02 16:01:49 +01:00
Sergey Shanshin
45192ea73d Updated bytecode of serialization for IR
`shouldEncodeElementDefault` now checked before evaluating default value

(cherry picked from commit 8c20c655fe)
2021-03-02 17:03:56 +03:00
Sergey Shanshin
17bb85d624 Support serialization of java enum classes in IR
Fixes Kotlin/kotlinx.serialization#1334

(cherry picked from commit 91f1cb88c1)
2021-03-02 17:03:55 +03:00
Sergey Shanshin
06fa4b8128 Added external serializers in serialization plugin for IR backend
- added fallback support of external serializers in IR
- implemented calculations of properties default values in IR
- swapped check of shouldEncodeElementDefault and comparing the property with default value in IR. Now default value calculated only of shouldEncodeElementDefault returns false

(cherry picked from commit de06a69b12)
2021-03-02 17:03:55 +03:00
Yaroslav Chernyshev
cb97fe0274 Add lambda configurable languageSettings function in KotlinSourceSet
Function with Groovy Closure is already exists, it provides DSL parity
#KT-44834 Fixed

(cherry picked from commit 7d766add4b)
2021-03-02 16:37:43 +03:00
Ilmir Usmanov
c0c985993c IC: Add inline class -> @JvmInline value class warning 2021-03-02 13:07:42 +01:00
Yaroslav Chernyshev
48370ecf8c Fix jvmTarget default divergence between KGP & IDE after change to 1.8
(cherry picked from commit 634c8522a1)
2021-03-02 11:54:22 +03:00
Mikhael Bogdanov
a76ee3ae2e Fix ultra light class generation for private suspend methods
(cherry picked from commit 373d0ac660)
2021-03-01 16:25:33 +01:00
Mikhael Bogdanov
5d69bc5022 Remove version requirements for -Xjvm-default=enable (1.2.40) and JvmFieldInInterface(1.2.70)
(cherry picked from commit 989fea3399)
2021-03-01 16:25:32 +01:00
Mikhael Bogdanov
3aa7f72527 Generate local delegated properties in interface in jvm-default all modes
(cherry picked from commit 49aa36b70d)
2021-03-01 16:25:31 +01:00
Mikhael Bogdanov
a7002d5e38 Generate private suspend functions as private (not synthetic package-private)
#KT-26592 Fixed

(cherry picked from commit c25a694b6b)
2021-03-01 16:25:30 +01:00
Mikhael Bogdanov
6ceff112e2 Add test for private suspend and JVM defaults
(cherry picked from commit ad8eddac99)
2021-03-01 16:25:27 +01:00
Mikhael Bogdanov
491ee56cd4 Generate synthetic annotation method in interface if -Xjvm-default is on
(cherry picked from commit 8764bb09f2)
2021-03-01 16:25:25 +01:00
anastasiia.spaseeva
d5666ba699 Update compose version to 0.3.1
(cherry picked from commit fb83c491bb)
2021-03-01 16:08:45 +01:00
anastasiia.spaseeva
8cb17f57f7 Fix tests after libraries and wrappers versions updating 2021-03-01 16:08:44 +01:00
Andrei Klunnyi
ee11fbcbf7 KT-44821 [Sealed Interfaces]: when-exhaustiveness failure in IDE
Compiler check for 'when' exhaustiveness requires that module
descriptors of a sealed class and its inheritors are the same (reference
identity matters). Prior to this commit and under some conditions they
were not. Details follow below.

Resolution related data structures (resolution facades) are organized
into trees (sdks, libs, and modules have their own nodes/facades,
module/class descriptors are stored inside). And the trees themselves
are put into a map associating so called PlatformAnalysisSettings and
GlobalFacades (plays a role of a root). PlatformAnalysisSettings is an
abstraction describing target platform and sdk of a module. The more
combinations exist for a project the more facades are used. Please, see
KotlinCacheService for more details.

So why a module can have multiple ModuleDescriptor-s?
Every tree mentioned above is an isolated resolution environment
containing its own instances of the outer world descriptors. Say, if a
project has modules X, Y, Z and we consider X then all three might have
their own vision of X, i.e. 3 descriptors exist at a time.

What descriptor instance does compiler get?
The path starts when the user opens a file in the editor and
highlighting pass starts (see usages of
ResolutionUtils#analyzeWithAllCompilerChecks). Module descriptor stored
in the resolution tree of the file's module gets injected into the
compiler's context. Starting from this moment compiler sees other
modules through the prism of a single resolution facade (tree).
Descriptors residing outside are alien.

This commit allows IdeSealedClassInheritorsProvider to figure out what
PlatformAnalysisSettings are associated with the resolution facade (read
ModuleDescriptor) seen by the compiler. Later on the same facade is used
to provide correct instances of sealed inheritors back to the compiler.

(cherry picked from commit f45af5ea0e)
2021-03-01 12:34:40 +01:00
anastasiia.spaseeva
448a6cb995 Update libraries and wrappers versions for 1.5.0 2021-02-26 17:29:11 +01:00
Nikita Katkov
1132bde48f IDEA-253605 jvmClassPathUtil: preserve old behaviour
(cherry picked from commit e1b3cd32f3)
2021-02-26 15:07:32 +01:00
Nikita Katkov
6bcb4cc53a IDEA-253605 jvmClassPathUtil: correct collection of parent classloaders
(cherry picked from commit 738c6d3119)
2021-02-26 15:07:31 +01:00
Dmitry Savvinov
c0e01ddebb Minor: use more clear and specific naming for LazyClassContext.typeChecker (relevant for MPP with type refinement) 2021-02-26 12:56:09 +03:00
Dmitry Savvinov
1baa83bd34 Use overriding util with proper typechecker for overriding in LazyClassMemberScope
Note that LazyClassMemberScope actually has a separate field for
KotlinTypeRefiner, and it might be actually different from the one in
c.kotlinTypeChecker.

The one in c.kotlinTypeChecker is the refiner of *owner* module, i.e. a
module in which the class has been declared. If we have a class Foo :
Expect in common, then the refiner will be from common, and thus it
won't be able to refine supertypes to their platform-dependent values.

The one passed in constructor is actual refiner of dependant-module.
Say, if we're looking at Foo from the point of view of jvmMain, then
we'll create a (view-dependent) LCMS for that, and it will contain
refiner for jvmMain.

It is important to use proper refiner, otherwise the idea of having
"module-dependent view" breaks, and we might suddenly mismatch some
overrides with expect-classes in their signatures.

^KT-44898 Fixed
2021-02-26 12:56:08 +03:00
Dmitry Savvinov
3700d23b18 Add test on KT-44898 (MPP + type refinement + complex inheritance)
The current behaviour is undesired (ABSTRACT_MEMEBER_NOT_IMPLEMENTED
reported on class Concrete), will be fixed in the next commit
2021-02-26 12:56:07 +03:00
Dmitry Savvinov
023d80b5fa Minor: rename createMemberScope -> createScopesHolderForClass 2021-02-26 12:56:06 +03:00
Igor Chevdar
a2760b3f78 [IR] Fixed bug with reflectionTarget evaluation 2021-02-26 12:50:45 +05:00
Igor Chevdar
696557032c [PSI2IR] Set reflectionTarget for all adapted references 2021-02-26 12:50:38 +05:00
Alexander Udalov
94fe759b9d IR: support smart cast values in RangeContainsLowering
#KT-44878 Fixed

(cherry picked from commit acc2256de9)
2021-02-25 21:00:47 +01:00
Alexander Udalov
5f9fe82903 IR: add isUnsignedType/getUnsignedType
(cherry picked from commit 820762ca16)
2021-02-25 21:00:45 +01:00
Alexander Udalov
00668484bd IR: add getPrimitiveType, optimize some usages of isInt/isByte/...
(cherry picked from commit 0ebdf7c3c4)
2021-02-25 21:00:43 +01:00
Alexander Udalov
295fff2fbc Minor, fix compilation warning in DurationUnit.kt
(cherry picked from commit 17ee10a0d8)
2021-02-25 21:00:41 +01:00
Ilmir Usmanov
9e090ea744 Do not add @JvmInline annotation on JS and Native 2021-02-25 18:09:58 +01:00
Ilmir Usmanov
f783bb87b3 Minor. Remove outdated test and update maven test 2021-02-25 18:09:56 +01:00
Ilmir Usmanov
51394349d0 fixup! Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 18:09:54 +01:00
Ilmir Usmanov
a536d4c5b8 Add inline class -> @JvmInline value class intention 2021-02-25 18:09:52 +01:00
Ilmir Usmanov
6e654067ab Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 18:09:49 +01:00
Dmitriy Novozhilov
86b01d2ba6 Fix non-exhaustive when in common stdlib
(cherry picked from commit 99c47a0487)
2021-02-25 17:07:29 +03:00
Dmitriy Novozhilov
522cfebc9a [FE] Make whens on expect sealed classes and enums not exhaustive 2021-02-25 17:07:28 +03:00
Alexander Udalov
3b026c9116 JVM IR: do not hide constructor with inline class in anonymous object
#KT-45131 Fixed

(cherry picked from commit b417786fd4)
2021-02-25 14:44:53 +01:00
Alexander Udalov
1210381342 Do not ever run JVM test handlers after previous errors
If there's a frontend error in a test, or bytecode generation crashed
with an exception, it makes no sense to run JVM test handlers such as
lambda inlining checker or D8 checker.

(cherry picked from commit b026de768d)
2021-02-25 14:44:42 +01:00
Andrei Klunnyi
badfaf3db9 KT-45074 [Sealed Interfaces]: when exhaustiveness after gradle reimport
Module descriptor names in the form of 'stableName' depend on a build
system. See JvmCodegenUtil#getModuleName(). For JPS we get
<module-name.main> or <module-name.test> whereas for Gradle we get top
level <module-name>.
This commit changes approach: ModuleDescriptor-to-Module conversion is
no longer made by name. ModuleInfo is utilized instead.

^KT-45074 fixed
2021-02-25 11:41:07 +01:00
Victor Petukhov
ebfa56d9ed Don't throw an exception while loading type use annotations on implicit bounds of a wildcard
^KT-45067 Fixed
2021-02-24 21:07:59 +03:00
Stefan Wolf
cdc1aa8928 Remove references to validateTaskProperties
The task is now called `validatePlugins`.
2021-02-23 23:29:18 +03:00
Stefan Wolf
c2a4b2d886 Add PathSensitive annotation to all input file properties
So new validation which will be added in Gradle 7.1
won't cause warnings during the build.
2021-02-23 23:29:16 +03:00
Stefan Wolf
b69e119fd4 Enable stricter validation 2021-02-23 23:29:13 +03:00
Mads Ager
ca1df95052 [PSI2IR] Do not generate property reference setter if inaccessible.
Fixes KT-45064.

(cherry picked from commit 8852323a76)
2021-02-23 19:38:08 +01:00
Ilmir Usmanov
c90f01a81b JVM IR: Use INVOKESPECIAL instead of INVOKEVIRTUAL for default private
suspend functions.

 #KT-26592
2021-02-23 18:49:45 +01:00
Ilmir Usmanov
85b9b5b85f JVM IR: Do not generate private suspend functions as synthetic package-private
#KT-26592
2021-02-23 18:49:42 +01:00
Alexander Udalov
396ea68c1a Deprecate kotlin.Metadata.bytecodeVersion
#KT-41758 Fixed

(cherry picked from commit 48fb085bf6)
2021-02-23 14:16:24 +01:00
Alexander Udalov
15b3f54e66 Remove JvmBytecodeBinaryVersion from the compiler code
Move it to build-common where it's still used in incremental compilation
caches, and simplify a bit. In the future, it'll make sense to remove it
completely and to avoid writing it to caches. In this commit, I don't do
that to prevent the IC cache version to be updated, causing rebuilds for
all JPS projects.

 #KT-41758

(cherry picked from commit f63ffc51ae)
2021-02-23 14:16:22 +01:00
Alexander Udalov
e90e8fa53b Remove obsolete code in inliner for experimental coroutines
(cherry picked from commit d300e05be9)
2021-02-23 14:16:20 +01:00
Alexander Udalov
403245bd38 kotlinx-metadata-jvm: deprecate KotlinClassHeader.bytecodeVersion
#KT-41758

(cherry picked from commit 448c6c2f0d)
2021-02-23 14:16:18 +01:00
Alexander Udalov
02710c33d3 Do not write bytecode version to class file
#KT-41758

(cherry picked from commit c6f5ce6837)
2021-02-23 14:16:17 +01:00
Alexander Udalov
5a698f8121 Do not report errors about bytecode version
#KT-41758

(cherry picked from commit 862a9143da)
2021-02-23 14:16:08 +01:00
Alexander Udalov
4536b13ceb JVM IR: fix isMarkedNullable for nullability-flexible types
Since nullability-flexible types in IR are represented by an annotation
on an IrSimpleType, not a special instance, the common implementation of
`KotlinTypeMarker.isMarkedNullable` in `TypeSystemContext` doesn't work.

This method is used for example to generate `typeOf` in JVM IR, in
`TypeSystemCommonBackendContext.generateTypeOf`, and this issue led to a
difference in behavior of `typeOf` for nullability-flexible types.

 #KT-44726 Fixed

(cherry picked from commit e6476c39ca)
2021-02-22 12:53:02 +01:00
Vladimir Dolzhenko
c7376896d6 Do not swallow PCE
#KT-39776 Fixed

(cherry picked from commit b8d1bbdd0d)
2021-02-22 10:52:49 +01:00
Victor Petukhov
5f53dff7c9 Approximate captured types in contravariant positions properly
^KT-43802 Fixed

(cherry picked from commit 4e5647090e)
2021-02-20 17:01:36 +03:00
Dmitriy Novozhilov
be18cb1cb7 Don't run fir tests in :miscCompilerTest configuration
This is fine because FIR is not released, we don't track
  correctness of it in 1.5.0 release branch and there are
  no clients of FIR
2021-02-20 16:45:21 +03:00
Dmitriy Novozhilov
6a0e9d5d38 Fix FIR testdata 2021-02-20 16:18:48 +03:00
Dmitry Petrov
11c154226f JVM_IR indy-SAM: KT-45069 box lambda 'Unit' return type if needed 2021-02-20 13:46:19 +03:00
Ilya Goncharov
99fdcc647a [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed

(cherry picked from commit bd2601f289)
2021-02-20 12:10:56 +03:00
Sergey Bogolepov
fe89c8d64e Support for macos_arm64 target in backend
(cherry picked from commit 06498c0efd)
2021-02-20 13:56:04 +07:00
Aleksei.Cherepanov
12b984e53d Add synchronization to MultiClassFiles maps
(cherry picked from commit d0eeb0535d)
2021-02-19 23:59:13 +03:00
Aleksei.Cherepanov
ef3c73554f JPS: Fix JvmMultifileClass processing for IR backend
#KT-44644 Fixed

(cherry picked from commit aa683d3b2a)
2021-02-19 23:59:11 +03:00
Alexander Udalov
ff0f0def59 JVM IR: do not generate invokeinterface hashCode if smart cast is present
#KT-45008 Fixed

(cherry picked from commit 56f9e3360f)
2021-02-19 14:22:15 +01:00
Dmitriy Novozhilov
b328532356 [FE] Assume that effective visibility of sealed class constructor is internal
#KT-45033 Fixed
#KT-45043
2021-02-19 14:10:16 +03:00
Dmitry Petrov
ce9381cfa4 JVM_IR indy-SAM: function reference to Java interface 2021-02-19 10:27:55 +03:00
Dmitry Petrov
9abfc6bc1c Minor: regenerate tests 2021-02-19 09:29:41 +03:00
Dmitry Petrov
22689c28d3 PSI2IR KT-45022 object in LHS of compound assignment
(cherry picked from commit 744a0fcd25)
2021-02-19 09:29:41 +03:00
Vladimir Dolzhenko
f89ebbe5d2 Report highlight errors to WolfTheProblemSolver
Relates to #KT-37702
#KTIJ-1246 Fixed

Original commit: bd222a5255c2fd6f4abfce3115f81733ef9a39f3

(cherry picked from commit 8783ebc352)
2021-02-19 06:49:55 +01:00
Ilmir Usmanov
8aedf23deb Use erased upper bound instead of checking for inline type 2021-02-18 18:38:15 +01:00
Ilmir Usmanov
a147080ac1 JVM_IR: IC: Unbox inline class argument of callable reference
if it is unbound and the underlying type is reference type.
If the underlying type is primitive, it is boxed and unboxed
correctly, otherwise, it is simply casted and not unboxed.
Additionally, generate functions for inliner with inline classes
in signature, so unboxing works.
The unboxing is removed after inlining.
 #KT-44722 Fixed
2021-02-18 18:38:12 +01:00
Victor Petukhov
65a490eefc KotlinBinaryClassCache: clean-up request caches for all threads
^KT-44550 Fixed

(cherry picked from commit ad9fd7ecf3)
2021-02-18 17:07:37 +03:00
Alexander Udalov
28fb718529 Update JVM metadata version to 1.5.0
Improve the test which checks that we use correct metadata version if
`-language-version` is passed by checking all supported language
versions.

The change in libraries/reflect/build.gradle.kts is needed because
kotlinx-metadata-jvm of version 0.1.0 is based on pre-1.4 Kotlin, which
doesn't support the new module file metadata generated with metadata
version 1.4 and later, and module files need to be readable there to be
able to transform them for the shadow plugin.

Similarly override dependency on kotlinx-metadata-jvm in the
binary-compatibility-validator module.

(cherry picked from commit 8c95b78346)
2021-02-18 12:42:50 +01:00
Mikhael Bogdanov
9bbd6ccb87 Fix test data 2021-02-18 07:23:50 +01:00
Dmitry Petrov
3361526e4a JVM_IR indy-SAM on functional expression
(cherry picked from commit 6d019d9544)
2021-02-18 09:11:18 +03:00
Alexander Udalov
9faf83899d JVM IR: write inherited multifile parts flag to kotlin.Metadata
This flag is unused at the moment, but might be used one day to support
proper incremental compilation for multifile classes.

(cherry picked from commit adb05ab076)
2021-02-17 21:56:36 +01:00
Mikhael Bogdanov
fcc1e7f54c Support Unit/V types in string-concat indy calls
unitComponent.kt test fails with JVM target 9+

(cherry picked from commit 134fda8bad)
2021-02-17 18:47:22 +01:00
Mikhael Bogdanov
2cbad94c09 Make indy-with-constants default for -jvm-target 9+
#KT-42522 Fixed

(cherry picked from commit e3e7e6b740)
2021-02-17 18:47:21 +01:00
Mikhael Bogdanov
46c11d1f85 Fail on compilation errors in AbstractBytecodeTextTest
(cherry picked from commit 3d8e8dd3ba)
2021-02-17 18:47:21 +01:00
Mikhael Bogdanov
786b405ed6 Support new targets in KotlinBytecodeToolWindow
#KT-30222 Fixed

(cherry picked from commit 61fce74b76)
2021-02-17 18:45:17 +01:00
Alexander Udalov
bb30ac2a04 Minor, add workaround for KT-45008
(cherry picked from commit 67e91b7ebd)
2021-02-17 16:40:04 +01:00
Dmitriy Novozhilov
94ecbbf8f7 [FE] Change message for sealed interfaces with language target < 1.5 2021-02-17 16:45:12 +03:00
Dmitriy Novozhilov
650e031aca [FE] Prohibit sealed fun interfaces 2021-02-17 16:45:11 +03:00
Alexander Udalov
031bc484ab Support structural equals/hashCode for type constructors of type parameters
Use the same logic as for type constructors of classes, based on the
fully-qualified name of the classifier, with special cases for error
types and local declarations, with an additional check that the type
constructors' declaration descriptors are structurally equal via
`DescriptorEquivalenceForOverrides`. The latter is required because type
parameters of overloaded functions must be different, even though their
full FQ name is the same.

This (hopefully) has no effect for the compiler, but is useful for
kotlin-reflect where `KType.equals` runs the type checker on the
underlying `KotlinType` instances, which eventually ends up comparing
type constructors. Descriptors and types in kotlin-reflect are cached on
soft references, so they may be suddenly garbage-collected and
recomputed, and we want copies of the same type parameter to be equal to
each other.

This fixes flaky codegen tests which started to fail after migration to
the new test infrastructure, where tests are now run in parallel in the
same process, thus with higher memory pressure and more soft references
being GC'd:

* `codegen/box/reflection/types/createType/typeParameter.kt`
* `codegen/box/reflection/supertypes/genericSubstitution.kt`

Also, add a new test to check that we do the instanceof check in
overrides of `AbstractTypeConstructor.isSameClassifier`.

 #KT-44850 Fixed

(cherry picked from commit 4d9cffccf2)
2021-02-17 14:41:58 +01:00
Alexander Udalov
db70ca4a69 Tests: compute runtime classpath for JVM box tests manually
Taking just the `jvmClasspathRoots` is not correct because it also
contains stuff needed for resolve to work correctly, such as JDK (full
or mock), stdlib (full or mock), reflect. JDK is obviously not needed in
the classpath, and stdlib/reflect are available via the parent class
loader, which is specifically reused across all tests to make them run
faster.

Also, don't try to create class loader for Java-only modules in
`JvmBoxRunner.processModule`. This happens, for example, for all tests
which were moved from `boxAgainstJava`.

(cherry picked from commit aaecb87d1b)
2021-02-17 14:41:57 +01:00
pyos
8b9867f2fb JVM: rename this$0 when regenerating nested objects too
In the old backend, this was unnecessary because nested objects would
reference their lambdas' captures through the original this$0. On
JVM_IR, using loose capture fields means a name/descriptor clash can
occur on any level of nesting, not just the top.

(cherry picked from commit 1310a65f0c)
2021-02-17 12:12:41 +01:00
Ilmir Usmanov
68d16d39dd Minor. Suppress errors in tests 2021-02-16 21:00:37 +01:00
Ilmir Usmanov
7ff2ad94d2 Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error 2021-02-16 21:00:35 +01:00
Dmitry Petrov
252556d91a JVM_IR KT-44974 fix SAM-converted capturing extension lambda 2021-02-16 18:13:15 +03:00
Vladimir Dolzhenko
f47eac03b3 Fix NPE
#KTIJ-898 Fixed

Original commit: 12d8e88b846f29598ca3904b49996bd6a9891ccd

(cherry picked from commit 6352814d45)
2021-02-16 15:45:11 +01:00
Vladimir Dolzhenko
d667c2f8b9 Fixed NPE on StandaloneScriptRootsCache instantiation
Relates to ^EA-218043
#KTIJ-1137 Fixed

Original commit: 1d63a1b48d480b958ff44676c42b698a8ca5f64a

(cherry picked from commit 98ba379e07)
2021-02-16 15:43:59 +01:00
Victor Petukhov
9f4cd75e43 [all-open] Don't affect private declarations to change their modality to open 2021-02-16 17:01:15 +03:00
Victor Petukhov
20e82953d7 [all-open] Fix formatting 2021-02-16 17:01:15 +03:00
SokolovaMaria
d71d57a9e7 Copy typeParameters from original declaration to the exportedDefaultStubFun before substitution of type parameters 2021-02-16 00:20:33 +03:00
Dmitry Petrov
2b1148448e JVM_IR KT-44483 argument adaptation is already done in PSI2IR
(cherry picked from commit b1ab64e854)
2021-02-15 21:08:36 +03:00
Dmitry Petrov
f83860a135 JVM_IR KT-44627 fix bridge signature for parameter with primitive bound
(cherry picked from commit b262d09a81)
2021-02-15 19:26:04 +03:00
Alexander Udalov
7f991305e6 Remove kotlin-annotations-android
#KT-44815 Fixed

(cherry picked from commit 6e7a9441a6261d29e5cb59e43965ccbf00a6156b)
2021-02-15 17:23:10 +01:00
Alexander Udalov
c79ba4448c Remove tests on kotlin-annotations-android
#KT-44815

(cherry picked from commit e9985d86e6e48625743aedb93f5cd18cf3882eb8)
2021-02-15 17:23:07 +01:00
Alexander Udalov
c15c593136 Remove compiler support for kotlin-annotations-android
#KT-44815

(cherry picked from commit d4e2bca029648af116f59f79494631efc7c8cd1b)
2021-02-15 17:23:01 +01:00
Mikhail Glukhikh
020cd45050 FIR2IR: support adapted references for constructors
(cherry picked from commit fa0f967c83)
2021-02-15 19:18:56 +03:00
Mikhail Glukhikh
2da4a4ea6b FIR2IR: use information about callable reference adaptation from resolve
(cherry picked from commit 8bab208322)
2021-02-15 19:18:48 +03:00
Victor Petukhov
6d2be950a3 Fix FIR test lambdaParameterTypeInElvis
(cherry picked from commit fa1507fb91)
2021-02-15 18:52:53 +03:00
Andrei Klunnyi
dad762eb61 KT-44839 [Sealed interfaces]: restore move-tests for lang-version < 15
This commit restores tests removed in 690fb47c.
2021-02-15 16:31:46 +01:00
Andrei Klunnyi
09b239f4b9 KT-44839 [Sealed interfaces]: ability to specify compiler options in tests 2021-02-15 16:31:46 +01:00
Andrei Klunnyi
9c6238ff03 KT-44839 [Sealed interfaces]: move refactoring for language level < 1.5
This commit restores sealed-check-logic for language level < 1.5
mistakenly removed in 690fb47c.

^KT-44839 fixed
2021-02-15 16:31:45 +01:00
Dmitriy Novozhilov
aaf6494faa [FIR] Ignore failing FIR tests related to sealed classes 2021-02-15 17:21:01 +03:00
Dmitriy Novozhilov
bc23b04d16 [FE] Allow declaring protected constructors in sealed classes
#KT-44865 Fixed
2021-02-15 17:21:01 +03:00
Dmitriy Novozhilov
a843800b2a [FE] Make constructors of sealed classes protected instead of internal 2021-02-15 17:21:01 +03:00
Victor Petukhov
62ef7f65dd Don't fix type variables into Nothing in priority way
^KT-44546 Fixed
2021-02-15 15:09:30 +03:00
Victor Petukhov
87f5cedf7f Fix FIR test lambdaParameterTypeInElvis 2021-02-15 12:56:38 +03:00
Yaroslav Chernyshev
95c2762432 [Cocoapods] Fail import if project's version wasn't specified
#Fixed KT-44000
2021-02-15 12:41:17 +03:00
Vladimir Dolzhenko
315190cc1b Lightweight hashCode calc for LibraryInfo
#EA-6040509 Fixed
#KTIJ-696 Fixed

(cherry picked from commit bf9fa4c9da)
2021-02-15 10:39:53 +01:00
Victor Petukhov
355ae07667 Reformat TypeWithEnhancement.kt 2021-02-15 12:15:08 +03:00
Victor Petukhov
13a97b56c1 Add reporting of the warnings based on Java annotations for expanded type aliases
Before that, such warnings weren't reported as the corresponding errors were reported during type inference (only original types took part there)
2021-02-15 12:15:05 +03:00
Victor Petukhov
7857230aa5 Use upper bound checker for typealias expansion 2021-02-15 12:15:03 +03:00
Victor Petukhov
f939fdc154 Add test for errors reporting of UPPER_BOUND_VIOLATED 2021-02-15 12:15:00 +03:00
Victor Petukhov
53bc498da4 Report warnings or errors for violated type parameter's upper bounds from Java annotated with nullability annotations
^KT-43262 Fixed
2021-02-15 12:14:56 +03:00
Victor Petukhov
0d50b13a2c Propagate inference session into declaration analyzers
It prevents missing inference session for local declaration (local functions, local classes or objects)

^KT-44801 Fixed
2021-02-15 11:14:06 +03:00
Victor Petukhov
9f69fe86a0 Remove redundant extension receiver substitution during lambda's completion 2021-02-15 11:14:05 +03:00
Victor Petukhov
918c5e7d4f Clear request cache properly during disposing component 2021-02-15 11:14:04 +03:00
Dmitry Petrov
2375817c1d Minor: regenerate tests after cherry-pick 2021-02-12 20:34:26 +03:00
Dmitry Petrov
e4130cd12f JVM don't use indy by default for SAM conversions (wait for KT-44844)
KT-44278 KT-26060 KT-42621

(cherry picked from commit 6ba57abb8f)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
4d66d2ab98 JVM_IR nullability assertions test for indy lambdas
KT-44278 KT-26060 KT-42621

(cherry picked from commit 5013344bc4)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
6c514ac028 JVM_IR indy: minor: use toLowerCaseAsciiOnly for options
KT-44278 KT-26060 KT-42621

(cherry picked from commit 4ab242ed51)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
99a3979b27 JVM_IR indy: fix non-null assertions on indy lambda parameters
KT-44278 KT-26060 KT-42621

(cherry picked from commit afeb7e18cd)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
19c742a0c2 JVM_IR indy: extract LambdaMetafactoryArguments code to separate file
KT-44278 KT-26060 KT-42621

(cherry picked from commit 43b1711010)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
c9258f5c40 JVM_IR indy: use 'CLASS' mode in SAM bytecode listing tests
KT-44278 KT-26060 KT-42621

(cherry picked from commit 3438d19c22)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
0ac096c108 JVM SamWrapperClassesAreSynthetic language feature
KT-44278 KT-26060 KT-42621

(cherry picked from commit 7564c9bb8c)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
544285aaea JVM_IR indy SAM conversions: update tests
KT-44278 KT-26060 KT-42621

(cherry picked from commit 052f6929c9)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
ccb8385b36 JVM_IR: use indy SAM conversions in jvmTarget 1.8+, fix bridges
KT-44278 KT-26060 KT-42621

(cherry picked from commit 3ebeca5852)
2021-02-12 20:34:23 +03:00
Dmitry Petrov
05423910d2 Minor: LAMBDAS directive in old back-end tests
(cherry picked from commit 2535e5d5c9)
2021-02-12 20:34:23 +03:00
Dmitry Petrov
49a0bee762 JVM_IR indy-lambdas: minor updates and fixes
KT-44278 KT-26060 KT-42621

(cherry picked from commit ab20a8ffff)
2021-02-12 20:34:23 +03:00
Dmitry Petrov
06cf09f91d JVM_IR indy-lambdas: don't use indy for big arity lambdas
KT-44278 KT-26060 KT-42621

(cherry picked from commit 088448043a)
2021-02-12 20:34:22 +03:00
Dmitry Petrov
cdf2f853aa JVM_IR indy-lambdas: initial implementation and tests
KT-44278 KT-26060 KT-42621

(cherry picked from commit d94912ed62)
2021-02-12 20:34:22 +03:00
Sergey Igushkin
99f2194af6 Fix extracted metadata for IDE erased when scopes conflict, KT-44845
The root cause was that extractors for different scopes used the same
base directory, and each erased its contents. Using different base dirs
fixes the issue.

Issue #KT-44845

(cherry picked from commit a719656118)
2021-02-12 19:00:07 +03:00
Mikhael Bogdanov
609e355d55 Generate proper hashCode for fun interface wrappers
#KT-44875 Fixed

(cherry picked from commit e795c2c407)
2021-02-12 11:38:26 +01:00
Dmitriy Novozhilov
e7f5df1423 fixup! [Test] Make some functions of environment configurators public 2021-02-11 16:29:41 +03:00
Dmitriy Novozhilov
ed5f40ab83 [Test] Move extracting JVM_TARGET to provideConfigurationKeys 2021-02-11 16:23:45 +03:00
Dmitriy Novozhilov
7de2eeaad5 [Test] Replace remaining KOTLIN_CONFIGURATION_FLAGS directives with specific ones 2021-02-11 16:23:42 +03:00
Dmitriy Novozhilov
6517f1d389 Parse compiler configuration for android tests using new test infrastructure 2021-02-11 16:23:02 +03:00
Dmitriy Novozhilov
b5d24f38bc Add analysisFlags of LanguageVersionSettings to toString() method 2021-02-11 16:23:02 +03:00
Dmitriy Novozhilov
662f209862 [Test] Make some functions of environment configurators public
This is needed for using those methods from android tests
2021-02-11 16:23:02 +03:00
Dmitriy Novozhilov
daea75908b [Test] Cleanup JvmEnvironmentConfigurator 2021-02-11 16:23:01 +03:00
Dmitriy Novozhilov
3a9e75b162 [Test] Don't pass MockProject to environment configurators 2021-02-11 16:23:01 +03:00
Alexander Udalov
fe27514e62 Move around some codegen box tests
In tests merged from boxAgainstJava in 29b96aa1, some directories were
named slightly differently compared to box, e.g. "property" vs
"properties", "varargs" vs "vararg". This change renames these, moves
some of the tests to more fitting directories, and also renames
"visibility" to "javaVisibility" because it's about Java visibilities
specifically.

(cherry picked from commit 510b9e6f2a)
2021-02-11 14:18:01 +01:00
Alexander Udalov
1000eaedba Remove codegen tests on old language and API versions
(cherry picked from commit 2d60fa787d)
2021-02-11 14:16:50 +01:00
Alexander Udalov
2a773e1f8a Use TARGET_BACKEND instead of DONT_TARGET_EXACT_BACKEND in box against Java tests
"// TARGET_BACKEND: JVM" more clearly says that the test is
JVM-specific, rather than DONT_TARGET_EXACT_BACKEND which excludes all
other backends.

(cherry picked from commit 401f0ac583)
2021-02-11 14:16:46 +01:00
Mikhail Glukhikh
a7c4d13619 Skip JDK 6 in failing BB test (java.util.function in use)
(cherry picked from commit 57e06992c9)
2021-02-11 15:01:05 +03:00
Mikhail Glukhikh
bf045e3a04 FIR2IR: fix raw SAM conversion (avoid * in type arguments)
(cherry picked from commit cd483ad231)
2021-02-11 15:00:41 +03:00
Mikhail Glukhikh
a560f431b4 FIR2IR: expand type before getting nullability #KT-44803 Fixed
(cherry picked from commit 5f3102bf2f)
2021-02-11 14:58:06 +03:00
Mikhail Glukhikh
cbb06a0856 FIR2IR: enhance approximation of captured types
(cherry picked from commit 4bc630d82c)
2021-02-11 14:58:00 +03:00
Mikhail Glukhikh
bf32cdc1f2 FIR2IR: support substitution for SAM types
(cherry picked from commit 346ffb3acf)
2021-02-11 14:57:54 +03:00
Mikhail Glukhikh
745043c466 FIR2IR: use invariant projections for SAM_CONVERSION types
(cherry picked from commit 7050af9b79)
2021-02-11 14:57:48 +03:00
Dmitry Gridin
edecafd887 [i18n] copy-paste message from RefactoringBundle to fix missing resource in 202
^KT-44675 Fixed

(cherry picked from commit b9c33a0c6e)
2021-02-11 18:34:08 +07:00
Alexander Udalov
b27dd8e3fe Apply illegal-access=permit workaround for JDK 16+
Apparently, the openjdk commit that enabled JEP 396 (encapsulated JDK
defaults) is effective since jdk-16+28:

https://github.com/openjdk/jdk/commit/ed4c4ee7

(cherry picked from commit 80daf120e6)
2021-02-11 12:13:21 +01:00
Dmitriy Novozhilov
ccffa1a8bf [FE] Don't analyze members with CLASSIFIERS kind filter in AbstractLazyMemberScope
This commit introduces partial support of descriptorKindFilter in
  `AbstractPsiBasedDeclarationProvider`. Without it there may be an error
  in following case:

```
sealed class Base
class Derived : Base()

class Test<out V>(val x: Base) {
    private val y = when (x) {
        is Derived -> null
    }
}
```

Here we start to resolve type of `y`, then go to computation of inheritors
  of sealed class Base, which also may be inside Test, so we need get all
  nested classifiers in Test. But without this filtration we will start
  computing descriptor for `y` again, which leads to ReenteringLazyComputationException

#KT-44316 Fixed
2021-02-11 13:27:41 +03:00
Victor Petukhov
72409bfef9 Substitute captured types with inner intersection one (NewTypeSubstitutor)
^KT-44651 Fixed
2021-02-11 12:40:44 +03:00
Roman Artemev
d35f31de68 [Plugin API] Fix missed call in resolveBySignatureInModule 2021-02-11 11:56:29 +03:00
Ilya Gorbunov
1a5c5bc2f5 Remove kotlin-test-multiplatform special dependency handling
#KT-40225

(cherry picked from commit af8061a4dd)
2021-02-10 22:02:23 +03:00
Ilya Gorbunov
a4f188615b Remove obsolete diagnostics suppression
The diagnostic NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS is now
obsolete because internal constructors of inline classes became allowed.

(cherry picked from commit 87e130e77a)
2021-02-10 22:02:20 +03:00
Yaroslav Chernyshev
155c814a4a Mark obsolete Gradle JVM options as Deprecated with Error
Options `includeRuntime`, `noStdlib` and `noReflect` were affected
#Fixed KT-44361

(cherry picked from commit 17fc10a8af)
2021-02-10 21:23:20 +03:00
Pavel Kirpichenkov
796d7274e6 Split combined test into two to avoid flaky behaviour
Prevent simultaneous access to the library directory
2021-02-10 15:19:48 +03:00
Yahor Berdnikau
c163bdded3 Fix KaptWithoutKotlincTask task tries to get wrong properties. 2021-02-10 12:23:59 +01:00
Alexander Udalov
b857f46533 CLI: include META-INF/services/ from kotlin-reflect with -include-runtime
This is an addition to bd205317aa where we
started to add the contents of kotlin-reflect into the resulting jar if
-include-runtime is specified. Apparently kotlin-reflect doesn't work
without some services in META-INF/services/, which didn't satisfy the
condition for inclusion. The existing test didn't catch that because
loading class annotations does not always lead to those services being
loaded.

(cherry picked from commit e6588ee8a4)
2021-02-10 12:06:34 +01:00
Andrei Klunnyi
5e91b4eaab Compilation fix for KT-44487 2021-02-10 11:41:32 +01:00
Dmitry Petrov
162356f99b JVM_IR KT-44798 don't generate multiple stubs with same signature
(cherry picked from commit d0f26abd18)
2021-02-10 11:53:52 +03:00
Ilya Chernikov
f40e815e28 Implement forced script configuration reloading API for plugins
#KT-43288 fixed
2021-02-10 08:29:31 +01:00
Ilya Chernikov
4f38e08c39 Pass provided script configuration to refining code
when script compilation configuration refinement
happening during parsing, the updated configuration
passed to the script compiler/REPL compile function
is now used.
#KT-44580 fixed

(cherry picked from commit ef4fa3381d)
2021-02-10 08:29:13 +01:00
Ilya Chernikov
2ef1d9c542 [minor] fix warnings in the script compiler and tests 2021-02-10 08:29:06 +01:00
Vladimir Dolzhenko
ecf0c6ce15 Make checker tests independent of plugin version
Relates to #KT-37702 #KTI-433
2021-02-09 22:07:48 +01:00
Roman Artemev
25432bd33a [Plugin API] Add API to load top level declaration by its signature
- request from JP Compose, #KT-44100

(cherry picked from commit d97a2b13c0)
2021-02-09 19:49:24 +03:00
Roman Artemev
f13342a362 [IR] Fix IrType equality in case of complex variance
- reimplement type capturing on top of pure IrCaptureType
 - add captured type substitutor
 - fix #KT-43831

(cherry picked from commit 79f986bb75)
2021-02-09 19:49:24 +03:00
Roman Artemev
3762321406 [IR] Add IrCapturedType into IR type system
- support it in TypeSystemContext

(cherry picked from commit 4ed93d3dee)
2021-02-09 19:49:24 +03:00
Andrei Klunnyi
521c23cc02 KT-44487 [Sealed Interfaces]: sealed-inheritors-provider for MPP
(cherry picked from commit e3c1aa599d)
2021-02-09 13:59:08 +01:00
Svyatoslav Scherbina
787124cb06 Update Kotlin/Native: 1.5-M1-eap-19 2021-02-09 15:46:17 +03:00
Ilmir Usmanov
0f75a4edc3 Minor. Ignore test on WASM 2021-02-09 12:31:52 +01:00
Ilmir Usmanov
74ae3219f3 JVM_IR. Do not mangle callable reference constructor call
#KT-44703 Fixed
2021-02-09 12:31:49 +01:00
Ilya Goncharov
b65accec4e [JS IR] Add test with chain export--not-export--export
^KT-44616 fixed

(cherry picked from commit 19bffc694b)
2021-02-08 14:24:32 +03:00
Ilya Goncharov
81de9f851f [JS IR] Method of any is exported
^KT-44616 fixed

(cherry picked from commit 76b124a9c0)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
66bb5cdc6e [JS IR] Add exported method into exportNestedClass.kt
^KT-44616 fixed

(cherry picked from commit 7b4624aac4)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
110f278d5e [JS IR] Override method are not exported
[JS IR] Add test with jsexport overrides not js export method with stable name

^KT-44616 fixed

(cherry picked from commit 6c051b2be4)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
832d21fbdd [JS IR] Add test with fun interface call inside lambda
^KT-44433 fixed

(cherry picked from commit de3678a805)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
30d9fafbc4 [JS IR] Use local scope for SAM if there are scopes
[JS IR] Use private for top level sam wrappers and local otherwise

^KT-44433 fixed

(cherry picked from commit d6e74b9620)
2021-02-08 13:57:04 +03:00
Victor Petukhov
ed20e2851c Report error about uninferred type parameter for all CallForImplicitInvoke psi calls
^KT-44368 Fixed
2021-02-08 10:41:53 +03:00
Yan Zhulanow
974654ec34 Remove unneeded artifacts for Kotlin IDE plugin
(cherry picked from commit 0d1f493b6c)
2021-02-05 16:04:06 +09:00
Ilmir Usmanov
ba786f5a46 JVM_IR. Do not unbox Result in inline lambda
Since JVM_IR generates inline lambdas differently from old backend,
in this case, it generates them as normal functions.
Thus, there is no need to unbox the lambda argument.
 #KT-44671 Fixed
2021-02-04 20:23:53 +01:00
Alexander Udalov
48592ec112 Do not create Array instance in kotlin-reflect where not necessary
Although the previous code of computing JVM internal name from a Class
instance was shorter, it led to unnecessary creation of array types,
which is less performant and makes configuration of kotlin-reflect for
GraalVM native-image more verbose.

Unfortunately I didn't succeed in writing a test for this, since
`Array.newInstance` calls a native method which doesn't record any trace
of it being called in the class loader: the resulting array type never
goes through findClass/loadClass, and is not visible via
findLoadedClass.

 #KT-44594 Fixed

(cherry picked from commit fb296b5b95)
2021-02-04 19:15:21 +01:00
Dmitriy Novozhilov
665a25f637 [Test] Print bytecode if DxCheckerHandler had failed 2021-02-04 11:15:11 +03:00
Dmitriy Novozhilov
c111f90251 [Test] Ignore multimodule tests in AbstractLightAnalysisModeTest 2021-02-04 11:15:11 +03:00
Dmitriy Novozhilov
da4bc74da3 [Test] Properly merge box against java testdata into codegen/box
Previous commit about it was 3199ce03 and it was completely wrong
2021-02-04 11:15:10 +03:00
Dmitriy Novozhilov
935f3b7659 [Test] Support different backends enumeration in DONT_TARGET_EXACT_BACKEND directive 2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
dcba27c3a8 [TD] Fix directive order in codegen testdata
(cherry picked from commit 4bf6e58f2b)
2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
1a68073292 [Test] Support new configuration directives in old codegen tests
(cherry picked from commit 571c4ce398)
2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
df0c050e4b [Test] Exclude multimodule tests from codegen tests on android
(cherry picked from commit 0ebb39a26e)
2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
4a0cb0aa5c [Test] Support skip of android codegen tests with new ASSERTION_MODE directive
(cherry picked from commit 17d59e0daa)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
1c1d41c864 [Test] Use javac for compilation test java files from runtime by default
(cherry picked from commit 81ba7aa833)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
3004b39304 [Build] Extract configuration of JUnit5 dependencies to common helper in buildSrc
(cherry picked from commit c432efc364)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
e77ad7f44f [Test] Add ability to stop test pipeline if there was an exception in handler
(cherry picked from commit dea3c954f1)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
06334aac59 [Test] Move fir backend tests back to :compiler:fir2ir module
(cherry picked from commit 2ae35b0b08)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
734495e9bf [Test] Don't generate extends clause for nested classes in generated tests for JUnit5
This is fine since all nested classes in tests are inners by JUnit5
  specification, so they will see `runTest` method from outer root class

(cherry picked from commit e79d02f482)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
98e23f4955 [Test] Migrate :tests-different-jdk on runners which are using JUnit5
(cherry picked from commit a4e9ab90a0)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
d9e2827e4c [Test] Set static field with application to null after tests are completed
(cherry picked from commit c969a34644)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
979bb3f67a [Test] Don't use PSI based class reading in codegen BB tests
#KT-34826 is rela ted

(cherry picked from commit 53e5aa4364)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
e7667b5397 [Test] Support various jdk targets in test infrastructure
(cherry picked from commit 09ec3f6eaf)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
3fafb2e9df [Test] Read default target version from sys property in new test infra
(cherry picked from commit 93741ced5c)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
22688b804f [Test] Support invoking box method in BB tests in separate process
(cherry picked from commit a3ad626f99)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
ba02081ebb [Test] Regenerate spec tests
(cherry picked from commit b351ca6bd4)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
ecf9fd0b8b [Test] Merge box against java testdata into codegen black box testsdata
(cherry picked from commit 3199ce03a6)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
98a31448c5 [TD] Ignore JS backends in boxAgainstJava tests
(cherry picked from commit e62b118351)
2021-02-04 11:07:45 +03:00
Dmitriy Novozhilov
465909f8c0 [Test] Merge box against java tests into codegen black box tests
(cherry picked from commit 99cb85ab00)
2021-02-04 11:07:43 +03:00
Dmitriy Novozhilov
232c260c9a [Test] Migrate AbstractIrCompileKotlinAgainstKotlinTest to new infrastructure
(cherry picked from commit 6f3713af5f)
2021-02-04 11:05:40 +03:00
Dmitriy Novozhilov
ebd8a9ea82 [Test] Enable SMAP dump handler in boxInline tests
(cherry picked from commit 49c2bfe637)
2021-02-04 11:05:40 +03:00
Dmitriy Novozhilov
69097dd444 [TD] Update testdata according to previous commit
(cherry picked from commit 64a300bfcd)
2021-02-04 11:05:40 +03:00
Dmitriy Novozhilov
1c5e61fb32 [Test] Migrate all jvm tests runners for boxInline tests
(cherry picked from commit 3a0eee64b8)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
f675081405 [TD] Update fir directives in boxInline tests
(cherry picked from commit 8973e3f362)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
0a3839c109 [Test] Implement SMAP dump handler
(cherry picked from commit 92e21e76ba)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
32f2d4939a [Test] Align lines in TestFile with lines in real testdata file
(cherry picked from commit e3ab3d6be3)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
620e823cc1 [Test] Introduce two module structure transformers for codegen test
(cherry picked from commit 60e0831c11)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
de7aade158 [Test] Add ability to freely transform module structure which was parsed from directive
Service ModuleStructureExtractor may break readabilty of test so it
  should be used very carefully

Originally it is created for box inline test where we have different
  runners on same testdata where one runner assumes that all files
  in test in same module and other that they in different ones

(cherry picked from commit 13a778fd9c)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
f7abb0b5c2 [Test] Support USE_OLD_INLINE_CLASSES_MANGLING_SCHEME directive
(cherry picked from commit fc83dc17fe)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
4efa634f37 [Test] Make BytecodeInliningHandler for new infrastructure
(cherry picked from commit 3f758a3fa2)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
db9bf8428d [TD] Fix friend modules
(cherry picked from commit 0768a7089c)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
2b297ccd7a [TD] Update directives in kotlinAgainstKotlin testdata
(cherry picked from commit 5075484c8e)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
8c18d88e61 [Test] Improve error reporting if there are too many values passed to directive
(cherry picked from commit 9ba41c5b88)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
ecfc1493d0 [Test] Move KotlinAgainstKotlin tests under BlackBoxCodegen tests
(cherry picked from commit 5c8d555808)
2021-02-04 11:05:37 +03:00
Dmitriy Novozhilov
64ccd3213c [Test] Support skip of android codegen tests with new ASSERTION_MODE directive
(cherry picked from commit f255f93ad9)
2021-02-04 11:05:37 +03:00
Alexander Udalov
4f0fc39c45 Do not generate $suspendImpl for JvmDefault functions in interfaces
#KT-44533 Fixed

(cherry picked from commit acd8c4503b)
2021-02-03 21:46:01 +01:00
Ilmir Usmanov
84076a11da JVM_IR: Box generic Result parameter in suspend lambda
#KT-44527 Fixed
2021-02-03 20:37:26 +01:00
Ilmir Usmanov
b73321b580 Minor. Throw exceptions in test coroutine builders 2021-02-03 20:37:24 +01:00
Dmitriy Dolovov
d8aafc0243 [Commonizer] Dump every module to disk immediately when it's ready
No need to retain all metadata modules in memory -> lesser memory consumption.
2021-02-03 20:43:56 +03:00
Ivan Gavrilovic
7b83677da5 Locate build history when file is outside of root project dir
Support use-cases when the build dir is outside of root project dir.
Many projects set up output dir as <root_project>/../out/<project_name>/build
to be able to clean build dir more easily. This commit adds support
to build history file detection and it tries to find build history
files for artifacts that are:
- under root project dir (a default structure)
- under root project's build dir parent (to support typical custom setup)

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

Test: BaseIncrementalCompilationMultiProjectIT
(cherry picked from commit 2fce6a4af9)
2021-02-03 15:22:27 +03:00
Alexander Udalov
449f9b1dfa Add -Xsuppress-deprecated-jvm-target-warning to modules compiled with 1.6
Currently this leads to an unknown argument warning, but it'll be
removed automatically on the next bootstrap.

(cherry picked from commit e0b6d4d917)
2021-02-03 12:54:10 +01:00
Alexander Udalov
632cfa7312 Deprecate JVM target 1.6
#KT-44650 Fixed

(cherry picked from commit 99b5e5a373)
2021-02-03 12:53:58 +01:00
Andrei Klunnyi
e407f4cff3 KT-44079 [Sealed Interfaces]: move refactoring update
The idea behind this commit is that Move Refactoring should warn
developers in case their intention potentially breaks sealed
hierarchies (members must share the same module and package).

Provided algorithm has two goals:
- prevent destruction of correct hierarchies
- help in fixing broken ones

^KT-44079 fixed
2021-02-03 12:04:58 +01:00
Dmitriy Dolovov
9e00b483bb [Commonizer] Force GC after each serialized target 2021-02-03 10:57:31 +03:00
Dmitriy Dolovov
347fd1e3c1 [Commonizer] Minor. Post-review changes, p.2 2021-02-03 10:57:30 +03:00
Dmitriy Dolovov
08dde21f02 [Commonizer] Minor. Post-review changes 2021-02-03 10:57:30 +03:00
Dmitriy Dolovov
e62eacce71 [Commonizer] Add tests for CommonizerTarget 2021-02-03 10:57:29 +03:00
Dmitriy Dolovov
900b15468b [Commonizer] Use kotlin/Any as the default supertype for commonized class 2021-02-03 10:57:28 +03:00
Dmitriy Dolovov
2734829513 [Commonizer] Dump every target to disk immediately when it's ready 2021-02-03 10:57:27 +03:00
Dmitriy Dolovov
5a43e1dcd3 [Commonizer] Ignore acceptable (minor) metadata mismatches in tests 2021-02-03 10:57:26 +03:00
Dmitriy Dolovov
f5553eef3e [Commonizer] Fix calculation of type parameter IDs for nested classes and their members 2021-02-03 10:57:26 +03:00
Dmitriy Dolovov
630f86d264 [Commonizer] Ignore constructors for enum entries 2021-02-03 10:57:25 +03:00
Dmitriy Dolovov
575ccab8b8 [Commonizer] Don't serialize kotlin/Any? as the single type parameter upper bound 2021-02-03 10:57:24 +03:00
Dmitriy Dolovov
c4c631f6e5 [Commonizer] Don't write IS_EXPECT flag for synthesized expect functions 2021-02-03 10:57:23 +03:00
Dmitriy Dolovov
a852608363 [Commonizer] Fix HAS_ANNOTATIONS flag calculation for serialized classes 2021-02-03 10:57:23 +03:00
Dmitriy Dolovov
49e96b11f8 [Commonizer] Minor. Improved diagnostics message in tests 2021-02-03 10:57:22 +03:00
Dmitriy Dolovov
1acdadf15e [Commonizer] Fix property backing/delegate field annotations serialization 2021-02-03 10:57:21 +03:00
Dmitriy Dolovov
5217bd1797 [Commonizer] Don't commonize built-ins 2021-02-03 10:57:20 +03:00
Dmitriy Dolovov
8feea385d5 [Commonizer] Drop descriptors for commonized declarations 2021-02-03 10:57:19 +03:00
Dmitriy Dolovov
5303713153 [Commonizer] Rework test infrastructure to compare metadata instead of descriptors 2021-02-03 10:57:19 +03:00
Dmitriy Dolovov
f0ec8c6e65 [Commonizer] Pretty target name output in console 2021-02-03 10:57:18 +03:00
Dmitriy Dolovov
e6412d6d75 [Commonizer] Fix approximation for aliases types 2021-02-03 10:57:17 +03:00
Dmitriy Dolovov
549f6f05f2 [Commonizer] Log stats during building metadata 2021-02-03 10:57:16 +03:00
Dmitriy Dolovov
72e0444d7c [Commonizer] Integrate metadata builder with the commonizer environment 2021-02-03 10:57:15 +03:00
Dmitriy Dolovov
daba02833c [Commonizer] Introduce metadata builder 2021-02-03 10:57:15 +03:00
Dmitriy Dolovov
4b4691518a Metadata: Chunked KlibModuleFragmentWriteStrategy implementation 2021-02-03 10:57:14 +03:00
Dmitriy Dolovov
7bf8949a24 [Commonizer] Introduce MetadataDeclarationsComparator for metadata-based comparison of KLIBs 2021-02-03 10:57:13 +03:00
Dmitriy Dolovov
12c766bf29 [Commonizer] Embed :kotlinx-metadata-klib into the commonizer Jar 2021-02-03 10:57:12 +03:00
Dmitriy Dolovov
b53320c587 [Commonizer] Restore lost nullability for underlying types in TAs 2021-02-03 10:57:12 +03:00
Dmitriy Dolovov
a8dd865f78 [Commonizer] Avoid leaking non-commonized underlying types in TAs 2021-02-03 10:57:11 +03:00
scaventz
d1c4ccd0b9 CLI: improve behavior of -include-runtime
1.fix KT-17344: Include kotlin-reflect to resulting jar if "-include-runtime" is specified, unless the -no-reflect option is specified.
2.fix KT-43220: -include-runtime should add .kotlin_builtins to the output

(cherry picked from commit bd205317aa)
2021-02-02 21:50:51 +01:00
Mads Ager
df5cf5ccb1 [JVM_IR] Fix accessibility bridges for static protected fields.
Super-qualifiers have to be taken into account. Otherwise, too
few accessibility bridges will be generated which can lead to
binary compatibility issues.

(cherry picked from commit 6a959fefd0)
2021-02-02 21:46:26 +01:00
Mikhael Bogdanov
e936bc466a Fix compilation against asm 7.0
(cherry picked from commit 206b38f0ab)
2021-02-02 18:51:52 +01:00
pyos
067cc9cba8 JVM_IR: give loops somewhat more debuggable labels
(cherry picked from commit bd3bc13e75)
2021-02-02 18:24:22 +01:00
pyos
fe4ab2c61e JVM: optimize temporary kotlin.jvm.internal.Refs as well
i.e. remove the condition that there must be an LVT entry. Such
temporary `Ref`s can be created, for example, by the JVM_IR backend
if a lambda inlined at an IR level (e.g. argument to `assert`/`Array`)
is the target of a non-local return from a function inlined at bytecode
level (e.g. `run`):

    IntArray(n) { i ->
        intOrNull?.let { return@IntArray it }
        someInt
    }

->

    val `tmp$0` = IntArray(n)
    for (i in 0 until `tmp$0`.size) {
        var `tmp$1`: Int
        do {
            intOrNull?.let {
                `tmp$1` = it // causes `tmp$1` to become an IntRef
                break
            }
            `tmp$1` = someInt
        } while (false)
        `tmp$0`[i] = `tmp$1`
    }

(cherry picked from commit ad53fc931e)
2021-02-02 18:24:22 +01:00
pyos
ab75917fbc JVM_IR: support non-local break/continue in the inliner
Not in the frontend or psi2ir, though, so this not a complete
implementation of KT-1436, but rather a part of it that is currently
useful to make other code compile. In particular, lambdas passed to
array constructors and JVM-style `assert` are inlined as IR returnable
blocks, which are then converted into `do { ... } while (false)` loops,
so non-local returns from them become non-local `break`s.

(cherry picked from commit 0f2ca5d84c)
2021-02-02 18:24:21 +01:00
Mikhael Bogdanov
32561fe41a Support proper frame maps for enumValues
(cherry picked from commit c13f38f6df)
2021-02-02 17:46:08 +01:00
Mikhael Bogdanov
f4b8261573 Support proper frame maps for enum valueOf
(cherry picked from commit 1a044e5af4)
2021-02-02 17:46:08 +01:00
Mikhael Bogdanov
9c7a5d61f9 JVM_IR. Generate additional checkcast for when/try epressions to avoid frame map problems on reification
(cherry picked from commit 5b64ceceb3)
2021-02-02 17:46:07 +01:00
Mikhael Bogdanov
0dc4f185e5 Don't remove checkcast for reified values
#KT-35511 Fixed

(cherry picked from commit 16928d6e3f)
2021-02-02 17:46:07 +01:00
Vladimir Dolzhenko
ac1d975fd3 Kotlin highlight passes are reworked
#KT-37702 Fixed

(cherry picked from commit 913c298be8)
2021-02-02 17:31:05 +01:00
Vladimir Dolzhenko
a6f8f60447 Lazy diagnostics API in frontend
Relates to #KT-37702

(cherry picked from commit 558338f997)
2021-02-02 17:31:05 +01:00
Zalim Bashorov
44301bd2d8 [JS] Replace usages of FileUtil.loadTextAndClose with functions from stdlib to avoid crashes on files larger than 10MiB
(cherry picked from commit 3f10914f05)
2021-02-02 18:48:37 +03:00
Anton Bannykh
cf3f984e75 JS DCE: use Multimaps to reduce Node fields RAM
(cherry picked from commit 165533fdb7)
2021-02-02 18:45:29 +03:00
Anton Bannykh
8036a257ce JS DCE: disable logging by default
Based on Vladislav Saifulin's PR #4031

(cherry picked from commit f42f2fa743)
2021-02-02 18:45:29 +03:00
Anton Bannykh
ad6ed3a10e JS DCE: inline Qualifier class to reduce RAM usage
(cherry picked from commit 26ce6b5131)
2021-02-02 18:45:29 +03:00
Anton Bannykh
5076734d3a JS DCE: use less LinkedHashSets
(cherry picked from commit bbc6d2b993)
2021-02-02 18:45:28 +03:00
Anton Bannykh
9036164902 JS DCE: create collections on demand
Based on Vladislav Saifulin's PR #4031

(cherry picked from commit 3c0b226344)
2021-02-02 18:45:28 +03:00
Steven Schäfer
e759649b56 JVM IR: Fix inline class mangling for calls to internal functions
...in a different module, e.g., using -Xfriend-paths.
2021-02-01 21:56:12 +01:00
Ilya Gorbunov
6abfbcaa0a Infer required kotlin-test jvm capability based on used test framework
Except when:
- the Gradle version is less than 6.0, it doesn't read the metadata
published by a newer Gradle by default.
- the requested dependency version is less than 1.5, because it doesn't
have metadata published.

Update integration tests to use kotlin-test common dependency.

KT-40225

(cherry picked from commit 4a17228621)
2021-02-01 23:23:20 +03:00
Ilya Gorbunov
cc31c7167e Disable metadata publishing for legacy common artifacts
When they are used explicitly in common source sets, they cannot be
resolved in platform ones after that since they only have
common kotlin-api variants in their metadata.

KT-40225

(cherry picked from commit cbeadba15d)
2021-02-01 23:23:18 +03:00
Ilya Gorbunov
a5a8c30089 Apply common configuration to custom publications in kotlin-test
To do that, extract parts of publishing setup into reusable functions.
This change makes signing and repository configuration applied to all
project publications, not just to the Main one.

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

KT-40225

(cherry picked from commit 573aac7252)
2021-02-01 23:23:17 +03:00
Ilya Gorbunov
8a10ee4e8b Setup publications with MPP Gradle metadata for kotlin-test library
Move publication configuration from individual platform specific
kotlin-test- modules to the root module.

KT-40225

(cherry picked from commit a16aaa3824)
2021-02-01 23:23:15 +03:00
Ivan Gavrilovic
27e7a2fbee KT-43686: Make kapt Gradle task cacheable across machines
Use `@Classpath` for kotlin stdlib input property. This is to
allow cache hits when builds are running on different machines
and path to kotlin stdlib differs.

Test: BuildCacheRelocationIT
(cherry picked from commit 509ed64917)
2021-02-01 22:48:19 +03:00
Alexander Udalov
0d49acc1e6 Mute/unmute FIR box tests on functions with big arity 2021-02-01 18:27:44 +01:00
Dmitry Petrov
ca164bb8ad JVM_IR fix special bridge generation for inline classes
(cherry picked from commit 4ec369ac5b)
2021-02-01 18:00:13 +03:00
Alexander Udalov
565132b7a9 Change logic of applying JVM target from AGP options
Now that the default JVM target is 1.8, we have to add the JVM target
1.6 explicitly if the Android project is configured with source/target
1.6, and not do anything if it's configured with 1.8.

 #KT-31027

(cherry picked from commit e9436da858)
2021-02-01 11:57:06 +01:00
Alexander Udalov
0c5625e616 Light classes: use JVM target from the module
Using "JVM_1_8" always resulted in incorrect mapping of Kotlin
annotation targets to Java element types.

The change in AbstractKotlinRenderLogTest is needed because while
CliTraceHolder.module is technically a descriptor leak, it was never
detected by this test accidentally, because of the depth cutoff equal to
10, which started to not be enough after the minor refactoring of
replacing `Delegates.notNull` with `lateinit`.

(cherry picked from commit adfa8c788c)
2021-02-01 11:57:05 +01:00
Alexander Udalov
e502c1ad71 Light classes: map annotation targets depending on JVM target
Since the default JVM target (`JvmTarget.DEFAULT`) is now 1.8, the
changed test started to fail. This change fixes it.

(cherry picked from commit 64e97225b8)
2021-02-01 11:57:04 +01:00
Alexander Udalov
bd4d9491ba Switch default JVM target to 1.8
#KT-29405 Fixed

(cherry picked from commit d022bb0248)
2021-02-01 11:57:02 +01:00
Alexander Udalov
5d8bf3be87 Workaround illegal access problem in daemon for JDK 17-ea
Otherwise Kotlin cannot be used in Gradle since
https://github.com/openjdk/jdk/commit/ed4c4ee7 where JDK internals
started to be encapsulated by default.

For some reason, using

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

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

 #KT-43704

(cherry picked from commit e7cf34a2a9)
2021-02-01 11:56:17 +01:00
Alexander Udalov
c0ecb5c3c9 CLI: suppress warning on JDK 9+ with illegal access to ResourceBundle
The underlying issue is tracked in IDEA-248785.

 #KT-43704 Fixed

(cherry picked from commit f08733eb75)
2021-02-01 11:56:13 +01:00
Alexander Udalov
a4a2618cf7 CLI: do not pass -noverify to java process starting from JDK 13
#KT-44232 Fixed

(cherry picked from commit 2ef4ca4e6e)
2021-02-01 11:56:07 +01:00
Alexander Udalov
5c43a97e1e Update copyrights in CLI scripts
(cherry picked from commit 2bbe3db041)
2021-02-01 11:56:03 +01:00
Sergey Igushkin
497dacdc3c Add API version 1.5 to accepted values in MPP language settings 2021-02-01 12:42:53 +03:00
Mikhael Bogdanov
3e1fabd46c Set ANDROID_SDK_ROOT for android box tests 2021-01-29 14:30:24 +01:00
Dmitriy Novozhilov
4a50dc9074 Add workaround for problem with initialization of :tools:kotlinp 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
e8068b5576 Update testdata of maven plugin tests 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
0a47b1c32b Remove incorrectly added dependency on experimental coroutines 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
0769157a16 Revert "Revert "Build: enable -Werror in stdlib/core/compiler/plugins modules""
This reverts commit 1300ec3e
2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
7e3802bde3 Advance bootstrap to 1.5.0-dev-2205 2021-01-29 14:57:07 +03:00
Mikhael Bogdanov
c5baf3fdd2 Upgrade gradle plugin to 4.1. and build tools to 29.0.3 for android box tests 2021-01-29 11:57:51 +01:00
Mikhael Bogdanov
9459f8113f Set ANDROID_HOME/ANDROID_SDK_ROOT for android box tests
In some cases emulator execution on TC fails cause of problem with pathes
2021-01-29 11:57:51 +01:00
Ilya Goncharov
fd29fab971 [Gradle, JS] Update tool versions
- Node.js - 14.15.4
- Yarn - 1.22.10

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

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

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

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

[Gradle, JS] Remove producing klib-dir

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

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

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

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

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

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

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

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

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

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

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

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

bits debug

Disable tower group debugging

Extend comment

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Why it happened

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

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

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

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

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

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

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

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

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

// FILE: test.kt

class In<in T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Mitingate flaky failures:

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

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

This reverts commit 2fd69218

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

This reverts commit 08624165

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

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

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

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

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

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

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

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

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

Can be reproduced when running KotlinJpsBuildTest after IncrementalJsJpsTestGenerated.

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

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

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

inline fun bar() {
}

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

leads to the following bytecode:

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

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

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

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

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

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

[JS IR] Add cyclic dependencies with lazy property initialization

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

[JS IR] Add initialization through top level

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

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

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

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

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

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

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

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

[JS IR] Concat varargs with array of nonVarargs arguments

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

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

[JS IR] Add function with named spread operator

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

[JS IR] Add with arguments after vararg

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[JS IR] Move propertyLazyInitialization property to context from configuration

[JS IR] Add test on lazy initialization properties order

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

[JS IR] Move tests onto js.translator

[JS IR] Rename fileToInitializerPureness according to context name

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

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

^KT-43222 fixed

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Before:

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

After:

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

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

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

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

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

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

Ignored tests have been working accidentally

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

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

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

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

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

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

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

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

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

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

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

KotlinMetadataTargetConfigurator: rename getPublishedCommonSourceSets to getCommonSourceSetsForMetadataCompilation

KotlinMetadataTargetConfigurator: isMetadataCompilationSupported and add comment to getPublishedCommonSourceSets

Re-use androidPluginIds in KotlinPlugin

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

JvmAndAndroidIntermediateSourceSetTest: add KotlinProjectStructureMetadata jvmAndAndroidMain exists in jvm variants test

AbstractAndroidProjectHandler: Add java sources only in post processing

KotlinAndroidTarget: Inline creation of usageContexts

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

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

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

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

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

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

^KT-43205 Fixed

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

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

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

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

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

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

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

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

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

Check type recursively.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

These exist as member functions on `Path`

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

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

##### `isRooted`

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

### New extensions

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

The following `Path` extensions were added:

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

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

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

### Other changes

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

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

### Address review comments

- Move varargs parameters to the last position
- Remove PathTreeWalk

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 #KT-39624 Fixed

Pass SerializationDescriptorSerializerPlugin to other extensions directly

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[Gradle, JS] Fix tests for dukat

^KT-42339 fixed

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

^KT-42339 fixed

[Gradle, JS] Remove snapshot versions

^KT-42339 fixed

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

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

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

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

^KT-42339 fixed

[Gradle, JS] Dukat into jar

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

[Gradle, JS] Temporarily used next version of dukat

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Check for serializer type mismatch only when custom serializer is present

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

#KT-36329 Fixed

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

 #KT-38915 Fixed

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

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

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

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

In this case:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

9
.bunch
View File

@@ -1,7 +1,4 @@
201
202
203_202
193
as40_193
as41
as42_as41
201
as41_201
as42

3
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

11845
ChangeLog.md

File diff suppressed because it is too large Load Diff

View File

@@ -2,10 +2,14 @@
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_KotlinPublic_Compiler.svg)](https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Compiler?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
# Kotlin Programming Language
# Kotlin Programming Language!!!
Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
Welcome to [Kotlin](https://kotlinlang.org/)!
It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors.
Some handy links:
* [Kotlin Site](https://kotlinlang.org/)
* [Getting Started Guide](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -14,10 +18,21 @@ Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
* [Issue Tracker](https://youtrack.jetbrains.com/issues/KT)
* [Forum](https://discuss.kotlinlang.org/)
* [Kotlin Blog](https://blog.jetbrains.com/kotlin/)
* [Subscribe to Kotlin YouTube channel](https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw)
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
* [Public Slack channel](https://slack.kotlinlang.org/)
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
## Kotlin Multiplatform capabilities
Support for multiplatform programming is one of Kotlins key benefits. It reduces time spent writing and maintaining the same code for [different platforms](https://kotlinlang.org/docs/reference/mpp-supported-platforms.html) while retaining the flexibility and benefits of native programming.
* [Kotlin Multiplatform Mobile](https://kotlinlang.org/lp/mobile/) for sharing code between Android and iOS
* [Getting Started with Kotlin Multiplatform Mobile Guide](https://kotlinlang.org/docs/mobile/create-first-app.html)
* [Kotlin Multiplatform Benefits](https://kotlinlang.org/docs/reference/multiplatform.html)
* [Share code on all platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-all-platforms)
* [Share code on similar platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-similar-platforms)
## Editing Kotlin
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -153,6 +168,28 @@ includeBuild('/path/to/kotlin') {
}
```
### Dependency verification
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the
repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with
`Dependency verification failed` errors when local artifacts are absent or have different hashes listed in the
[verification-metadata.xml](https://github.com/JetBrains/kotlin/blob/master/gradle/verification-metadata.xml) file.
It's expected that `verification-metadata.xml` should only be updated with the commits that modify the build. There are some tips how
to perform such updates:
- Use auto-generation for getting an initial list of new hashes (verify updates relate to you changes).
`./gradlew -M sha256,md5 help`
*(any other task may be used instead of `help`)*
- Consider removing old versions from the file if you are updating dependencies.
- Leave meaningful `origin` attribute (instead of `Generated by Gradle`) if you did some manual verification of the artifact.
- Always do manual verification if several hashes are needed and a new `also-trust` tag has to be added.
- If youre adding a dependency with OS mentioning in an artifact name (`darwin`, `mac`, `osx`, `linux`, `windows`), remember to add
counterparts for other platforms.
# License
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.

View File

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

View File

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

View File

@@ -1,36 +1,11 @@
import kotlinx.benchmark.gradle.benchmark
val benchmarks_version = "0.2.0-dev-7"
buildscript {
val benchmarks_version = "0.2.0-dev-7"
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
}
}
dependencies {
classpath("org.jetbrains.kotlinx:kotlinx.benchmark.gradle:$benchmarks_version")
}
}
apply(plugin = "kotlinx.benchmark")
val benchmarks_version = "0.3.0"
plugins {
java
kotlin("jvm")
}
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
}
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
}
dependencies {
@@ -40,11 +15,9 @@ dependencies {
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
}
sourceSets {

View File

@@ -152,7 +152,7 @@ abstract class AbstractSimpleFileBenchmark {
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSession(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
val totalTransformer = FirTotalResolveProcessor(session)
val firFile = builder.buildFirFile(file).also(firProvider::recordFile)

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,12 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import java.io.Serializable
enum class ExecutionStrategy : Serializable {
DAEMON, IN_PROCESS, OUT_OF_PROCESS
}

View File

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

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**
@@ -27,9 +27,6 @@ data class JvmBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -47,9 +44,6 @@ data class JvmBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -62,9 +56,6 @@ data class JvmBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
open class BuildReporter(
protected open val icReporter: ICReporter,
protected open val buildMetricsReporter: BuildMetricsReporter
) : ICReporter by icReporter, BuildMetricsReporter by buildMetricsReporter
class RemoteBuildReporter(
override val icReporter: RemoteICReporter,
override val buildMetricsReporter: RemoteBuildMetricsReporter
) : BuildReporter(icReporter, buildMetricsReporter), RemoteReporter {
override fun flush() {
icReporter.flush()
buildMetricsReporter.flush()
}
}

View File

@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental
package org.jetbrains.kotlin.build.report
import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
@@ -17,3 +17,5 @@ interface ICReporter {
fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String)
fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String)
}

View File

@@ -1,9 +1,9 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental
package org.jetbrains.kotlin.build.report
import java.io.File

View File

@@ -0,0 +1,9 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
interface RemoteICReporter : ICReporter,
RemoteReporter

View File

@@ -0,0 +1,11 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
interface RemoteReporter {
fun flush()
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
enum class BuildAttributeKind : Serializable {
REBUILD_REASON;
companion object {
const val serialVersionUID = 0L
}
}
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON),
CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON),
UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNEXPECTED_PSI(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNKNOWN_QUALIFIER(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_REMOVED_ENTRY(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_IS_NOT_FOUND(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_CANNOT_BE_READ(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_NO_KNOWN_BUILDS(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_NON_INCREMENTAL_BUILD_IN_DEP(BuildAttributeKind.REBUILD_REASON),
IN_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
OUT_OF_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
IC_IS_NOT_ENABLED(BuildAttributeKind.REBUILD_REASON);
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildAttributes : Serializable {
private val myAttributes =
EnumMap<BuildAttribute, Int>(
BuildAttribute::class.java
)
fun add(attr: BuildAttribute, count: Int = 1) {
myAttributes[attr] = myAttributes.getOrDefault(attr, 0) + count
}
fun addAll(other: BuildAttributes) {
other.myAttributes.forEach { (attr, n) -> add(attr, n) }
}
fun asMap(): Map<BuildAttribute, Int> = myAttributes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
data class BuildMetrics(
val buildTimes: BuildTimes = BuildTimes(),
val buildAttributes: BuildAttributes = BuildAttributes()
) : Serializable {
fun addAll(other: BuildMetrics) {
buildTimes.addAll(other.buildTimes)
buildAttributes.addAll(other.buildAttributes)
}
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
interface BuildMetricsReporter {
fun startMeasure(metric: BuildTime, startNs: Long)
fun endMeasure(metric: BuildTime, endNs: Long)
fun addAttribute(attribute: BuildAttribute)
fun getMetrics(): BuildMetrics
fun addMetrics(metrics: BuildMetrics?)
}
inline fun <T> BuildMetricsReporter.measure(metric: BuildTime, fn: () -> T): T {
val start = System.nanoTime()
startMeasure(metric, start)
try {
return fn()
} finally {
val end = System.nanoTime()
endMeasure(metric, end)
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.util.*
class BuildMetricsReporterImpl : BuildMetricsReporter {
private val myBuildTimeStartNs: EnumMap<BuildTime, Long> =
EnumMap(
BuildTime::class.java
)
private val myBuildTimes = BuildTimes()
private val myBuildAttributes = BuildAttributes()
override fun startMeasure(metric: BuildTime, startNs: Long) {
if (metric in myBuildTimeStartNs) {
error("$metric was restarted before it finished")
}
myBuildTimeStartNs[metric] = startNs
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
val startNs = myBuildTimeStartNs.remove(metric) ?: error("$metric finished before it started")
val durationNs = endNs - startNs
myBuildTimes.add(metric, durationNs)
}
override fun addAttribute(attribute: BuildAttribute) {
myBuildAttributes.add(attribute)
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
buildTimes = myBuildTimes,
buildAttributes = myBuildAttributes
)
override fun addMetrics(metrics: BuildMetrics?) {
if (metrics == null) return
myBuildAttributes.addAll(metrics.buildAttributes)
myBuildTimes.addAll(metrics.buildTimes)
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
@Suppress("Reformat")
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
GRADLE_TASK,
CLEAR_OUTPUT(GRADLE_TASK),
BACKUP_OUTPUT(GRADLE_TASK),
RESTORE_OUTPUT_FROM_BACKUP(GRADLE_TASK),
CONNECT_TO_DAEMON(GRADLE_TASK),
CLEAR_JAR_CACHE(GRADLE_TASK),
RUN_COMPILER(GRADLE_TASK),
NON_INCREMENTAL_COMPILATION_IN_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
INCREMENTAL_COMPILATION(RUN_COMPILER),
IC_CALCULATE_INITIAL_DIRTY_SET(INCREMENTAL_COMPILATION),
IC_ANALYZE_CHANGES_IN_DEPENDENCIES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_FIND_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_CHANGES_IN_JAVA_SOURCES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_ANALYZE_CHANGES_IN_ANDROID_LAYOUTS(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_DETECT_REMOVED_CLASSES(IC_CALCULATE_INITIAL_DIRTY_SET),
CLEAR_OUTPUT_ON_REBUILD(INCREMENTAL_COMPILATION),
IC_UPDATE_CACHES(INCREMENTAL_COMPILATION),
INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
NON_INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
IC_WRITE_HISTORY_FILE(INCREMENTAL_COMPILATION);
companion object {
const val serialVersionUID = 0L
val children by lazy {
values().filter { it.parent != null }.groupBy { it.parent }
}
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildTimes : Serializable {
private val myBuildTimes = EnumMap<BuildTime, Long>(BuildTime::class.java)
fun addAll(other: BuildTimes) {
for ((bt, timeNs) in other.myBuildTimes) {
add(bt, timeNs)
}
}
fun add(buildTime: BuildTime, timeNs: Long) {
myBuildTimes[buildTime] = myBuildTimes.getOrDefault(buildTime, 0) + timeNs
}
fun asMap(): Map<BuildTime, Long> = myBuildTimes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
object DoNothingBuildMetricsReporter : BuildMetricsReporter {
override fun startMeasure(metric: BuildTime, startNs: Long) {
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
}
override fun addAttribute(attribute: BuildAttribute) {
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
BuildTimes(),
BuildAttributes()
)
override fun addMetrics(metrics: BuildMetrics?) {}
}

View File

@@ -0,0 +1,11 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import org.jetbrains.kotlin.build.report.RemoteReporter
interface RemoteBuildMetricsReporter : BuildMetricsReporter,
RemoteReporter

View File

@@ -29,21 +29,43 @@ import org.jetbrains.kotlin.cli.common.arguments.Argument;
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments;
import org.jetbrains.kotlin.cli.common.arguments.InternalArgument;
import org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt;
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutor;
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutorsKt;
import org.jetbrains.kotlin.utils.StringsKt;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.*;
public class ArgumentUtils {
private ArgumentUtils() {}
private ArgumentUtils() {
}
@NotNull
public static List<String> convertArgumentsToStringList(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<String> convertedArguments = convertArgumentsToStringListInternal(arguments);
Map<KClass<? extends CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> defaultSubstitutorsMap =
ExplicitDefaultSubstitutorsKt.getDefaultSubstitutors();
KClass<? extends CommonToolArguments> argumentsKClass = JvmClassMappingKt.getKotlinClass(arguments.getClass());
Collection<ExplicitDefaultSubstitutor> defaultSubstitutors = defaultSubstitutorsMap.get(argumentsKClass);
if (defaultSubstitutors != null) {
for (ExplicitDefaultSubstitutor substitutor : defaultSubstitutors) {
if (substitutor.isSubstitutable(convertedArguments)) convertedArguments.addAll(substitutor.getNewSubstitution());
}
}
return convertedArguments;
}
@NotNull
public static List<String> convertArgumentsToStringListNoDefaults(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
return convertArgumentsToStringListInternal(arguments);
}
private static List<String> convertArgumentsToStringListInternal(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<String> result = new ArrayList<>();
Class<? extends CommonToolArguments> argumentsClass = arguments.getClass();
convertArgumentsToStringList(arguments, argumentsClass.newInstance(), JvmClassMappingKt.getKotlinClass(argumentsClass), result);

View File

@@ -0,0 +1,46 @@
/*
* 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.
*/
package org.jetbrains.kotlin.idea
import org.jetbrains.kotlin.cli.common.arguments.Argument
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.config.JvmTarget
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1
import kotlin.reflect.full.findAnnotation
val defaultSubstitutors: Map<KClass<out CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> =
mapOf(K2JVMCompilerArguments::class to listOf(JvmTargetDefaultSubstitutor))
sealed class ExplicitDefaultSubstitutor {
abstract val substitutedProperty: KProperty1<out CommonToolArguments, String?>
abstract val oldSubstitution: List<String>
abstract val newSubstitution: List<String>
abstract fun isSubstitutable(args: List<String>): Boolean
protected val argument: Argument by lazy {
substitutedProperty.findAnnotation() ?: error("Property \"${substitutedProperty.name}\" has no Argument annotation")
}
}
object JvmTargetDefaultSubstitutor : ExplicitDefaultSubstitutor() {
override val substitutedProperty
get() = K2JVMCompilerArguments::jvmTarget
private val oldDefault: String
get() = JvmTarget.JVM_1_6.description
private val newDefault: String
get() = JvmTarget.JVM_1_8.description
private fun prepareSubstitution(default: String): List<String> = listOf(argument.value, default)
override val oldSubstitution: List<String>
get() = prepareSubstitution(oldDefault)
override val newSubstitution: List<String>
get() = prepareSubstitution(newDefault)
override fun isSubstitutable(args: List<String>): Boolean = argument.value !in args
}

View File

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

View File

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

View File

@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.name.parentOrNull
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import java.io.DataInput
import java.io.DataOutput
import java.io.File
@@ -326,7 +327,7 @@ private class ProtoDataProvider(private val serializerProtocol: SerializerExtens
proto.`package`.apply {
val packageNameId = getExtensionOrNull(serializerProtocol.packageFqName)
val packageFqName = packageNameId?.let { FqName(nameResolver.getPackageFqName(it)) } ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -347,7 +348,7 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -412,4 +413,4 @@ private class PackageMetadataMap(storageFile: File) : BasicStringMap<ByteArray>(
operator fun get(packageName: String) = storage[packageName]
override fun dumpValue(value: ByteArray): String = "Package metadata: ${value.md5()}"
}
}

View File

@@ -94,6 +94,10 @@ open class IncrementalJvmCache(
fun sourcesByInternalName(internalName: String): Collection<File> =
internalNameToSource[internalName]
fun getAllPartsOfMultifileFacade(facade: JvmClassName): Collection<String>? {
return multifileFacadeToParts[facade]
}
fun isMultifileFacade(className: JvmClassName): Boolean =
className in multifileFacadeToParts
@@ -145,6 +149,7 @@ open class IncrementalJvmCache(
}
protoMap.remove(className, changesCollector)
classFqNameToSourceMap.remove(className.fqNameForClassNameWithoutDollars)
classAttributesMap.remove(className.fqNameForClassNameWithoutDollars)
internalNameToSource.remove(className.internalName)
// TODO NO_CHANGES? (delegates only)
@@ -271,6 +276,7 @@ open class IncrementalJvmCache(
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
return put(kotlinClass, changesCollector)
}
@@ -282,10 +288,12 @@ open class IncrementalJvmCache(
// from files compiled during last round.
// However there is no need to compare old and new data in this case
// (also that would fail with exception).
@Synchronized
fun storeModuleMapping(className: JvmClassName, bytes: ByteArray) {
storage[className.internalName] = ProtoMapValue(isPackageFacade = false, bytes = bytes, strings = emptyArray())
}
@Synchronized
private fun put(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val header = kotlinClass.classHeader
@@ -308,6 +316,7 @@ open class IncrementalJvmCache(
operator fun get(className: JvmClassName): ProtoMapValue? =
storage[className.internalName]
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -324,6 +333,8 @@ open class IncrementalJvmCache(
private inner class JavaSourcesProtoMap(storageFile: File) :
BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
@Synchronized
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
@@ -335,6 +346,7 @@ open class IncrementalJvmCache(
)
}
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -374,6 +386,7 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -390,6 +403,7 @@ open class IncrementalJvmCache(
}
}
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -415,6 +429,8 @@ open class IncrementalJvmCache(
private inner class MultifileClassFacadeMap(storageFile: File) :
BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
@Synchronized
operator fun set(className: JvmClassName, partNames: Collection<String>) {
storage[className.internalName] = partNames
}
@@ -425,6 +441,7 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -434,6 +451,8 @@ open class IncrementalJvmCache(
private inner class MultifileClassPartMap(storageFile: File) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
@Synchronized
fun set(partName: String, facadeName: String) {
storage[partName] = facadeName
}
@@ -441,6 +460,7 @@ open class IncrementalJvmCache(
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -522,6 +542,7 @@ open class IncrementalJvmCache(
return result
}
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -547,6 +568,7 @@ open class IncrementalJvmCache(
private fun functionNameBySignature(signature: String): String =
signature.substringBefore("(")
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -568,6 +590,7 @@ sealed class ChangeInfo(val fqName: FqName) {
class SignatureChanged(fqName: FqName, val areSubclassesAffected: Boolean) : ChangeInfo(fqName)
class ParentsChanged(fqName: FqName, val parentsChanged: Collection<FqName>) : ChangeInfo(fqName)
protected open fun toStringProperties(): String = "fqName = $fqName"

View File

@@ -21,6 +21,7 @@ data class IncrementalModuleEntry(
class IncrementalModuleInfo(
val projectRoot: File,
val rootProjectBuildDir: File,
val dirToModule: Map<File, IncrementalModuleEntry>,
val nameToModules: Map<String, Set<IncrementalModuleEntry>>,
val jarToClassListFile: Map<File, File>,
@@ -28,6 +29,6 @@ class IncrementalModuleInfo(
val jarToModule: Map<File, IncrementalModuleEntry>
) : Serializable {
companion object {
private const val serialVersionUID = 0L
private const val serialVersionUID = 1L
}
}

View File

@@ -17,19 +17,18 @@
package org.jetbrains.kotlin.incremental
import com.intellij.util.containers.MultiMap
import com.intellij.util.containers.StringInterner
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.createStringInterner
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
import java.io.IOException
import java.util.*
open class LookupStorage(
targetDataDir: File,
pathConverter: FileToPathConverter
@@ -212,8 +211,8 @@ open class LookupStorage(
class LookupTrackerImpl(private val delegate: LookupTracker) : LookupTracker {
val lookups = MultiMap.createSet<LookupSymbol, String>()
val pathInterner = StringInterner()
private val interner = StringInterner()
val pathInterner = createStringInterner()
private val interner = createStringInterner()
override val requiresPosition: Boolean
get() = delegate.requiresPosition

View File

@@ -182,6 +182,21 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) return false
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) return false
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) return false
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) return false
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) return false
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) return false
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) return false
}
if (!checkEqualsClassVersionRequirement(old, new)) return false
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
@@ -266,6 +281,9 @@ open class ProtoCompareGenerated(
TYPE_ALIAS_LIST,
ENUM_ENTRY_LIST,
SEALED_SUBCLASS_FQ_NAME_LIST,
INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
INLINE_CLASS_UNDERLYING_TYPE,
INLINE_CLASS_UNDERLYING_TYPE_ID,
VERSION_REQUIREMENT_LIST,
VERSION_REQUIREMENT_TABLE,
JVM_EXT_CLASS_MODULE_NAME,
@@ -314,6 +332,21 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) result.add(ProtoBufClassKind.SEALED_SUBCLASS_FQ_NAME_LIST)
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
}
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
@@ -1728,6 +1761,18 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + fqNameIndexes(getSealedSubclassFqName(i))
}
if (hasInlineClassUnderlyingPropertyName()) {
hashCode = 31 * hashCode + stringIndexes(inlineClassUnderlyingPropertyName)
}
if (hasInlineClassUnderlyingType()) {
hashCode = 31 * hashCode + inlineClassUnderlyingType.hashCode(stringIndexes, fqNameIndexes, typeById)
}
if (hasInlineClassUnderlyingTypeId()) {
hashCode = 31 * hashCode + typeById(inlineClassUnderlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById)
}
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}

View File

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

View File

@@ -27,12 +27,15 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
data class Difference(
val isClassAffected: Boolean = false,
val areSubclassesAffected: Boolean = false,
val changedMembersNames: Set<String> = emptySet()
val changedMembersNames: Set<String> = emptySet(),
val changedSupertypes: Set<FqName> = emptySet()
)
sealed class ProtoData
@@ -50,7 +53,7 @@ fun ProtoMapValue.toProtoData(packageFqName: FqName): ProtoData =
internal val MessageLite.isPrivate: Boolean
get() = DescriptorVisibilities.isPrivate(
ProtoEnumFlags.visibility(
ProtoEnumFlags.descriptorVisibility(
when (this) {
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
@@ -186,6 +189,7 @@ class DifferenceCalculatorForClass(
var isClassAffected = false
var areSubclassesAffected = false
val changedSupertypes = HashSet<FqName>()
val names = hashSetOf<String>()
val classIsSealed = newProto.isSealed && oldProto.isSealed
@@ -246,12 +250,21 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.FLAGS,
ProtoBufClassKind.FQ_NAME,
ProtoBufClassKind.TYPE_PARAMETER_LIST,
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST,
ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST -> {
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST -> {
isClassAffected = true
areSubclassesAffected = true
val oldSupertypes = oldProto.supertypeList.map { oldNameResolver.getClassId(it.className).asSingleFqName() }
val newSupertypes = newProto.supertypeList.map { newNameResolver.getClassId(it.className).asSingleFqName() }
val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes)
changedSupertypes.addAll(changed)
}
ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME,
ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> {
// TODO
@@ -277,10 +290,15 @@ class DifferenceCalculatorForClass(
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID -> {
isClassAffected = true
}
}
}
return Difference(isClassAffected, areSubclassesAffected, names)
return Difference(isClassAffected, areSubclassesAffected, names, changedSupertypes)
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage
import java.io.File
open class IncrementalFileToPathConverter(val rootProjectDir: File?) : FileToPathConverter {
//project root dir
private val projectDirPath = rootProjectDir?.normalize()?.absolutePath
override fun toPath(file: File): String {
val path = file.normalize().absolutePath
return when {
projectDirPath == null || !path.startsWith(projectDirPath) -> path
else -> PROJECT_DIR_PLACEHOLDER + path.substring(projectDirPath.length)
}
}
override fun toFile(path: String): File =
when {
rootProjectDir != null && path.startsWith(PROJECT_DIR_PLACEHOLDER) -> rootProjectDir.resolve(path.substring(PATH_PREFIX.length))
else -> File(path)
}
private companion object {
private const val PROJECT_DIR_PLACEHOLDER = "${'$'}PROJECT_DIR$"
//use only for prefix length because it OS dependent
private const val PATH_PREFIX = "$PROJECT_DIR_PLACEHOLDER/"
}
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.TestWithWorkingDir
import org.junit.Test
import java.io.File
internal class IncrementalFileToPathConverterTest : TestWithWorkingDir() {
val separator: String = File.separator
@Test
fun testPathTransform() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testComplicatedProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("first$separator..${separator}testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testInccorectProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir$separator"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testFileOutOfProject() {
val relativeFilePath = "..${separator}testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${workingDir.absolutePath}${separator}testFile.txt", transformedPath)
}
@Test
fun testFileWithExtraSlash() {
val relativeFilePath = "testFile.txt$separator"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}${separator}testFile.txt", transformedPath)
}
private fun testPathTransformation(projectRoot: File, relativeFilePath: String): String {
val pathConverter = IncrementalFileToPathConverter(projectRoot)
val testFile = projectRoot.resolve(relativeFilePath)
val transformedPath = pathConverter.toPath(testFile)
assertEquals(testFile.normalize().absolutePath, pathConverter.toFile(transformedPath).normalize().absolutePath)
return transformedPath
}
}

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@ import proguard.gradle.ProGuardTask
buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
bootstrapKotlinRepo?.let(::maven)
@@ -27,9 +27,11 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2")
}
}
@@ -72,7 +74,7 @@ val kotlinVersion by extra(
} ?: buildNumber
)
val kotlinLanguageVersion by extra("1.4")
val kotlinLanguageVersion by extra("1.5")
allprojects {
group = "org.jetbrains.kotlin"
@@ -164,21 +166,19 @@ extra["versions.jansi"] = "1.16"
extra["versions.jline"] = "3.3.1"
extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.ant"] = "1.10.7"
extra["versions.android"] = "2.3.1"
val coroutinesVersion = if (Platform[192].orHigher()) "1.3.7" else "1.1.1"
extra["versions.kotlinx-coroutines-core"] = coroutinesVersion
extra["versions.kotlinx-coroutines-jdk8"] = coroutinesVersion
extra["versions.kotlinx-coroutines-core"] = "1.3.8"
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.8"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
extra["versions.robolectric"] = "4.0"
extra["versions.org.springframework"] = "4.2.0.RELEASE"
extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.2"
extra["versions.r8"] = "2.0.88"
extra["versions.completion-ranking-kotlin"] = "0.1.3"
extra["versions.r8"] = "2.1.75"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -187,13 +187,14 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.4.20-dev-16314"
extra["versions.kotlin-native"] = "1.5-rc1-41"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.getBooleanProperty("kotlin.build.useIR") ?: false)
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
val useJvmFir by extra(project.kotlinBuildProperties.useFir)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -267,8 +268,11 @@ extra["compilerModules"] = arrayOf(
":kotlin-build-common",
":core:metadata",
":core:metadata.jvm",
":core:deserialization.common",
":core:deserialization.common.jvm",
":core:compiler.common",
":core:compiler.common.jvm",
":compiler:backend.common.jvm",
":core:descriptors",
":core:descriptors.jvm",
":core:descriptors.runtime",
@@ -288,7 +292,9 @@ extra["compilerModules"] = arrayOf(
":compiler:fir:jvm",
":compiler:fir:checkers",
":compiler:fir:entrypoint",
":compiler:fir:analysis-tests"
":compiler:fir:analysis-tests",
":compiler:fir:analysis-tests:legacy-fir-tests",
":wasm:wasm.ir"
)
extra["compilerModulesForJps"] = listOf(
@@ -314,12 +320,32 @@ extra["compilerModulesForJps"] = listOf(
":compiler:compiler.version"
)
// TODO: fix remaining warnings and remove this property.
extra["tasksWithWarnings"] = listOf(
":kotlin-stdlib:compileTestKotlin",
":kotlin-stdlib-jdk7:compileTestKotlin",
":kotlin-stdlib-jdk8:compileTestKotlin",
":compiler:cli:compileKotlin",
":compiler:frontend:compileKotlin",
":compiler:fir:tree:compileKotlin",
":compiler:fir:resolve:compileKotlin",
":compiler:fir:checkers:compileKotlin",
":compiler:fir:java:compileKotlin",
":kotlin-scripting-compiler:compileKotlin",
":plugins:uast-kotlin:compileKotlin",
":plugins:uast-kotlin:compileTestKotlin",
":plugins:uast-kotlin-idea:compileKotlin"
)
val tasksWithWarnings: List<String> by extra
val coreLibProjects = listOfNotNull(
":kotlin-stdlib",
":kotlin-stdlib-common",
":kotlin-stdlib-js",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test",
":kotlin-test:kotlin-test-annotations-common",
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
@@ -327,8 +353,7 @@ val coreLibProjects = listOfNotNull(
":kotlin-test:kotlin-test-junit5",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-reflect",
":kotlin-coroutines-experimental-compat"
":kotlin-reflect"
)
val gradlePluginProjects = listOf(
@@ -337,7 +362,8 @@ val gradlePluginProjects = listOf(
":kotlin-allopen",
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-sam-with-receiver"
":kotlin-sam-with-receiver",
":kotlin-parcelize-compiler"
)
apply {
@@ -398,15 +424,19 @@ allprojects {
repositories {
kotlinBuildLocalRepo(project)
mirrorRepo?.let(::maven)
jcenter()
maven(protobufRepo)
maven(intellijRepo)
maven("https://dl.bintray.com/kotlin/ktor")
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://dl.google.com/dl/android/maven2")
bootstrapKotlinRepo?.let(::maven)
internalBootstrapRepo?.let(::maven)
bootstrapKotlinRepo?.let(::maven)
maven(protobufRepo)
maven(intellijRepo)
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://dl.google.com/dl/android/maven2")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
jcenter()
}
configureJvmProject(javaHome!!, jvmTarget!!)
@@ -439,6 +469,26 @@ allprojects {
if (useJvmIrBackend) {
useIR = true
}
if (useJvmFir) {
freeCompilerArgs += "-Xuse-fir"
freeCompilerArgs += "-Xabi-stability=stable"
}
}
}
if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) {
// For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects
// (compiler/build.gradle.kts and libraries/commonConfiguration.gradle).
val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile }
if (projectsWithWarningsAsErrors.any(projectDir::startsWith)) {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
if (path !in tasksWithWarnings) {
kotlinOptions {
allWarningsAsErrors = true
}
}
}
}
}
@@ -460,17 +510,7 @@ allprojects {
}
tasks.withType<Test> {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
}
tasks.withType<SourceTask>().configureEach {
doFirst {
source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
}
normalization {
@@ -532,16 +572,33 @@ allprojects {
}
}
gradle.buildFinished {
val taskGraph = gradle?.taskGraph
if (taskGraph != null) {
taskGraph.allTasks
.filterIsInstance<SourceTask>()
.filter { it.didWork }
.forEach {
it.source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
}
}
gradle.taskGraph.whenReady {
fun Boolean.toOnOff(): String = if (this) "on" else "off"
val profile = if (isTeamcityBuild) "CI" else "Local"
val proguardMessage = "proguard is ${kotlinBuildProperties.proguard.toOnOff()}"
val jarCompressionMessage = "jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()}"
val profileMessage = "$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
logger.warn("\n\n$profileMessage")
logger.warn(
"$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
)
allTasks.filterIsInstance<org.gradle.jvm.tasks.Jar>().forEach { task ->
task.entryCompression = if (kotlinBuildProperties.jarCompression)
@@ -556,7 +613,7 @@ val dist = tasks.register("dist") {
}
val syncMutedTests = tasks.register("syncMutedTests") {
dependsOn(":compiler:tests-mutes:run")
dependsOn(":compiler:tests-mutes:tc-integration:run")
}
val copyCompilerToIdeaPlugin by task<Copy> {
@@ -586,7 +643,10 @@ tasks {
listOf("clean", "assemble", "install").forEach { taskName ->
register("coreLibs${taskName.capitalize()}") {
coreLibProjects.forEach { projectName -> dependsOn("$projectName:$taskName") }
for (projectName in coreLibProjects) {
if (projectName.startsWith(":kotlin-test:") && taskName == "install") continue
dependsOn("$projectName:$taskName")
}
}
}
@@ -617,6 +677,7 @@ tasks {
dependsOn("dist")
dependsOn(
":compiler:test",
":compiler:tests-common-new:test",
":compiler:container:test",
":compiler:tests-java8:test",
":compiler:tests-spec:test",
@@ -638,8 +699,11 @@ tasks {
}
register("wasmCompilerTest") {
// TODO: fix once
// dependsOn(":js:js.tests:wasmTest")
dependsOn(":js:js.tests:wasmTest")
// Windows WABT release requires Visual C++ Redistributable
if (!kotlinBuildProperties.isTeamcityBuild || !org.gradle.internal.os.OperatingSystem.current().isWindows) {
dependsOn(":wasm:wasm.ir:test")
}
}
register("nativeCompilerTest") {
@@ -650,6 +714,7 @@ tasks {
dependsOn(":compiler:fir:raw-fir:psi2fir:test")
dependsOn(":compiler:fir:raw-fir:light-tree2fir:test")
dependsOn(":compiler:fir:analysis-tests:test")
dependsOn(":compiler:fir:analysis-tests:legacy-fir-tests:test")
dependsOn(":compiler:fir:fir2ir:test")
}
@@ -659,6 +724,7 @@ tasks {
":compiler:fir:raw-fir:psi2fir:test",
":compiler:fir:raw-fir:light-tree2fir:test",
":compiler:fir:analysis-tests:test",
":compiler:fir:analysis-tests:legacy-fir-tests:test",
":compiler:fir:fir2ir:test",
":plugins:fir:fir-plugin-prototype:test"
)
@@ -671,10 +737,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")
@@ -682,6 +750,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")
@@ -694,17 +763,18 @@ tasks {
}
register("miscCompilerTest") {
dependsOn("wasmCompilerTest")
dependsOn("nativeCompilerTest")
dependsOn("firCompilerTest")
dependsOn(":kotlin-daemon-tests:test")
dependsOn("scriptingTest")
dependsOn(":kotlin-build-common:test")
dependsOn(":compiler:incremental-compilation-impl:test")
dependsOn(":compiler:incremental-compilation-impl:testJvmICWithJdk11")
dependsOn(":core:descriptors.runtime:test")
dependsOn("jvmCompilerIntegrationTest")
dependsOn(":plugins:parcelize:parcelize-compiler:test")
}
register("toolsTest") {
@@ -756,7 +826,6 @@ tasks {
if (Ide.IJ()) {
register("idea-new-project-wizard-tests") {
dependsOn("dist")
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
@@ -766,18 +835,38 @@ tasks {
}
register("idea-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
":idea:performanceTests:performanceTest"
"dist",
":idea:performanceTests:performanceTest",
":idea:performanceTests:aggregateResults"
)
}
register("idea-fir-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-fir-performance-tests:ideaFirPerformanceTest"
)
}
register("idea-fir-plugin-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-fir:test",
":idea:idea-frontend-api:test",
":idea:idea-frontend-fir:test",
":idea:idea-frontend-fir:idea-fir-low-level-api:test"
)
}
register("android-ide-tests") {
dependsOn("dist")
dependsOn(
":plugins:android-extensions-ide:test",
":idea:idea-android:test",
":kotlin-annotation-processing:test"
":kotlin-annotation-processing:test",
":plugins:parcelize:parcelize-ide:test"
)
}
@@ -809,12 +898,24 @@ tasks {
":generators:test"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
)
}
}
register("ideaIntegrationsTests") {
if (Ide.IJ()) {
dependsOn(":idea:idea-new-project-wizard:test")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
dependsOn(":kotlin-annotation-processing-base:test")
dependsOn(":kotlin-annotation-processing-cli:test")
}
register("gradleIdeTest") {
@@ -829,10 +930,11 @@ tasks {
":idea:idea-gradle:test",
":idea:test",
":compiler:test",
":compiler:container:test",
":js:js.tests:test"
)
if (Ide.IJ193.orHigher())
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
@@ -862,16 +964,15 @@ tasks {
dependsOn(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-dist-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",
@@ -884,9 +985,7 @@ tasks {
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish",
":kotlin-stdlib-js:publish",
":kotlin-test:kotlin-test-js:publish"
":kotlin-main-kts:publish"
)
}
}
@@ -953,7 +1052,7 @@ val zipPlugin by task<Zip> {
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to $archiveFile")
logger.lifecycle("Plugin artifacts packed to ${archiveFile.get()}")
}
}

View File

@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
extra["versions.native-platform"] = "0.14"
buildscript {
@@ -5,15 +7,15 @@ buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
} else {
jcenter()
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
}
project.bootstrapKotlinRepo?.let {
@@ -22,7 +24,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -85,8 +87,8 @@ extra["customDepsOrg"] = "kotlin.build"
repositories {
jcenter()
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
@@ -97,8 +99,8 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
implementation("com.gradle.publish:plugin-publish-plugin:0.11.0")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
@@ -112,6 +114,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("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
}
samWithReceiver {
@@ -126,6 +129,11 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs +=
listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
}
tasks["build"].dependsOn(":prepare-deps:build")
allprojects {

View File

@@ -65,28 +65,11 @@ repositories {
artifact()
}
}
ivy {
url = URI("https://dl.bintray.com/kotlin/as/")
patternLayout {
artifact("[artifact]-[revision]-$androidStudioOs.[ext]")
}
credentials {
username = System.getenv("AS_BINTRAY_USER_NAME") ?: findProperty("bintray.user") as String?
password = System.getenv("AS_BINTRAY_API_KEY") ?: findProperty("bintray.apikey") as String?
}
metadataSources {
artifact()
}
}
}
maven("https://www.jetbrains.com/intellij-repository/$intellijReleaseType")
maven("https://plugins.jetbrains.com/maven")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
val intellij by configurations.creating
@@ -255,9 +238,8 @@ fun buildIvyRepositoryTask(
inputs.files(configuration)
outputs.upToDateWhen {
configuration.resolvedConfiguration.resolvedArtifacts.single()
.moduleDirectory()
.exists()
val repoMarker = configuration.resolvedConfiguration.resolvedArtifacts.single().moduleDirectory().resolve(".marker")
repoMarker.exists()
}
doFirst {
@@ -266,8 +248,9 @@ fun buildIvyRepositoryTask(
artifact.storeDirectory().cleanStore()
if (moduleDirectory.exists()) {
logger.info("Path ${moduleDirectory.absolutePath} already exists, skipping unpacking.")
val repoMarker = File(moduleDirectory, ".marker")
if (repoMarker.exists()) {
logger.info("Path ${repoMarker.absolutePath} already exists, skipping unpacking.")
return@doFirst
}
@@ -326,6 +309,8 @@ fun buildIvyRepositoryTask(
)
}
}
repoMarker.createNewFile()
}
}
}

View File

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

View File

@@ -18,3 +18,5 @@ val KotlinBuildProperties.proguard: Boolean get() = postProcessing && getBoolean
val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.build.jar.compression", isTeamcityBuild)
val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild)
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", isTeamcityBuild)

View File

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

View File

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

View File

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

View File

@@ -9,10 +9,13 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ExternalModuleDependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -112,6 +115,50 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
fun Project.testApiJUnit5(
vintageEngine: Boolean = false,
runner: Boolean = false,
suiteApi: Boolean = false
) {
with(dependencies) {
val platformVersion = commonVer("org.junit", "junit-bom")
testApi(platform("org.junit:junit-bom:$platformVersion"))
testApi("org.junit.jupiter:junit-jupiter")
if (vintageEngine) {
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
}
val componentsVersion = commonVer("org.junit.platform", "")
val components = mutableListOf(
"org.junit.platform:junit-platform-commons",
"org.junit.platform:junit-platform-launcher"
)
if (runner) {
components += "org.junit.platform:junit-platform-runner"
}
if (suiteApi) {
components += "org.junit.platform:junit-platform-suite-api"
}
for (component in components) {
testApi("$component:$componentsVersion")
}
addDependencyTo<ExternalModuleDependency>(this, "testImplementation", intellijDep()) {
// This dependency is needed only for FileComparisonFailure
includeJars("idea_rt", rootProject = rootProject)
isTransitive = false
}
// This is needed only for using FileComparisonFailure, which relies on JUnit 3 classes
add("testRuntimeOnly", commonDep("junit:junit"))
}
}
private fun DependencyHandler.testApi(dependencyNotation: Any) {
add("testApi", dependencyNotation)
}
val Project.protobufVersion: String get() = findProperty("versions.protobuf") as String
val Project.protobufRepo: String

View File

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

View File

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

View File

@@ -132,12 +132,10 @@ object IntellijRootUtils {
}
}
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) =
@Suppress("UNCHECKED_CAST")
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean = { true }): Unit =
includeJars(
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(),
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter(jarsFilterPredicate).toTypedArray(),
rootProject = project.rootProject
)
@@ -180,6 +178,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",
"-Didea.tooling.debug=true",
"-Dfus.internal.test.mode=true",
"-Dapple.laf.useScreenMenuBar=true",
"-Dapple.awt.graphics.UseQuartz=true",
"-Dsun.io.useCanonCaches=false",

View File

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

View File

@@ -41,7 +41,7 @@ open class DexMethodCount : DefaultTask() {
dependsOn(jar)
}
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
lateinit var counts: Counts
@get:OutputFile

View File

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

View File

@@ -1,3 +1,4 @@
@file:Suppress("DEPRECATION")
package plugins
import org.codehaus.groovy.runtime.InvokerHelper
@@ -16,10 +17,8 @@ import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import kotlin.properties.Delegates
/**
* Configures a Kotlin module for publication.
*
*/
open class PublishedKotlinModule : Plugin<Project> {

View File

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

View File

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

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import com.gradle.enterprise.gradleplugin.testdistribution.TestDistributionExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.internal.os.OperatingSystem
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
?: isTeamcityBuild
useJUnitPlatform()
extensions.configure(TestDistributionExtension::class.java) {
enabled.set(testDistributionEnabled)
maxRemoteExecutors.set(20)
if (isTeamcityBuild) {
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))
} else {
maxLocalExecutors.set(0)
}
configure()
}
}
fun Test.isTestDistributionEnabled(): Boolean =
extensions.findByType(TestDistributionExtension::class.java)?.enabled?.orNull ?: false

View File

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

View File

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

View File

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

View File

@@ -25,7 +25,7 @@ import org.junit.runners.AllTests;
import java.io.File;
//@RunWith(AllTests.class)
@RunWith(AllTests.class)
public class AndroidRunner {
private static PathManager pathManager;

View File

@@ -20,7 +20,9 @@ import com.intellij.openapi.util.Ref
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.test.KotlinBaseTest
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.sourceFileProvider
import java.io.File
import java.util.regex.Pattern
@@ -34,28 +36,24 @@ private data class OldPackageAndNew(val oldFqName: FqName, val newFqName: FqName
internal fun patchFilesAndAddTest(
testFile: File,
testFiles: List<KotlinBaseTest.TestFile>,
module: TestModule,
services: TestServices,
filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter
): FqName? {
if (testFiles.any { it.name.endsWith(".java") }) {
//TODO support java files
return null
}
val ktFiles = testFiles.filter { it.name.endsWith(".kt") }
if (ktFiles.isEmpty()) return null
): FqName {
val newPackagePrefix = testFile.path.replace("\\\\|-|\\.|/".toRegex(), "_")
val oldPackage = Ref<FqName>()
val isJvmName = Ref<Boolean>(false)
val testFiles = module.files
val isSingle = testFiles.size == 1
val resultFiles = testFiles.map {
val fileName = if (isSingle) it.name else testFile.name.substringBeforeLast(".kt") + "/" + it.name
val content = services.sourceFileProvider.getContentOfSourceFile(it)
TestClassInfo(
fileName,
changePackage(newPackagePrefix, it.content, oldPackage, isJvmName),
changePackage(newPackagePrefix, content, oldPackage, isJvmName),
oldPackage.get(),
isJvmName.get(),
getGeneratedClassName(File(fileName), it.content, newPackagePrefix, oldPackage.get())
getGeneratedClassName(File(fileName), content, newPackagePrefix, oldPackage.get())
)
}
val packages =

View File

@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.android.tests
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.io.FileUtil
@@ -17,16 +16,33 @@ import org.jetbrains.kotlin.codegen.CodegenTestCase
import org.jetbrains.kotlin.codegen.CodegenTestFiles
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.*
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
import org.jetbrains.kotlin.test.services.*
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.impl.BackendKindExtractorImpl
import org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl
import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider
import org.jetbrains.kotlin.test.services.sourceProviders.CodegenHelpersSourceFilesProvider
import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.junit.Assert
import java.io.File
import java.io.FileWriter
import java.io.IOException
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.Path
import kotlin.io.path.createTempDirectory
import kotlin.test.assertTrue
data class ConfigurationKey(val kind: ConfigurationKind, val jdkKind: TestJdkKind, val configuration: String)
@@ -238,6 +254,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
}
}
@OptIn(TestInfrastructureInternals::class)
@Throws(IOException::class)
private fun processFiles(
files: Array<File>,
@@ -266,8 +283,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
continue
}
val fullFileText =
FileUtil.loadFile(file, true).replace("COROUTINES_PACKAGE", "kotlin.coroutines")
val fullFileText = FileUtil.loadFile(file, true)
if (fullFileText.contains("// WITH_COROUTINES")) {
if (fullFileText.contains("kotlin.coroutines.experimental")) continue
@@ -277,7 +293,8 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
//TODO support JvmPackageName
if (fullFileText.contains("@file:JvmPackageName(")) continue
// TODO: Support jvm assertions
if (fullFileText.contains("// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm")) continue
if (fullFileText.contains("// ASSERTIONS_MODE: jvm")) continue
if (fullFileText.contains("// MODULE: ")) continue
val targets = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fullFileText, "// JVM_TARGET:")
.also { it.remove(JvmTarget.JVM_1_6.description) }
@@ -290,35 +307,96 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (fullFileText.contains("// SKIP_JDK6")) continue
if (hasBoxMethod(fullFileText)) {
val testFiles = createTestFiles(file, fullFileText)
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
val testConfiguration = createTestConfiguration(file)
val services = testConfiguration.testServices
val moduleStructure = try {
testConfiguration.moduleStructureExtractor.splitTestDataByModules(
file.path,
testConfiguration.directives,
).also {
services.register(TestModuleStructure::class, it)
}
} catch (e: ExceptionFromModuleStructureTransformer) {
continue
}
val module = moduleStructure.modules.singleOrNull() ?: continue
if (module.files.any { it.isJavaFile || it.isKtsFile }) continue
if (module.files.isEmpty()) continue
services.registerDependencyProvider(DependencyProviderImpl(services, moduleStructure.modules))
val keyConfiguration = CompilerConfiguration()
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
val configuratorForFlags = JvmEnvironmentConfigurator(services)
with(configuratorForFlags) {
val extractor = DirectiveToConfigurationKeyExtractor()
extractor.provideConfigurationKeys()
extractor.configure(keyConfiguration, module.directives)
}
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
keyConfiguration.languageVersionSettings = module.languageVersionSettings
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
val compiler = if (isJvm8Target) {
if (kind.withReflection) JVM8REFLECT else JVM8
} else if (kind.withReflection) REFLECT else COMMON
val compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
println("Creating new configuration by $key")
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
})
}
}
patchFilesAndAddTest(file, testFiles, filesHolder)
patchFilesAndAddTest(file, module, services, filesHolder)
}
}
}
}
private fun createTestConfiguration(testDataFile: File): TestConfiguration {
return TestConfigurationBuilder().apply {
testConfiguration()
testInfo = KotlinTestInfo(
"org.jetbrains.kotlin.android.tests.AndroidRunner",
"test${testDataFile.nameWithoutExtension.capitalize()}",
emptySet()
)
}.build(testDataFile.path)
}
private val testConfiguration: TestConfigurationBuilder.() -> Unit = {
globalDefaults {
frontend = FrontendKinds.ClassicFrontend
targetBackend = TargetBackend.ANDROID
targetPlatform = JvmPlatforms.defaultJvmPlatform
dependencyKind = DependencyKind.Binary
}
useConfigurators(
::CommonEnvironmentConfigurator,
::JvmEnvironmentConfigurator
)
useAdditionalSourceProviders(
::AdditionalDiagnosticsSourceFilesProvider,
::CoroutineHelpersSourceFilesProvider,
::CodegenHelpersSourceFilesProvider,
)
assertions = JUnit5Assertions
useAdditionalService<TemporaryDirectoryManager>(::TemporaryDirectoryManagerImpl)
useAdditionalService<BackendKindExtractor>(::BackendKindExtractorImpl)
useSourcePreprocessor(*AbstractKotlinCompilerTest.defaultPreprocessors.toTypedArray())
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
}
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
CodegenTestCase.createTestFilesFromFile(file, expectedText, "kotlin.coroutines", false, TargetBackend.JVM)
CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)
companion object {
const val GRADLE_VERSION = "5.6.4" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d"
const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "fd591a34af7385730970399f473afabdb8b28d57fd97d6625c388d090039d6fd"
const val testClassPackage = "org.jetbrains.kotlin.android.tests"
const val testClassName = "CodegenTestCaseOnAndroid"
const val baseTestClassPackage = "org.jetbrains.kotlin.android.tests"
@@ -339,20 +417,21 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
@Throws(IOException::class)
internal fun writeAndroidSkdToLocalProperties(pathManager: PathManager) {
val sdkRoot = KotlinTestUtils.getAndroidSdkSystemIndependentPath()
val sdkRoot = KtTestUtil.getAndroidSdkSystemIndependentPath()
println("Writing android sdk to local.properties: $sdkRoot")
val file = File(pathManager.tmpFolder + "/local.properties")
FileWriter(file).use { fw -> fw.write("sdk.dir=$sdkRoot") }
}
@OptIn(ExperimentalPathApi::class)
@JvmStatic
fun main(args: Array<String>) {
val tmpFolder = createTempDir()
println("Created temporary folder for android tests: " + tmpFolder.absolutePath)
val rootFolder = File("")
val pathManager = PathManager(rootFolder.absolutePath, tmpFolder.absolutePath)
val tmpFolder = createTempDirectory().toAbsolutePath().toString()
println("Created temporary folder for android tests: $tmpFolder")
val rootFolder = Path("").toAbsolutePath().toString()
val pathManager = PathManager(rootFolder, tmpFolder)
generate(pathManager, true)
println("Android test project is generated into " + tmpFolder.absolutePath + " folder")
println("Android test project is generated into $tmpFolder folder")
}
}
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common
class BackendException(message: String, cause: Throwable?) : IllegalStateException(message, cause)

View File

@@ -232,12 +232,13 @@ object CodegenUtil {
}
@JvmStatic
fun reportBackendException(exception: Throwable, phase: String, fileUrl: String?): Nothing {
fun reportBackendException(exception: Throwable, phase: String, location: String?, additionalMessage: String? = null): Nothing {
// CompilationException (the only KotlinExceptionWithAttachments possible here) is already supposed
// to have all information about the context.
if (exception is KotlinExceptionWithAttachments) throw exception
throw IllegalStateException(
getExceptionMessage("Backend", "Exception during $phase", exception, fileUrl),
throw BackendException(
getExceptionMessage("Backend", "Exception during $phase", exception, location) +
additionalMessage?.let { "\n" + it }.orEmpty(),
exception
)
}

View File

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

View File

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

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:JvmName("CommonVariableAsmNameManglingUtils")
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.resolve.jvm.checkers.isValidDalvikCharacter
fun mangleNameIfNeeded(name: String): String {
if (name.all { it.isValidCharacter() }) {
return name
}
return buildString {
for (c in name) {
if (c.isValidCharacter()) {
append(c)
} else {
val hexString = Integer.toHexString(c.toInt())
assert(hexString.length <= 4)
append("_u").append(hexString)
}
}
}
}
private fun Char.isValidCharacter(): Boolean {
return this != '$' && this != '-' && isValidDalvikCharacter(this)
}

View File

@@ -0,0 +1,13 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen
import org.jetbrains.org.objectweb.asm.Opcodes
// This object should help compiling against different ASM versions in different bunch versions
object VersionIndependentOpcodes {
const val ACC_RECORD = Opcodes.ACC_RECORD
}

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