Commit Graph

82 Commits

Author SHA1 Message Date
Mikhail Glukhikh
15f373a864 FIR2IR: support object receiver case (this fixes 24 black box tests) 2019-12-27 13:46:05 +03:00
Georgy Bronnikov
094de9fb5e IR: Do not capture variables from method calls in ClosureAnnotator
To call a method of a class, you never need to supply any values of
local variables (they would always be provided to the constructor).
2019-12-10 17:31:12 +03:00
pyos
939a9ff53e JVM_IR: fix NPE in interface companion initializers
* When referencing the companion itself, they should use the $$INSTANCE
  field, not the (null until <clinit> returns) Companion field of the
  interface.

* Interface companion init blocks should be made static.
2019-11-20 14:37:19 +01:00
Mark Punzalan
9df2f69f09 [FIR] Disable failing blackbox codegen tests for FIR. 2019-11-19 11:00:09 +03:00
Steven Schäfer
f34a08cbbf JVM IR: Convert interface companion fields to static fields. 2019-08-08 12:01:52 +02:00
Steven Schäfer
efb938a7c8 (Un)mute tests 2019-07-31 11:18:44 +02:00
Alexander Udalov
385366384c Psi2ir: ignore unresolved annotations
Note that the test is an exact copy of an existing test
missingDependencyNestedAnnotation, but with -Xuse-ir
2019-07-15 18:40:00 +02:00
Mikhael Bogdanov
f2a51d3b80 Support reflection tests on Android 2019-01-26 08:26:49 +01:00
Svyatoslav Kuzmich
aa811dcfb3 [JS IR BE] Add KJS_WITH_FULL_RUNTIME directive to compiler tests 2019-01-24 16:14:40 +03:00
Mikhael Bogdanov
02d9c526e2 Proper resort variables on inlining lowered ir closures
Original problem is that lowered ir closures doesn't meet inliner expectations
 about captured variable position in inlining method.
 E.g.: Call 'foo(valueParam) { capturedParam }' to
  inline function 'foo' with declaration

      inline fun foo(valueParam: Foo, inlineParamWithCaptured: Bar.() ->) ....

 is reorganized through inlining to equivalent call foo(valueParam, capturedParam1, cp2 ...).
 But lowered closure for lambda parameter has totally different parameters order:

     fun loweredLambda$x(extensionReceiver, captured1, cp2..., valueParam1, vp2...)

 So before inlining lowered closure should be transformed to

     fun loweredLambda$x(extensionReceiver, valueParam1, vp2..., captured1, cp2..)

 #KT-28547 Fixed
2019-01-03 07:57:36 +01:00
Mikhael Bogdanov
3ef06c1e44 Specify JVM target backend for test with 'import java...' 2018-12-21 16:09:06 +01:00
Alexander Udalov
5b58eb8491 Remove LANGUAGE_VERSION from non-coroutine codegen tests
Most of these tests used this directive as a way to opt in to a new
language feature, and most of those features are already stable for a
long time, so no opt-in is needed. Some other tests used the directive
to opt out from a language feature, replace those by the `LANGUAGE`
directive. One test used the directive to test behavior that actually
depended on the API version; use `API_VERSION` directive there instead.
2018-12-20 12:53:23 +01:00
Roman Artemev
256317da15 [IR BE] Fix SharedVariableLowering
* make it able to detect shared vars under any declaration kind, not only IrFunction
 * Add & update tests
2018-12-18 15:19:17 +03:00
Georgy Bronnikov
605afbae90 Move fields and init blocks of companions to their owners 2018-10-17 21:15:28 +03:00
Georgy Bronnikov
376eef05f5 JVM_IR. Accessor lowering 2018-10-15 21:52:50 +03:00
Svyatoslav Kuzmich
bdc3daf972 [JS IR BE] Support Enum::values 2018-10-10 19:35:17 +03:00
Anton Bannykh
8c6337f3f6 [JS IR BE]: support dynamic_var["foo"] = "bar"
Used EQ origin to detect. Added a test to check dynamic_var = "bar" case
is not affected
2018-10-10 13:43:22 +03:00
Georgy Bronnikov
ade640eadb JVM_IR. Support compile time constants 2018-10-01 12:25:55 +03:00
Dmitry Petrov
0dd04c3424 Postpone companion object field visibility
Have to reconsider this issue because of interface companion objects.
2018-09-27 10:35:23 +03:00
Dmitry Petrov
792ff3c39e Generate private interface companion object as package-private synthetic 2018-09-27 10:35:23 +03:00
Dmitry Petrov
7949ac1080 Use common instance receiver generation logic for 'this' expression
Otherwise it would skip private companion object accessor generation.
2018-09-27 10:35:23 +03:00
Georgy Bronnikov
487f500f85 Revert "JVM_IR. Support compile time constants"
This reverts commit 055215c54f.
2018-09-25 05:24:48 +03:00
Georgy Bronnikov
055215c54f JVM_IR. Support compile time constants 2018-09-25 01:38:51 +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
Roman Artemev
5dcb02466a Update test data 2018-08-24 15:49:13 +03:00
Roman Artemev
cc14442be1 Add tests for primitive companion object
Update test data
2018-08-24 14:58:42 +03:00
Svyatoslav Kuzmich
392ad521fd [JS IR BE] Reflection support 2018-08-15 13:35:14 +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
Svyatoslav Kuzmich
625983b28a [JS IR BE] Enum class lowering 2018-07-23 15:08:18 +03:00
Svyatoslav Kuzmich
1abb4f42ac [JS IR BE] Add ranges to runtime, rangeTo for primitive numbers 2018-07-17 20:18:29 +03:00
Mikhael Bogdanov
e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Dmitry Petrov
46a3f7420c When in debugger context, access private companion object directly 2018-06-26 16:46:55 +03:00
Dmitry Petrov
d35a92a81d Generate accessor for private companion object 2018-06-22 16:53:07 +03:00
Anton Bannykh
d938c91711 JS IR: top-level initializer lowering 2018-06-18 13:15:19 +03:00
Anton Bannykh
96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Zalim Bashorov
9349b9bc67 [JS BE] Fix the crash on compound operations with a qualified call on left side
#KT-22001 Fixed
2018-03-28 22:49:09 +03:00
Alexander Udalov
543db380d2 Use isJvmInterface in JVM back-end instead of isInterface
To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
2018-01-24 15:54:35 +01:00
Dmitry Petrov
70d3e6592d Unwrap object member imported by name before determining receivers
Existing code for receiver generation accidentally worked in most cases
for object members imported by name. However, it generated strange
bytecode (such as
    GETFIELD AnObject.INSTANCE
    GETFIELD AnObject.INSTANCE
    POP
), and worked incorrectly for augmented assignments.

 #KT-21343 Fixed Target versions 1.2.20
2017-11-27 17:15:16 +03:00
Mikhael Bogdanov
b73be50e5b Move object initialization from <init> to <clinit>
Codegen generates static backing fields for object properties.
  They are initialized in class constructor but some of them are final static
  and such access is prohibited in specification but it's allowed in
  java bytecode <= 1.8. Such access in 1.9 bytecode cause
  "IllegalAccessError: Update to static final field Object.INSTANCE
  attempted from a different method (<init>) than the initializer method <clinit>"

  Added additional hidden field in interface companion to pass out
  companion instance from <clinit>.

 #KT-15894 Fixed
2017-10-11 19:20:24 +03:00
Dmitry Petrov
82a9c35194 Fix self-reference to singleton in initializer
Singleton instance is "initialized" by delegating constructor call,
which is superclass constructor call in case of singletons (because
singletons can't have more than one constructor).

Singleton constructor is effectively split into two stages:
- before a super constructor call;
- after a super constructor call.

Before super constructor call, singleton instance can't be used directly
(see KT-20662), because neither 'this' nor static instance is
initialized yet. However, it can be used in closures, in which case a
static instance should be used (escaping uninitialized this is
prohibited by JVM). Actually using this static instance before it is
initialized (e.g., invoking a method that uses this singleton) will
cause a correct ExceptionInInitializerError.

After a super constructor call, static instance of a singleton may be
not initialized yet (in case of enum entries and interface companion
objects). However, we already have an initialized 'this', which we
should use for singleton references.

 #KT-20651 Fixed
2017-10-09 16:27:34 +03:00
Dmitry Petrov
d20af1133a Use captured instance in interface companion object initializer
Similar to enum entry initialization, when we have a companion object
in an interface, its constructor (or clinit) initializes its state
before the instance field in corresponding interface is initialized.
So, interface companion object must be accessed via a captured object
reference (#0, or #0.this$0 for inner anonymous objects).
2017-09-14 10:26:35 +03:00
Dmitry Petrov
9e6b706a03 Unwrap property imported from object on property access
#KT-18982 Fixed Target versions 1.1.5
2017-07-28 17:01:04 +03:00
Mikhail Zarechenskiy
e86d52b681 Fix return type of private members that return anonymous object
#KT-16813 Fixed

Anonymous objects returned from private-in-file members should behave as for private class members
2017-04-17 16:21:05 +03:00
Ilya Matveev
a5e4e0284e Mute some box tests for native backend
This patch mutes the following test categories:
   * Tests with java dependencies (System class,
     java stdlib, jvm-oriented annotations etc).
   * Coroutines tests.
   * Reflection tests.
   * Tests with an inheritance from the standard
     collections.
2017-03-10 19:59:37 +03:00
Ilya Gorbunov
0899a0fdda Make some tests JVM only 2016-11-21 18:20:33 +03:00
Ilya Gorbunov
38840bb529 Do not reference java.util in tests that run on JS backend. 2016-11-21 18:20:33 +03:00
Zalim Bashorov
bde9f99d7c Unmute already worked tests and regenerate tests 2016-11-15 22:11:09 +03:00
Zalim Bashorov
afa58599ec Specify target backend as JVM for SAM tests; mute other failed tests and regenerate tests. 2016-11-10 13:27:54 +03:00