Commit Graph

64700 Commits

Author SHA1 Message Date
Dmitry Gridin 2b8bb30744 Change signature: fix formatting for long qualifier names
#KT-12878 Fixed
2020-04-28 11:58:16 +00:00
Sergey Igushkin 8336119557 Kotlin/Native 1.4-M3-dev-15453 2020-04-28 14:19:12 +03:00
Alexander Udalov 94346e8a03 Add JVM target bytecode version 14
#KT-38413 Fixed
2020-04-28 13:00:23 +02:00
Alexander Udalov 098a935aa7 Fix exponential string table size of anonymous classes during inlining
When we inline an anonymous object which captures something such as
crossinline values or reified parameters, we copy and transform its
metadata in `AnonymousObjectTransformer.transformMetadata`. Basically we
read the metadata of the original class, add a minor protobuf extension
and write it to the new class.

This also includes copying the string table. We read the string table
into `JvmNameResolver` (a representation of string table used in
deserialization), then construct a `JvmStringTable` (a representation
used in _serialization_) and then write it back.

There's a few optimizations in the string table representation in JVM
metadata which allow to store less strings and thus take less space. See
`StringTableTypes.Record` in `jvm_metadata.proto` for more information.
One of the optimizations `Record.range` allows to avoid storing the same
record many times in a sequence. For example, if we have N different
strings in the string table but none of them require any operation (such
as substring, char replacement, etc.), then we only store the record
with all default values (no operation, no predefined string, etc.) and
set its `range` to N. Upon reading such optimized record list in
`JvmNameResolver`, we "expand" it back to normal, so that we could index
it quickly and figure out what operation needs to be performed on each
string from the string table.

The problem was that when we expanded this list, we didn't set the range
of the expanded record entry to 1. So each record in
`JvmNameResolver.records` still has its original range. It doesn't cause
any problems most of the time because the range in this expanded list is
almost unused. However, when copying/transforming metadata for anonymous
objects, we mistakenly passed this expanded list with incorrect ranges
to `JvmStringTable`. So the metadata in the copied anonymous object
ended up being incorrect: each record now was present the number of
times equal to its range. Copying such metadata once again led to
another multiplication of the record list size. Multiple copies resulted
in exponential increase in memory consumption and quickly led to OOM.

For the fix, we now take the original, unexpanded list of records when
creating `JvmStringTable` out of `JvmNameResolver` for transformation of
anonymous object metadata.

Note that another possible fix would be to make range for each record in
`JvmNameResolver.records` equal to 1. This is undesirable though, since
then we'd need to copy each `JvmProtoBuf.StringTableTypes.Record`
instance, of which there could be many, and use some memory for no
apparent gain (since ranges in that expanded list are now not used at
all).

 #KT-38197 Fixed
2020-04-28 12:59:52 +02:00
Mikhail Glukhikh 65065a15a3 FIR DFA: stabilize type order 2020-04-28 13:12:15 +03:00
Pavel Kirpichenkov 36a57973b5 [NI] CST: remove max depth offset from recursion detection
Recursive type with several recursive anscestors can create a number of identical
common supertype calculations, growing exponentially on every step of recursion.
Previously the number of calculations was limited by D + 3, where D is a type depth.
Since the limit is dynamic, it seems that extra +3 offset can be dropped thus
reducing the number of recursions. The proper solution is to detect such a recursion
and fold recursive type preemtively, but for now this may improve performance in some use cases.

^KT-38544 In progress
2020-04-28 12:53:09 +03:00
Pavel Kirpichenkov dfc86dbf63 [NI] Avoid type rendering in member scope for intersection type
KT-38544
2020-04-28 12:53:09 +03:00
Dmitry Petrov 802372ceff PSI2IR: suspend conversion on arbitrary arguments 2020-04-28 12:41:56 +03:00
Sergey Igushkin e3d33cdc10 Drop Gradle < 6.0 support for Kotlin MPP Gradle plugin
This is required due to issues with dependency resolution of the
kotlinx library modules published in a way that their root MPP module
contains the JVM artifacts so that consumers that can't read Gradle
module metadata get the JVM JAR and POM. Gradle 6.0+ fails to resolve
those modules in a variant-aware way, always choosing the JVM artifacts.

To avoid issues on the consumer side when these dependencies are used,
we decided to drop support for Gradle < 6.0 in the MPP plugin.

Issue #KMM-233 Fixed
2020-04-28 09:33:17 +00:00
Andrey Uskov 89777f8bf3 Move GradleQuickFixTest checks in EDT Thread 2020-04-28 11:53:30 +03:00
Andrey Uskov aa6801569a Fix compilation of ExternalSystem tests in legacy branches 2020-04-28 11:53:28 +03:00
Dmitry Savvinov 3b7fbeb71b Fallback to M2-implementation of dependsOn in AS + M3
^KT-33809
2020-04-28 10:42:56 +03:00
Dmitriy Dolovov 151890dde5 Add test for overloading expect MemberDescriptors discrimination
Issue #KT-38298
2020-04-28 13:16:23 +07:00
Dmitriy Dolovov 90e888a1b6 Discriminate overloading expect MemberDescriptors
Issue #KT-38298
2020-04-28 13:16:18 +07:00
Mikhail Glukhikh 34ae35b2aa Move FirJvmClassCodegen inside fir:fir2ir:jvm-backend #KT-38156 Fixed
This removes dependency of IR JVM backend from FIR
2020-04-28 07:35:13 +03:00
Mikhail Glukhikh dbd4cecff6 FIR serializer: accept FirClass instead of IrClass to get rid of IR deps 2020-04-28 07:35:12 +03:00
Mikhail Glukhikh 8d85e7a401 FIR serializer: add forgotten type alias serialization 2020-04-28 07:35:10 +03:00
Mikhail Glukhikh a545ec41a0 FIR serializer: consider exotic types as errors (breaks 4 BB tests) 2020-04-28 07:35:09 +03:00
Mikhail Glukhikh ec7522c675 FIR serializer: introduce nonSourceAnnotations 2020-04-28 07:35:08 +03:00
Mikhail Glukhikh 7adb4eb872 FIR serializer: extract annotation argument visiting to separate object 2020-04-28 07:35:07 +03:00
Mikhail Glukhikh 394fa7affc FIR serializer: add bad test data changes 2020-04-28 07:35:06 +03:00
Mikhail Glukhikh f98c73cb30 [FIR] Support FirMetadataSource.File in FIR2IR & serializer (KT-38156) 2020-04-28 07:35:04 +03:00
Mikhail Glukhikh 95a17eadb2 FIR serializer: refactor typeProto + add some suspend types support 2020-04-28 07:35:02 +03:00
Mikhail Glukhikh 6af66cd3a2 FIR: don't serialize static enum members fixing testEnumNameOrdinal 2020-04-28 07:35:01 +03:00
Mikhail Glukhikh c2c85365e6 Use FIR metadata in FIR2IR data class member generator (KT-38156) 2020-04-28 07:34:59 +03:00
Mikhail Glukhikh c6c848f929 Introduce & use FirJvmSerializerExtension & FirBasedClassCodegen
#KT-38156 In Process
2020-04-28 07:34:56 +03:00
Mikhail Glukhikh 7ae98485b8 IR: separate ClassCodegen & DescriptorBasedClassCodegen 2020-04-28 07:34:55 +03:00
Mikhail Glukhikh 03be3c108a [FIR2IR] Introduce FirMetadataSource and use it (KT-38156) 2020-04-28 07:34:52 +03:00
Mikhail Glukhikh 2aae735a8e Introduce FIR serializer (isn't in use yet, KT-38156) 2020-04-28 07:34:50 +03:00
Sergey Igushkin 2c63a15af2 Add a test for KT-38338
^KT-38338
2020-04-28 02:39:32 +03:00
Vladimir Dolzhenko ce7ea00178 Added missed language for fileType
#KT-38571 Fixed
2020-04-27 22:45:07 +02:00
Dmitry Petrov 000757c75b JVM: Add suspend conversion bit for function references equals/hashCode 2020-04-27 21:02:37 +03:00
Dmitry Petrov c7a96810bf JVM: Suspend conversion for function references 2020-04-27 21:02:37 +03:00
Dmitry Petrov 6b9a7464f5 PSI2IR: Support suspend conversion for function references 2020-04-27 21:02:37 +03:00
Mikhail Glukhikh 10cda4b54f [FIR] Minor: regenerate diagnostic tests 2020-04-27 19:42:47 +03:00
Yuku Kotani de28a41caa KT-32163: Open Quick Documentation when cursor inside function / constructor brackets (#2502)
* Show function docs when cursor is in args of the function call

* Show constructor docs when cursor is in args of the constructor call

* Show function docs when cursor is in args of the kt function call

* Add some tests

* Use JavaDocumentationProvider to fetch java method document

* Support caret in params

#KT-32163 fixed
2020-04-27 18:15:24 +03:00
Ilya Goncharov 6b5b23f37b [Gradle, JS] Remove propagation moduleName from legacy to ir target
#KT-38614 fixed
2020-04-27 18:01:29 +03:00
Natalia Selezneva 8e93ac0df7 Merge pull request #3331 from gharrma/fix-script-change-listener
Move vFile.isValid() check inside read action
2020-04-27 17:59:13 +03:00
Anton Bannykh 442331acc9 IR JS: support findAssociatedObject feature (KT-37418 fixed) 2020-04-27 17:23:19 +03:00
Vladimir Dolzhenko f4b6e1bff6 Reworked deprecated fileTypeFactory EP usage
Relates to #KT-38571
2020-04-27 14:08:17 +00:00
Vladimir Dolzhenko 639cc69920 Reworked deprecated defaultLiveTemplatesProvider EP usage
Relates to #KT-38571
2020-04-27 14:08:16 +00:00
Konstantin Tskhovrebov 6d7e428d89 Get first platform from platformCompilations instead host platform.
Fixed #KMM-234
2020-04-27 16:54:29 +03:00
Mikhail Glukhikh 90fd2c6c4c FirCallResolver: perform int literal approximation also for var access
Partial fix of KT-38473
2020-04-27 16:04:05 +03:00
Mikhail Glukhikh 5446795d12 FirCallResolver: reuse collectCandidates for variable access 2020-04-27 16:04:04 +03:00
Nikolay Krasko 4230a17427 Revert "Force bootstrap stdlib in modules that used in composite build"
This reverts commit ad76562c
2020-04-27 15:58:38 +03:00
Nikolay Krasko ad76562cbc Force bootstrap stdlib in modules that used in composite build 2020-04-27 15:36:49 +03:00
rapturemain 49593d308c [FIR] Add EXPOSED_SUPER_(CLASS/INTERFACE) checker 2020-04-27 13:00:49 +03:00
Jinseong Jeon ef09850df8 FIR2IR: set superQualifierSymbol for super call 2020-04-27 11:50:26 +03:00
Jinseong Jeon 57fe01c375 FIR2IR: populate overriddenSymbols for overriding functions
#KT-38416 Fixed
2020-04-27 11:50:24 +03:00
Andrey Uskov b51649dcc6 Fix tests compilation in 201 2020-04-27 10:00:32 +03:00