Commit Graph

4941 Commits

Author SHA1 Message Date
Steven Schäfer 3098723406 Minor: Fix outdated test 2019-10-18 17:20:22 +02:00
Steven Schäfer 21af7dfbe1 Add tests for constructors taking inline class arguments 2019-10-18 17:20:22 +02:00
Steven Schäfer 9389d88232 JVM IR: Hide constructors with inline class parameters 2019-10-18 17:20:22 +02:00
pyos d1f25d1c26 JVM_IR: discard results of nonexhaustive whens' branches 2019-10-17 15:41:42 +02:00
Mikhael Bogdanov c78dbaf6b3 Initializer default values in 'tailrec' method in proper order
#KT-31540 Fixed
2019-10-17 13:06:36 +02:00
pyos 27094d0371 JVM_IR: fix synthetic accessor generation (again)
Turns out private inline functions *can* be called from other classes.
2019-10-17 12:38:19 +02:00
Steven Schäfer 4878c7967a JVM: Handle inline class equality in when statement with declaration
#KT-34268 Fixed
2019-10-16 19:23:49 +02:00
Mads Ager 8305baa5fe [JVM_IR] Avoid unbounded recursion for recursive suspend functions.
Additionally, deal with primitive types in AddContinuationLowering.
2019-10-16 13:50:52 +03:00
Georgy Bronnikov ed6ca7d67e JVM_IR: fix for SingletonReferencesLowering
When replacing an enum entry reference with `this`, you need to take
`this` from the function's `dispatchReceiverParameter`, not the class's
`thisReceiver`. Otherwise the code generator fails to find the reference
among accessible variables.
2019-10-16 13:19:40 +03:00
Georgy Bronnikov f3cae210f8 JVM_IR: handle type parameters in constructors for @JvmOverloads stubs 2019-10-15 14:55:18 +03:00
pyos d3992826e4 JVM_IR: discard parameter annotations in anonymous object constructors 2019-10-14 14:54:44 +02:00
pyos bc4be53569 JVM: generate $assertionsDisabled before inlining the node
This fixes the problem where compiling a class initializer that contains
a call to an `assert`ing function in a separate module causes the
assertion to always be enabled (i.e. the attached test used to fail in
CompileKotlinAgainstInlineKotlin mode).
2019-10-11 14:54:52 +03:00
Georgy Bronnikov 1abdcf3f57 JVM_IR: support function references with default parameters 2019-10-11 13:30:30 +03:00
pyos 301e3d27fd JVM_IR: "fix" reified type parameter scope check
where "fix" means "work around a bug that is much harder to fix". When
lambdas are extracted into the nearest class, captured type parameters
are not transformed into type parameters of the new method; because of
this, to check whether a reified type parameter is captured by a method
we need to check the outermost named function, not the current function.
2019-10-10 14:54:13 +02:00
Georgy Bronnikov c70b2e3e4b JVM_IR: specify correct type for defaultConstructorMarker arguments 2019-10-10 14:07:43 +03:00
Mads Ager 92cf521e11 [IR] Deal with forward references in default argument lambdas.
Rely on the frontend weeding out cases that are not supported.

In psi2ir, introduce all the parameters before processing default
values.

Change the DefaultArgumentStubGenerator to generate code that
matches the behavior of the current backend.
2019-10-10 09:00:51 +02:00
Pavel Kirpichenkov 42740c8b97 Fix capturing of outer type parameters for classes declared inside init block 2019-10-09 16:01:46 +03:00
Kristoffer Andersen cc6252098f Add a test to reveal flaw in call delegation with default implementations in interfaces. 2019-10-09 13:03:21 +02:00
Mads Ager f9d117970a [JVM_IR] Map suspend lambdas to original function for inlining. 2019-10-08 19:21:37 +03:00
pyos b6a1154672 Add a test for non-null assertions in local classes/functions 2019-10-08 17:19:41 +02:00
pyos 06c00f4d9e Unmute some JVM_IR inlining tests 2019-10-08 17:19:41 +02:00
pyos cea69e0706 JVM_IR: do not generate redundant load+stores before inline calls 2019-10-08 17:19:41 +02:00
pyos 07bde889b4 JVM_IR: generate more correct names for regenerated objects
and fake lambda types, too. (But those only matter for debugging.)

Also, share object name generators between methods with the same name to
avoid rewriting objects from one with objects from the other.
2019-10-08 17:19:41 +02:00
pyos 432ba62143 JVM_IR: omit annotations on outer this parameters 2019-10-08 14:41:05 +02:00
Steven Schäfer e25a09f2f9 JVM IR: Fix local delegated properties with inline class types 2019-10-07 17:12:30 +02:00
pyos cd47c11efd Generate unique parameter names in LocalDeclarationsLowering 2019-10-07 15:14:48 +02:00
Mads Ager 3b2843fe7a Introduce local variable type checker.
CheckLocalVariablesTableTests will now check the validity of
the locals table against types of locals computed based on the
bytecode.

These checks and the new destructuringInFor test act as a
regression test for the changes in
https://github.com/JetBrains/kotlin/pull/2613

These checks also caught a similar issue for destructuring
lambda parameters, where the local is introduced before the
value has been written to the local slot. This change also
fixes that.

Finally, this change fixes the asmLike tests to correctly
look up the name of parameters in the locals table.
2019-10-07 15:06:44 +02:00
Steven Schäfer 3659b517bb Minor: Fix some test cases 2019-10-07 12:54:11 +02:00
pyos 6e9ee2a46c JVM_IR: fix const reads from other files in same module 2019-10-07 12:28:55 +02:00
Steven Schäfer 0b76f60b63 JVM IR: Handle NonInlinedConst 2019-10-05 10:52:59 +02:00
Anton Bannykh aad9cbbf01 [JS IR BE] Fix tests failing due to reduced runtime 2019-10-04 17:30:45 +03:00
Georgy Bronnikov 4b5877f3b5 JVM_IR, codegen: handle names for classes within local classes 2019-10-03 17:11:48 +03:00
Svyatoslav Kuzmich 5d7f18b1b9 [JS] Support wrapped and dynamic types in typeOf 2019-10-03 13:12:46 +03:00
Dmitry Petrov a633a33627 KT-14513 Don't generate delegated property metadata when unused
If the delegated property operators involved are inline, and delegated
property metadata parameter is not used (which is often the case, e.g.,
'lazy'), we can skip those properties in metadata generation.

NOT implemented: special case when only 'kProperty.name' is used by the
corresponding delegated property operators.

Also a sneak fix for KT-34060.
2019-10-02 17:14:48 +04:00
Georgy Bronnikov e38ff8753e JVM_IR: support type parameters in @JvmOverload functions 2019-10-02 16:19:06 +03:00
pyos ea56a5e8b1 Unmute some JVM_IR inlining tests 2019-10-02 14:48:05 +02:00
Denis Zharkov e54d2c7c32 Support named arguments in their own position
^KT-7745 In Proggress
2019-10-02 11:13:15 +03:00
Steven Schäfer 217f681b6e JVM IR: Use WrappedClassDescriptor in class builder. 2019-10-02 08:29:22 +02:00
Georgy Bronnikov 4920d71d70 JVM_IR: set dispatchReceiverParameter of imported JvmStatic object methods to null 2019-10-01 20:52:56 +03:00
Ilmir Usmanov 08794d17a0 Do not box function argument if it is used in EXACTLY_ONCE lambda
Since we cannot change type of parameter, we cannot replace it with
box type.
 #KT-29510 Fixed
 #KT-29614 Fixed
 #KT-29385 Fixed
2019-09-30 17:42:17 +03:00
Mark Punzalan c16b59191b Do not cache "last" value (i.e., size/length) in lowered for-loop
iteration over CharSequences.

CharSequences may be mutable (e.g., StringBuilder) and therefore its
contents and length can change within the loop.
2019-09-27 13:44:40 +02:00
Svyatoslav Kuzmich 7592048437 [JS] Support typeOf 2019-09-25 18:12:55 +03:00
Kristoffer Andersen 52dc469657 JVM IR: Generate synthetic methods for type aliases with annotations 2019-09-24 12:21:42 +02:00
Steven Schäfer e4609a9968 JVM IR: Cache inline class replacements at the module level 2019-09-20 23:41:39 +02:00
Steven Schäfer f40f9611c3 JVM IR: Fix spread operator on unsigned array type 2019-09-20 18:17:31 +02:00
Alexander Udalov a7b984bcbf JVM IR: fix generation of generic multi-file delegates 2019-09-19 22:23:16 +02:00
Alexander Udalov acbe5c4e21 JVM IR: fix IOOBE from remapTypeParameters for synthetic property annotations method 2019-09-19 22:23:16 +02:00
Ilmir Usmanov f1d31c8221 JVM_IR: Minor. Unmute tests
Rename FAKE_CONTINUATION -> fakeContinuation
2019-09-19 19:28:11 +03:00
Ilmir Usmanov 06d0e8a521 JVM_IR: Support suspend functions with extension receivers 2019-09-19 19:28:10 +03:00
Ilmir Usmanov 2bfd17d8fb JVM_IR: Minor. Unmute test. 2019-09-19 19:28:08 +03:00