Commit Graph

223 Commits

Author SHA1 Message Date
Denis Mekhanikov 1533c0e9f3 Support more than 32 default arguments
#KT-4675 Fixed
2014-08-20 20:47:34 +04:00
Alexander Udalov 99d4f97aef Fix access to top level delegated property from another property
#KT-5612 Fixed
2014-08-14 10:43:50 +04:00
Alexander Udalov 47d5f83d04 Report unmet trait requirements
#KT-3006 Fixed
2014-08-13 17:19:55 +04:00
Svetlana Isakova fb4c256d08 Added tests for choosing 'most specific' resolution candidate
Fixed test (while resolve with library on android): 'run' resolves to library function
2014-07-30 17:07:10 +04:00
Alexander Udalov 98ffdb3e32 Minor, delete Object from some test data 2014-07-25 21:19:39 +04:00
Alexander Udalov fb958897a9 Introduce kotlin.Cloneable
- Cloneable is a trait with a single protected member 'clone', which is mapped
  to java.lang.Cloneable on JVM
- 'clone' is non-abstract to be able to call 'super.clone()' in the
  implementations. Also if you need your class to be Cloneable, most of the
  time inheriting from Cloneable and calling 'super.clone()' will work
- hack 'super.clone()' in JVM intrinsics and TImpl delegation generation
- make arrays Cloneable, handle 'clone()' calls in the intrinsic

 #KT-4890 Fixed
2014-07-25 21:19:39 +04:00
Alexander Udalov a79398fa00 Don't load Object as a supertype for Java classes
#KT-4890 In Progress
 #KT-5002 Fixed
2014-07-25 21:19:37 +04:00
Zalim Bashorov c767ffc3e7 Unit.VALUE -> Unit in testData 2014-07-25 17:16:40 +04:00
Alexander Udalov 65c21561a4 Fix super constructor calls of anonymous objects and local classes
If a class inherits from another class which captures something (outer class
instance, receiver parameter, local variables, etc.), the constructor of the
former class should contain all the parameters of the super constructor as its
own parameters, so that it could make a proper super call. All such parameters
are now replicated in the derived constructor with kind = SUPER_CALL_PARAM,
except an instance of the outer class (kind = OUTER), which can be taken from
the derived's own OUTER when it has one, to prevent multiple passing of the
same argument.

Previously it worked only when inheriting from inner classes via a special hack
(ConstructorFrameMap).

Also reuse recently introduced ArgumentGenerator to automatically take care of
default and vararg arguments of super constructor

 #KT-3581 Fixed
 #KT-5342 Fixed
 #KT-5343 Fixed
2014-07-18 16:26:46 +04:00
Alexander Udalov a07909bb52 Don't generate unnecessary accessors for private class properties 2014-07-17 19:18:05 +04:00
Andrey Breslav 777f3d1341 Codegen tests now fail on JVM-specific errors 2014-06-19 22:11:57 +04:00
Alexander Udalov d78d4bc44c Disallow extension properties with backing fields
#KT-1682 Fixed
2014-05-29 21:24:05 +04:00
Alexander Udalov 6210e45fbc Minor, improve test case for KT-1157
Multithreaded version was not working correctly and was throwing NPEs in the
log sometimes
2014-05-29 21:07:34 +04:00
Alexander Udalov 9760f30c99 Don't allow fake override to inherit implementation with wrong return type
#KT-4763 Fixed
2014-05-22 19:32:10 +04:00
Andrey Breslav 773cb9efbe Signature comparison used to find super functions in SignaturesPropagationData
#KT-4509 Fixed
2014-05-21 15:26:05 +04:00
Alexander Udalov 41eb0deaa0 Introduce FunctionImpl and ExtensionFunctionImpl classes
Old FunctionImpl0,1,2,... will be dropped since they had no purpose
2014-05-19 19:50:58 +04:00
Alexander Udalov c7a7f31e82 Introduce module 'reflection', move KFunctionN to it
Metadata for KFunction classes is now longer serialized along with built-in
classes. This effectively means that it's no longer possible to find KFunction
classes via dependency on built-ins. There should be a kotlin-runtime library
in the specified classpath for reflection types to be resolvable.

A lot of tests were moved and changed, because tests on callable references
require stdlib in classpath from now on
2014-05-19 19:50:57 +04:00
Mikhael Bogdanov 6fb0050575 KT-4982 this$0 is not initialized in the anonymous object
#KT-4982 Fixed
2014-05-16 13:33:39 +04:00
Alexander Udalov 3a0aac4857 Simplify type mapping logic in CodegenBinding
- inline asmType to calling getAsmType, which does something more
- refactor getJvmInternalName to use getAsmType as well
- simplify getAsmType and fix a probable bug in mapping singletons nested in
  enums (which wasn't reproduced, though a test is added)
- delete unnnecessary ASM_TYPE recording for enum entries in
  CodegenAnnotatingVisitor
2014-05-08 16:45:15 +04:00
Alexander Udalov 51b01b5d7d Replace some REFERENCE_TARGET calls with RESOLVED_CALL
Also don't do unnecessary and failing casts in CodegenAnnotatingVisitor for SAM
adapters

 #KT-3173 Fixed
 #KT-3999 Fixed
 #KT-4682 Fixed
2014-05-05 16:49:23 +04:00
Denis Zharkov 3bc1c45fde Refactored tests for switch optimization of When expression 2014-04-25 18:17:36 +04:00
Denis Zharkov 95345a9bd4 Tests for switchOptimization: shuffled and added sparse version 2014-04-25 18:17:36 +04:00
Denis Zharkov 1952781e4b SwitchOptimization: generating `lookupswitch' opcode for 'when' in case of integral types 2014-04-25 18:17:36 +04:00
Denis Zharkov c73533d214 Switch Optimization 2014-04-25 18:16:24 +04:00
Alexander Udalov 61675de305 Optimize PropertyMetadataImpl instance creation
Create all property metadatas in <clinit> and save them to a static array
$propertyMetadata. Getter/setter of each delegated property will then just
obtain the corresponding instance from that array

 #KT-4232 Fixed
2014-04-24 16:10:15 +04:00
Alexander Udalov f7235e9d82 Fix abstract nested class in enums in JVM back-end
It caused InstantiationError because the enum had an incorrect ACC_ABSTRACT
flag
2014-04-24 16:10:13 +04:00
Alexander Udalov fbf9f5f7d0 Don't generate bridges for equals(), hashCode(), toString()
Otherwise an assertion is failing in the algorithm which is related to an
inconsistency of java.lang.Object inheritance in JDR (KT-4890)
2014-04-24 16:10:12 +04:00
Alexander Udalov 79e7ee91e4 Generate bridges for trait implementations properly
The intent was to keep the bridge codegen model as simple as possible: we
should be able to figure out all necessary bridges only by a minimal interface
that FunctionHandle provides (isAbstract, isDeclaration, getOverridden)

Add different tests for bridges

 #KT-318 Obsolete
2014-04-11 21:57:47 +04:00
Alexander Udalov b0db6a4526 Rewrite bridge generation to Kotlin, make it abstract 2014-04-11 21:57:46 +04:00
Alexander Udalov fc838dbb53 Refactor ImplementationBodyCodegen.getTraitImplementations()
Make it static, extract a method which finds an implementation in a trait for a
fake override
2014-04-11 21:57:46 +04:00
Alexander Udalov 478766815d Consider all real functions, not only declarations in bridge codegen
There should be bridges to all of the functions present in bytecode
2014-04-11 21:57:45 +04:00
Alexander Udalov 04c237cc22 Generate bridges for fake overrides when needed
#KT-3985 Fixed
 #KT-4145 Fixed
2014-04-11 21:57:44 +04:00
Mikhael Bogdanov e2f3a589e7 KT-3308 Support local generic functions in codegen
#KT-3308 Can'tReproduce
2014-04-01 11:18:16 +04:00
Mikhael Bogdanov 4269729b0a KT-3214: Verify error when get array convention is used with varargs
#KT-3214 Can'tReproduce
2014-04-01 11:18:16 +04:00
Mikhael Bogdanov 596dc68ea4 KT-4340: Jvm backend generates invalid synthetic accessor for private extension property 2014-04-01 11:18:15 +04:00
Mikhael Bogdanov 0d239a3e0e Moving local fun callee generation to CallReceiver 2014-03-31 20:04:10 +04:00
Mikhael Bogdanov c7c1e33655 Move local fun callee generation to pushArgumentsWithCallReceiver.
Local fun callee generation via resolvedCall.resultingDescriptor not call
2014-03-31 20:03:43 +04:00
Alexander Udalov ea4daed0ac Use FqNameUnsafe instead of FqName in JVM intrinsics
#KT-4777 Fixed
2014-03-27 22:46:44 +04:00
Alexander Udalov 0deea6b83c Add test for obsolete issue
#KT-1936 Obsolete
2014-03-27 03:06:59 +04:00
Evgeny Gerashchenko 537c03fb1a Added test checking that initialization order in package part is not violated. 2014-03-25 14:31:41 +04:00
Svetlana Isakova a829da185d Resolve invoke on any kind of expressions, not only on simple name expressions 2014-03-20 10:05:24 +04:00
Alexander Udalov 7a2fce4fba Add regression tests for obsolete issues
#KT-2592 Obsolete
 #KT-2768 Obsolete
2014-03-16 03:18:26 +04:00
Svetlana Isakova 4771986b32 KT-4656 Wrong capturing a function literal variable.
#KT-4656 Fixed
 Reference for calleeExpression is recorded only in 'doResolveCallOrGetCachedResults'.
2014-03-08 20:55:45 +04:00
Andrey Breslav 2a0ccb95b1 Support quotes at the end of a raw string
Fix for KT-4650 Can't use double quote at the end of the raw string

#KT-4650 Fixed
2014-03-07 19:38:58 +04:00
Alexander Udalov f7b6457139 Replace "jet" package name with "kotlin" in testData 2014-03-02 19:55:26 +04:00
Alexander Udalov 5d6d4406cb Move FunctionImpl classes from package "jet" to "kotlin" 2014-03-02 19:54:56 +04:00
Alexander Udalov b68e47f705 Move JVM-specific annotations out of built-ins
Move 'volatile' and 'synchronized' to package 'kotlin' in stdlib. Also delete
'atomic', since its support was never implemented
2014-03-02 19:54:55 +04:00
Alexander Udalov 774e5f0535 Sort out JVM intrinsics for equals, hashCode, toString 2014-03-02 19:54:55 +04:00
Alexander Udalov 3dcd85bdb4 Add toString() to Any, fix all tests
#KT-4517 Fixed
2014-03-02 19:54:49 +04:00
Alexander Udalov ec30d52978 Delete Hashable, pull up its members to Any
Extensions on nullable types remain in Library.kt

 #KT-1741 Obsolete
 #KT-2805 Obsolete
 #KT-1365 Fixed
 #KT-4517 In Progress
2014-03-02 19:54:08 +04:00