Commit Graph

6615 Commits

Author SHA1 Message Date
Alexander Udalov 3eeccb407e Simplify and fix createReflectionTypeForCallableDescriptor
Previously its call sites needed to determine if the receiver type should be
ignored (e.g. if the reference is to static member or nested class constructor,
or if it's a bound reference), and 3 of 4 callers did it incorrectly. Simplify
this by passing the DoubleColonLHS instance everywhere.

Also rename it to createKCallableTypeForReference

 #KT-12738 Fixed
 #KT-12751 Fixed
 #KT-12799 Fixed
2016-06-22 21:35:57 +03:00
Alexander Udalov e68de436bb Allow data classes to inherit from other classes
#KT-10330 Fixed
2016-06-22 21:35:57 +03:00
Denis Zharkov 453ee55615 Fix coroutine generation in case of empty lambda
'handleResult' should be called in such case too
2016-06-21 15:52:44 +03:00
Denis Zharkov b6ccd03ef4 Make loops generation lazy
As well as all other kinds of expressions

While it's not necessary in a sense that 'for' loop can not be plain expression,
i.e. it can't be an argument for safe-call etc., but laziness is still very convenient property.

E.g. within attached test they were generated twice in case of last expression
of coroutine block, because coroutine related codegen part is built upon
assumption that all expressions should be generated lazy.
2016-06-21 15:52:44 +03:00
Denis Zharkov ad71934c55 Minor. Add 'operator' modifier in test for handleResult 2016-06-21 15:52:44 +03:00
Alexander Udalov 311301f430 Check return type when locating method in reflection
#KT-11824 Fixed
2016-06-20 21:03:51 +03:00
Denis Zharkov 5ee33e6ad5 Generate last expression in coroutine block even for Unit expected type 2016-06-19 12:50:54 +03:00
Denis Zharkov 96eb3f411d Minor. Simplify 'async' tests 2016-06-19 12:50:54 +03:00
Denis Zharkov 72eb87f5d0 Support inline suspend functions
A lot of additional work was required to support them:
- Suspension points are being identified by two markers
  instead of one pointing to suspend function call
- Approach with replacing return type of suspend function does not work anymore.
  So we decode suspension return type as an argument for begin marker
- It became necessary to perform variables liveness analysis
  (see comment in org.jetbrains.kotlin.codegen.coroutines.CoroutineTransformerMethodVisitor.spillVariables)
2016-06-19 12:50:54 +03:00
Denis Zharkov e7b9564699 Support coroutine lambda parameters in JVM backend 2016-06-19 12:50:53 +03:00
Denis Zharkov 07dcc6c616 Support 'handleException' operator in JVM backend 2016-06-19 12:50:53 +03:00
Alexander Udalov 6562a2db19 Type-check reference to property with invisible setter to KProperty
#KT-12337 Fixed
2016-06-19 12:45:22 +03:00
Alexander Udalov de986ed051 Do not skip synthesized members when generating bridges
The condition here is obsolete since SAM adapters can no longer be overridden:
they are now extensions in another scope

 #KT-12708 Fixed
2016-06-16 16:51:18 +03:00
Alexander Udalov b4f81d4bb5 Use 'JVM_TARGET: 1.8' directive in codegen tests on 1.8 target 2016-06-16 16:51:18 +03:00
Dmitry Petrov 9240c82934 KT-12733 'rangeTo' as a non-qualified call is not optimized in 'for'
Use ResolvedCall corresponding to 'for' loop range expression
for optimized "for-in-range-literal".
Cleanup.
2016-06-16 11:30:05 +03:00
Dmitry Petrov a17b0dd1b5 KT-5075 Optimize array/collection indices usage in 'for' loop
Use specialized 'for' loop code generation strategy for loops over array indices and collection indices.
2016-06-15 14:01:18 +03:00
Mikhael Bogdanov 1c3ce93275 Generate same delagation structure as in jvm 6 target until new binary compatibility design
We need to make some decision about binary compatibility beetwen targets and semantics, so now old logic is used
2016-06-15 13:43:29 +03:00
Mikhael Bogdanov bb59638039 Support bridges in interfaces. Fix for KT-12416: Missed bridges in js backend
#KT-12416 Fixed
2016-06-15 13:43:28 +03:00
Mikhael Bogdanov 16159c483d Generate defaults methods on extending jvm6 interfaces 2016-06-15 13:43:27 +03:00
Mikhael Bogdanov 331341bd4d Don't generate delegates on overriding jvm8 interfaces 2016-06-15 13:43:27 +03:00
Michael Bogdanov 01aa89b1ea Generate delegation body for default interface methods, calculate proper abstractness for them 2016-06-15 13:43:26 +03:00
Mikhael Bogdanov 77a386a266 Move java8 'compileKotlinAgainstKotlin' test under 'codegen/java8/compileKotlinAgainstKotlin/jvm6' folder 2016-06-15 13:43:24 +03:00
Stanislav Erokhin 03241419bd Minor. removed several tests with error calls. 2016-06-10 21:28:04 +03:00
Dmitry Petrov a4267f069d Codegen should just skip (local) type alias declarations. 2016-06-10 10:25:10 +03:00
Alexander Udalov 59342000ae Fix toString() and reflectLambda() for lambdas with generic types in signatures
#KT-10771 Fixed
2016-06-09 17:28:56 +03:00
Denis Zharkov 771cca9c23 Fix some try-catch block related problems in coroutine transformer
Split all try-catch blocks when they intersect suspension points
2016-06-08 18:53:16 +03:00
Denis Zharkov e802049fd0 Ignore handleReturn calls if functions is not operator 2016-06-08 18:53:16 +03:00
Denis Zharkov 692acc463a Fix handleResult call generation for statement-like last expression in a block 2016-06-08 18:53:16 +03:00
Denis Zharkov 0d01edb7f9 Adapt FixStackAnalyzer to code generated by coroutine transformation
Without this change internal error happens while inlining coroutine code with try/catch inside
Also get rid of hack with SKIP_MANDATORY_TRANSFORMATIONS_ANNOTATION_DESC
See comment within MethodAnalyzer for clarification
2016-06-08 18:53:16 +03:00
Denis Zharkov 678e8c2baa Setup label value in constructor to be invalid until 'invoke(Controller)' call 2016-06-08 18:53:16 +03:00
Denis Zharkov 2bdaec6eac Refine definition of whether call is suspension point
It's not about all calls to suspend functions, they may called from non-coroutine code
2016-06-08 18:53:16 +03:00
Denis Zharkov dddd7413a1 Fix generated code for suspending in the middle of object construction 2016-06-08 18:53:16 +03:00
Denis Zharkov b1189eff23 Make suspension calls generation more stable
Instead of performing signature change during transformation
it's convinient to make just when generating corresponding call,
for example there is no need to think about default parameters as they just work as is

See comment above replaceSuspensionFunctionViewWithRealDescriptor for clarification
2016-06-08 18:53:16 +03:00
Denis Zharkov 611490e080 Support non-local returns to coroutine label from inline lambda
- Use proper class descriptor when retreiving continuation object (see previous commit)
- Use return type as VOID for such cases
- Load correct labels related to coroutine lambda from outer context
2016-06-08 18:53:16 +03:00
Denis Zharkov 94bd6dcc82 Use proper coroutine class descriptor for extension receiver generation
Before this commit context.getThisDescriptor() has been used, that was quite correct
until suspension happens inside inlined lambda (it has different this-descriptor)
2016-06-08 18:53:16 +03:00
Denis Zharkov 75e112e752 Implement basic support for coroutines in JVM backend 2016-06-08 18:53:16 +03:00
Alexander Udalov 61290d1225 Temporarily disable inline for bound function references 2016-06-07 12:43:10 +03:00
Alexander Udalov b9e61f035f Support bound callable references in codegen 2016-06-07 12:43:09 +03:00
Dmitry Petrov df335b9e8d Type aliases: do not reparse RHS of type alias declaration in expanded type resolution 2016-06-03 16:07:20 +03:00
Mikhael Bogdanov 092be8ca8e Don't generate unnecessary checkcast to java.lang.Number 2016-06-02 16:01:05 +03:00
Mikhael Bogdanov a6cf169646 Fix for KT-12582: "VerifyError: Bad local variable type" caused by explicit loop variable type
#KT-12582 Fixed
2016-06-02 16:01:05 +03:00
Mikhael Bogdanov c7d97c63a8 Small refactoring in constant processing 2016-06-02 16:01:03 +03:00
Nikolay Krasko 3f4cde3d25 NoSuchFieldError in Evaluate Expression on a property of a derived class (KT-12206)
#KT-12206 Fixed
2016-06-02 14:39:51 +03:00
Dmitry Petrov c63166047c KT-11588 Type aliases
Additional tests for type alias constructor & companion object:
- codegen
- error diagnostics
2016-06-01 14:32:45 +03:00
Mikhael Bogdanov 0f1589fd50 Fix for KT-12200: initial property assignment ignored
#KT-12200 Fixed
2016-05-31 15:27:55 +03:00
Alexey Andreev 2bd807bb4e KT-11960: add test for case of instantiating inner class of a local class 2016-05-31 15:24:30 +03:00
Alexey Andreev acc5303731 KT-11960 Fix case of instantiation of local class via its inner class or via nested lambda. Move tests to more appropriate location. Fix bug in blackbox codegen generator for JVM, which does not allow to suppress tests. 2016-05-31 15:24:29 +03:00
Alexey Andreev 6f363a71be KT-11960 Fix for data classes 2016-05-31 15:24:29 +03:00
Alexey Andreev 170a671a1b KT-11960 Fix for case when class instantiates itself 2016-05-31 15:24:28 +03:00
Mikhail Glukhikh 8713190e33 Back-end JVM: more accurate handling of when expressions with Unit result #KT-12192 Fixed 2016-05-27 18:08:15 +03:00