Commit Graph

101 Commits

Author SHA1 Message Date
Denis Zharkov
89ded4ab1d Implement hack to support both remove() and removeAt() in MutableList<Int>
Also add couple of tests about CharSequence.get
2015-10-11 19:57:22 +03:00
Alexander Udalov
a4732b442d Don't create KClass and KPackage instances in <clinit>
This proved to be a fragile technique, which probably doesn't even improve
performance in most cases but has lots of unexpected problems: unconditional
initialization of reflection classes, increasing the size of the bytecode, bugs
with <clinit> in annotations on JVM 6, inability to support conversion of a
class from Kotlin to Java without recompiling clients which use it
reflectively, etc.
2015-10-11 17:10:35 +03:00
Michael Bogdanov
8198ac77cb Generate private constructor for object
#KT-9510 Fixed
2015-10-09 16:25:20 +03:00
Michael Bogdanov
a4997e8b31 backend tests: INSTANCE$ -> INSTANCE 2015-10-09 16:25:18 +03:00
Michael Bogdanov
60d1736b97 Instance field generation in objects 2015-10-09 16:25:16 +03:00
Denis Zharkov
80da320c2c Customize JVM signature for Collection's members
- Do not write signature for `contains`
- Write signature for `containsAll` as it's declared like `containsAll(Collection<?>)`
2015-10-09 14:40:33 +03:00
Denis Zharkov
6a1566a6dc Make JVM backend work with Collection.size as val
0. Such properties are called special because their accessor JVM name differs from usual one
1. When making call to such property, always choose special name
2. When generating Kotlin class inheriting such property generate `final bridge int size() { return this.getSize(); }`
3. If there is no `size` declaration in current class generate `bridge int getSize() { // super-call }`
2015-10-07 08:46:35 +03:00
Dmitry Jemerov
7c20630272 diagnostics for deprecated syntax of function type parameter list 2015-10-06 16:20:47 +02:00
Michael Bogdanov
cd78514b76 Code clean, small refactorings and tests
#KT-8987 Fixed
2015-10-03 10:53:22 +03:00
Dmitry Petrov
06d9ff6a71 KT-9377 Support is-checks for read-only collections
Generate better code for 'as?' with mutable collection types:
use CHECKCAST, do not introduce special intrinsics for safe-as.
2015-10-02 15:17:00 +03:00
Denis Zharkov
ea8ada4664 Fix accessor naming test: count only method declarations 2015-09-30 08:19:52 +03:00
Denis Zharkov
fd0c92e307 Record inner class info for interface and DefaultImpls 2015-09-30 08:19:51 +03:00
Denis Zharkov
a101fffd9a Change INTERFACE_IMPL_CLASS_NAME: $TImpl -> DefaultImpls 2015-09-30 08:19:51 +03:00
Valentin Kipyatkov
069ce12604 Accessor naming should be locale-independant 2015-09-29 18:32:24 +03:00
Valentin Kipyatkov
420c6856be Changed naming algorithm of accessor name generation: "isXXX" and "kClass" cases affected 2015-09-29 18:32:24 +03:00
Alexander Udalov
1036506b25 Introduce new string table optimized for JVM class files
This format of the string table allows to reduce the size of the Kotlin
metadata in JVM class files by reusing constants already present in the
constant pool. Currently the string table produced by JvmStringTable is not
fully optimized in serialization (in particular, the 'substring' operation
which will be used to extract type names out of generic signature, is not used
at all), but the format and its complete support in the deserialization
(JvmNameResolver) allows future improvement without changing the binary version
2015-09-29 16:26:28 +03:00
Ilya Gorbunov
1622cf9506 Fix stdlib facade names in bytecode generation and decompilation tests. 2015-09-25 21:10:13 +03:00
Denis Zharkov
505cb37052 Generate deprecated flag on getter of const val's 2015-09-25 18:12:45 +03:00
Michael Bogdanov
cf57d56ab3 Don't generate private members in interface 2015-09-24 12:00:18 +03:00
Mikhail Glukhikh
a1e3471d92 "field": deprecated warnings introduced, compiler tests migrated to the new syntax 2015-09-21 15:48:00 +03:00
Ilya Gorbunov
e40a5457e3 Fix deprecations in testData: arrayOf usages. 2015-09-19 04:32:56 +03:00
Denis Zharkov
bae3320d52 Get rid of deprecated annotations in testData 2015-09-18 10:14:32 +03:00
Dmitry Petrov
1586a2df8e Make stdlib work with -Xmultifile-package-facades.
Fixed wrong owner mapping in presence of -Xmultifile-package-facades.
Fixed backing field mapping issue.
Added more tests.
2015-09-14 11:26:29 +03:00
Dmitry Petrov
a47eaa2cb5 Change part class naming scheme
update tests depending on part class naming
2015-09-07 16:28:42 +03:00
Mikhail Glukhikh
eab288bdd7 annotation() now has no arguments. Syntax migration to Retention / Repeatable / MustBeDocumented combination
Deprecated test for annotation(params) completion deleted. A lot of tests changed.
2015-09-04 19:21:12 +03:00
Denis Zharkov
26f9bd7b63 Deprecate some of JVM flag annotations in favor of capitilized themselves 2015-09-04 18:19:31 +03:00
Alexander Udalov
8d9618348d Move .java and .kotlin extension properties to kotlin.jvm
Delete the old ones in package kotlin.reflect.jvm because otherwise the code
using those functions will become red in a lot less meaningful way (overload
resolution ambiguity) than if they're deleted (unresolved import)

Based on the work originally done by @dnpetrov

 #KT-8380 Fixed
2015-08-27 08:19:50 +03:00
Mikhail Glukhikh
b2653ad1e9 Deprecated enum syntax removed: most compiler tests 2015-08-10 16:24:12 +03:00
Alexander Udalov
a0cc313156 Support class reference expression for reified type parameters
Also make KClass::java an intrinsic property.

Based on the work by @dnpetrov

 #KT-6976 Fixed
2015-07-30 12:18:28 +03:00
Mikhail Glukhikh
609d696202 Annotations have now retention of "RUNTIME" by default. Java retention is generated as given by kotlin annotation. Annotation rendering changed.
Annotation arguments with default values are rendered as ... if renderDefaultAnnotationArguments is true.
Tests: java retention does not taken into account by Descriptor comparator.
Java retentinon changed to kotlin retention in some tests + one new test with java retention added.
More accurate tests for intentions in byte code (visibility controlled).
2015-07-14 16:25:01 +03:00
Alexander Udalov
c3b97e0668 Simplify function hierarchy in reflection
Get rid of all classes except kotlin.reflect.KFunction, which will be used to
represent all kinds of simple functions.

Lots of changes to test data are related to the fact that KFunction is not an
extension function (as opposed to KMemberFunction and KExtensionFunction who
were) and so a member or an extension function reference now requires all
arguments be passed to it in the parentheses, including receivers. This is
probably temporary until we support calling any function both as a free
function and as an extension. In JS, functions and extension functions are not
interchangeable, so tests on this behavior are removed until this is supported
2015-07-10 20:10:08 +03:00
Dmitry Petrov
4e42cc6b81 Save/restore stack in try-expressions (and statements).
Parse TryCatchBlockNode's in generated bytecode, infer stack save/restore points.
Save stack to local variables before 'try'.
Restore stack after the beginning of try-block, catch-block, and default handler.
Integrate before/after inline markers rewriting (otherwise it'll break our stacks).

 #KT-3309 Fixed
2015-07-07 12:16:29 +03:00
Mikhail Glukhikh
5fabb962ae Private constructors are now accessed via synthetic constructor with DEFAULT_CONSTRUCTOR_MARKER as an additional argument #KT-6299 Fixed
A set of tests provided. Some external tests fixed accordingly.
Companion object creation changed accordingly.
Derived classes now can use base class with the private constructor.
Refactoring of AccessorForFunctionDescriptor.
2015-06-24 12:30:11 +03:00
Michael Bogdanov
b1c5002889 Remove finally marker at inlining 2015-06-24 09:48:55 +03:00
Michael Bogdanov
a018e4e12a Updated exception table generation: support new exception table in non-local returns 2015-06-24 09:48:55 +03:00
Alexander Udalov
4dcc373a5a Fix concrete method inheritance in interfaces
For each non-abstract non-declared (i.e. inherited from supertypes) method in
an interface we generate its static form to the TImpl, which calls the TImpl
method from the corresponding supertype.

The accidental override tests changed because we're now trying to generate the
delegate for the super method, not knowing that it will clash with the declared
method

 #KT-2888 Fixed
 #KT-5393 Fixed
2015-06-17 16:23:56 +03:00
Michael Bogdanov
319c5aec60 Fix for KT-7557: NoSuchMethodError when capturing receiver in object expression
#KT-7557 Fixed
   #KT-7769 Fixed
2015-05-21 10:06:01 +03:00
Dmitry Jemerov
4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Denis Zharkov
44a55e5bf6 Adjust testData to new labels syntax 2015-04-29 14:03:11 +03:00
Denis Zharkov
b2a2e4ae92 Add bytecodeText test for annotation with default value
It checks that no value is emitted if argument is not specified
2015-04-16 10:40:20 +03:00
Michael Bogdanov
e200b97ca4 Inline callable references
#KT-6900 Fixed
2015-04-13 16:11:21 +03:00
Michael Bogdanov
841b199d49 Optimize comparison with zero and null 2015-04-07 17:28:01 +03:00
Michael Bogdanov
c7fe8e0b66 Branched value refactoring, And/Or support 2015-04-07 16:05:42 +03:00
Michael Bogdanov
c63ac3e30a Test for KT-7222 Redundant boxing on toString call
#KT-7222 Fixed
2015-04-07 16:05:42 +03:00
Michael Bogdanov
0efe8890b8 Added new string tests 2015-04-07 16:05:42 +03:00
Stanislav Erokhin
3de0dff575 Migrate testdata to new lambda syntax 2015-04-07 13:08:53 +03:00
Stanislav Erokhin
b152211096 Added init keyword to testdata 2015-04-07 13:08:51 +03:00
Pavel V. Talanov
06916d98c6 default -> companion: replace all mentions of default and default object 2015-03-17 15:47:39 +03:00
Pavel V. Talanov
59f192ef90 Replace 'class object' with 'default object' in renderers and test data
Includes changes to decompiled text
Old syntax is used in builtins and project code for now
2015-03-06 19:36:54 +03:00
Evgeny Gerashchenko
14b16ff87c KT-6916 Slow bytecode for downTo iteration like for (i in max downTo min)
#KT-6916 fixed
2015-03-06 13:43:02 +03:00