Commit Graph

43 Commits

Author SHA1 Message Date
pyos
82ccf81da8 Fix this remapping in inner class constructors
Inner class constructors should use the argument instead of reading
outer `this` from a field because if such an access happens before a
delegating constructor call, e.g. when evaluating an argument, a JVM
bytecode validation error will be thrown. (The only operation on `this`
allowed before a delegating constructor call is SETFIELD, and only if
the field in question is declared in the same class.)
2019-03-19 09:20:41 +01:00
Dmitry Petrov
202e992ae3 psi2ir: handle 'this' as reference to a super companion object
In super class constructor arguments, 'this' can be resolved
as a reference to a companion object of a superclass.
This breaks an assumption in psi2ir that 'this' can only refer to some
receiver from the current scope.

If 'this' refers to an 'object' (including 'companion obejct'),
and we are not inside the corresponding class scope,
then 'this' represents a reference to a singleton instance "by name"
(represented as IrGetObjectValue).
2019-01-21 10:56:02 +03:00
Alexander Udalov
cca6ba38be Add tests for obsolete codegen issues
#KT-16790 Obsolete
 #KT-16858 Obsolete
 #KT-17441 Obsolete
2019-01-09 19:18:54 +01:00
Roman Artemev
fb709cae92 [JS IR BE] Fix private field names 2018-11-01 16:18:44 +03:00
Georgy Bronnikov
376eef05f5 JVM_IR. Accessor lowering 2018-10-15 21:52:50 +03:00
Anton Bannykh
2e709a81fa [JS IR BE] Arrays, varargs 2018-09-18 14:36:20 +03:00
Roman Artemev
8a871b3f0c Update tests 2018-08-31 15:34:18 +03:00
Mikhael Bogdanov
357359b1dd Unmute ir-tests after CR support 2018-08-09 14:22:50 +03:00
Mikhael Bogdanov
06b16a6459 Unmute ir-tests after prev commit 2018-08-09 14:22:46 +03:00
Mikhael Bogdanov
2884d728fd Mute/unmute jvm_ir tests 2018-08-01 12:29:24 +02:00
Zalim Bashorov
74df1208ae Make "localClassCaptureExtensionReceiver" test more robust and mute it for JS IR BE 2018-07-13 23:42:41 +03:00
Svyatoslav Kuzmich
77ad97a39e [JS IR BE] Bridges construction 2018-07-10 14:11:09 +03:00
Anton Bannykh
07b3b66fd9 JS IR: unmute tests 2018-07-10 13:34:19 +03:00
Mikhael Bogdanov
e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Anton Bannykh
04a2ffc0c1 JS IR: unmute tests 2018-06-21 13:27:17 +03:00
Anton Bannykh
9039b75c25 JS IR: unmute tests 2018-06-21 13:27:17 +03:00
Anton Bannykh
b551afb202 JS IR: minor fix for callable ref translation
The caching variable has to have no initializers so that there is no
dependence on evaluation order.
2018-06-18 13:15:19 +03:00
Roman Artemev
6ac4fd2e5f [JS IR BE] Update test data 2018-06-14 19:54:30 +03:00
Anton Bannykh
96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Alexander Udalov
b925b6ef9f Add test for obsolete issue
#KT-10494
2018-01-12 12:50:38 +01:00
Dmitry Petrov
cbef372e69 Recapture shared variables when calling local class constructor
When a local function or class A creates an instance of a local class B
capturing an outer variable 'x', it should use ref for 'x', but not the
value of 'x'.
2017-10-30 15:19:13 +03:00
Alexey Andreev
1f643ddce8 JS: add test to prove that KT-11910 is not reproducible anymore 2017-10-30 13:12:12 +03:00
Igor Chevdar
d7e4350d42 Ignored/fixed some tests for Kotlin/Native 2017-06-28 12:54:32 +03:00
Alexey Andreev
383e273fed In LightAnalysisModeTestGenerated skip tests ignored in JVM
When a test is marked as ignored in JVM BE (i.e. IGNORE_BACKEND: JVM)
it's ignored in LightAnalysisModeTestGenerated. This means that
this tests is expected to fail. However, often tests that fail
in JVM blackbox tests, don't fail in LAMTG, therefore it's reasonable
to skip these tests in LAMTG at all.
2017-05-29 15:30:27 +03:00
Alexey Andreev
87f4e53544 JS: when translating nested classes of local classes, capture closure variables via outermost local class. See KT-12566 2016-12-15 19:05:34 +03:00
Anton Bannykh
7ee3baa020 Replaced when appropriate 'TARGET_BACKEND: JVM' -> 'IGNORE_BACKEND: JS'. Enabled some succesfully working decompiledText tests. 2016-10-27 14:17:25 +03:00
Alexey Andreev
16af7d667f KT-12868: if a property initializer is a complex expression that emits additional statements, emit these statements directly before assignment to the property, not at the beginning of constructor 2016-09-09 13:54:03 +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
Denis Zharkov
9dada595b6 Replace deprecated annotations with modifiers in testData 2015-09-18 10:14:41 +03:00
Denis Zharkov
c9f79c2d05 Adjust testData: get rid of obsolete annotations 2015-06-12 09:23:31 +03:00
Michael Bogdanov
eb8d2d695c Test for non-general case of KT-4174 2015-05-15 18:06:51 +03:00
Dmitry Jemerov
4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Stanislav Erokhin
b152211096 Added init keyword to testdata 2015-04-07 13:08:51 +03:00
Alexander Udalov
61674fb3d9 Don't put outer instance twice for anonymous object extending inner
#KT-5343 In Progress
2014-10-16 16:16:54 +04:00
Alexander Udalov
7315146753 Fix and refactor ExpressionCodegen#pushClosureOnStack
- change Closure parameter to ClassDescriptor, load closure in the beginning
- invert and rename boolean parameter, also use it only to prevent pushing
  dispatch receiver (not the extension receiver) onto the stack because the
  only non-trivial usage of it is preceded by manual handling of the dispatch
  (not extension) receiver. This fixes innerOfLocalCaptureExtensionReceiver.kt
2014-10-16 16:16:54 +04:00
Michael Bogdanov
d0d207f387 Fix for KT-3584: Wrong bytecode generated for local class with default parameters and captured local val
#KT-3584 Fixed
2014-10-07 10:13:53 +04:00
Svetlana Isakova
9d366cb896 Prohibit local objects and enum classes
#KT-5402 Fixed
  #KT-4838 Fixed

Resolve type of object inside local object as special, not supertype('Any').
Changed visibility of constructor of anonymous object to 'internal' to be able to resolve the following:
fun box(): String {
    var foo = object {
        val bar = object {
            val baz = "ok"
        }
    }
    return foo.bar.baz
}
The containing declaration of property initializers is constructor, so 'baz' was invisible inside private constructor.
2014-09-01 12:32:52 +04:00
Alexander Udalov
3dcd85bdb4 Add toString() to Any, fix all tests
#KT-4517 Fixed
2014-03-02 19:54:49 +04:00
Alexey Sedunov
adddb70e50 Add codegen tests for local classes/objects declated in class initializers or class parameter initializers 2014-01-15 16:49:28 +04:00
Mikhael Bogdanov
4ef2f997ed Test for not reproduced KT-2700
#KT-2700 Can't Reproduce
2013-06-17 10:39:23 +04:00
Mikhael Bogdanov
aa2db75266 KT-3389: Local class construction results in CompilationException && KT-2873 && KT-3210
KT-2873: VerifyError on instantiating a local class inside a closure
KT-3210 Inline Class: CompilationException: Back-end (JVM) Internal error: wrong code generated java.lang.ArrayIndexOutOfBoundsException null

 #KT-3389 Fixed
2013-04-24 13:49:47 +04:00
Alexander Udalov
41a416da60 Move blackBoxFile() testData to box/ directory
Delete all test methods (and empty test classes), since they'll be
auto-generated
2013-01-28 18:20:17 +04:00