Commit Graph

2973 Commits

Author SHA1 Message Date
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 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
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 1a8181bdc4 Only private constructors for sealed / enum classes #KT-12377 Fixed
Also #KT-8497 Fixed
2016-05-23 13:08:57 +03:00
Alexey Andreev f0ee52faaf KT-11086 Treat initializer of a companion object as a class initializer 2016-05-23 12:22:50 +03:00
Dmitry Petrov a4406687f1 KT-11588 Type aliases
Resolution & expansion for type aliases.
NB: Nested type aliases capturing type parameters of outer classes are not supported yet.
2016-05-20 14:17:24 +03:00
Alexander Udalov 1c8272d3f1 Simplify data class function generation and signature lookup code
- change prerequisites for generating equals/hashCode/toString in a data class:
  previously they were generated if the corresponding method is trivial (i.e.
  it comes from kotlin.Any), now we're generating it always unless it'll cause
  a JVM signature clash error (see KT-6206)
- use static KotlinBuiltIns.isXxx methods to compare types instead of checking
  against descriptors loaded from certain built-ins instance, this is quicker
  and more correct in environments where several built-ins are possible
- don't use isOrOverridesSynthesized, it's not relevant for
  equals/hashCode/toString because functions with these names are never
  synthesized

 #KT-6206 Fixed
2016-05-20 00:54:19 +03:00
Stanislav Erokhin 7332032bb6 Support sealed class inheritors in the same file
#KT-11573 Fixed
2016-05-19 16:22:40 +03:00
Mikhail Glukhikh a4ad995f31 Overridden functions using default arguments in recursive call are no more considered tail recursive #KT-4285 Fixed 2016-05-17 14:29:01 +03:00
Mikhail Glukhikh f35fd32a25 Exhaustive when with 'Unit' result now also generates an exception in else branch #KT-12192 Fixed 2016-05-17 14:28:57 +03:00
Denis Zharkov d0acb3674a Fix rendered testData
New members in enum member scope
2016-05-16 15:38:13 +03:00
Mikhael Bogdanov ec632c37ab Support increment and '+=' on local delegated properties 2016-05-13 19:11:21 +03:00
Dotlin 4c223845b6 Delegated Properties: Code generation for local properties (JVM) 2016-05-13 19:11:19 +03:00
Mikhael Bogdanov d6a64af929 Fix for KT-12125: Wrong increment/decrement on Byte/Char/Short.MAX_VALUE/MIN_VALUE
#KT-12125 Fixed
2016-05-11 18:07:25 +03:00
Mikhael Bogdanov ca31ce8d88 Support new tests on android, disabled not applicable ones 2016-05-06 17:31:53 +03:00
Mikhael Bogdanov ee7bbbf530 Fix for KT-12127: Undeclared type variable on delegated property backing field
#KT-12127 Fixed
2016-05-04 17:07:48 +03:00
Michael Bogdanov e2ae2f313c Support test with self imports, kotlin multifile tests 2016-04-29 16:33:04 +03:00
Alexey Andreev 4ac730e5ed KT-11030 Fix referencing wrong field generated for captured variable when this captured variable referenced both from constructor and non-constructor method. Avoid duplicate generation of call to delegated constructor. 2016-04-20 18:12:24 +03:00
Alexey Andreev a5e0c70988 KT-11611 Prevent duplicate generation of default values of secondary constructor parameters 2016-04-20 18:12:23 +03:00
Alexey Andreev 7afca74b94 KT-11030 When constructor of object expression calls super constructor, place this call at object creation instead of object's constructor. This allows to capture outer this reference properly in certain cases. JVM backend uses the same approach 2016-04-20 18:12:23 +03:00
Alexey Andreev b39c16cb6c KT-11030 Fix translation of secondary constructors of inner classes 2016-04-20 18:12:22 +03:00
Alexey Andreev 3e11209d8a KT-11030 Borrow test for local classes from JVM backend 2016-04-20 17:49:03 +03:00
Dmitry Petrov e441f0509f KT-11943 Do not use intrinsic 'java' property if receiver type is not acceptable 2016-04-19 10:31:30 +03:00
Dmitry Petrov 583733be8d KT-11645 properly handle private property getter name mangling in reflection 2016-04-14 09:31:29 +03:00
Dmitry Petrov 511a7e0072 KT-11645 generate backing field for 'private const val' in part implementation class 2016-04-14 09:31:29 +03:00
Dmitry Petrov aca7050656 KT-11499 Normalize stacks on return from an inline function when the function is inlined at call site. 2016-04-08 14:52:55 +03:00
Alexander Udalov c4a568efff Minor, add test cases for obsolete protected-related issues 2016-04-07 00:07:11 +03:00
Michael Bogdanov dec53c8d6c Fix for KT-11762: "VerifyError: Bad local variable type" caused by explicit loop variable type
#KT-11762 Fixed
2016-04-05 13:37:10 +03:00
Dmitry Petrov db58ebc4b2 KT-11410: Class hierarchy for parts/facade of multi-file class.
Preserve static initialization semantics for parts by introducing a special "clinit trigger" class.
Insert "static initialization trigger" call to every method of a part class, remove this call on inline.
Always mangle names for private functions in multifile class parts to avoid resolution clashes on inheritance.

NB in codegen tests initializers for all non-const vals are wrapped in 'run { ... }',
so that the initializer is not a constant expression, and some static initialization code should be generated.
2016-04-01 10:13:22 +03:00
Mikhail Glukhikh 4c03aaabd4 Implicit nothing / intersection types are now checked also for member functions #KT-11666 Fixed 2016-03-31 11:59:17 +03:00
Mikhail Glukhikh b7e8f71367 Fix of getCorrespondingLoop for complex loop / try-finally trees #KT-8246 Fixed 2016-03-30 18:49:23 +03:00
Alexander Udalov a8bebeb48d Load annotations of const properties from multifile classes
Rework backing field generation logic in PropertyCodegen to switch the
ClassBuilder instance for a multifile part to that of the corresponding facade
class. This became needed because multifile parts, and their metadata, are
generated _before_ the multifile facade class and otherwise we would never
record that there's a synthetic '$annotations' method for a const val and would
not write that to the protobuf message for the property.

See also bad83200

 #KT-10892 Fixed
2016-03-28 21:11:14 +03:00
Alexander Udalov 6924d883eb Support reflection calls to multifile class members
#KT-11447 Fixed
2016-03-28 21:11:14 +03:00
Michael Bogdanov 0fdba49315 Test for KT-11514: Platform Double is converted to Int when comparing to Int literal
#KT-11514 Fixed
2016-03-24 14:11:25 +01:00