Commit Graph

45 Commits

Author SHA1 Message Date
Zalim Bashorov
675c1df26c [JS BE] Fix the crash on compound operations with a qualified call on left side
#KT-22001 Fixed

(cherry picked from commit 9349b9b)
2018-03-28 22:51:57 +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
Zalim Bashorov
596f3364c6 Automatically mute failed tests 2016-11-09 21:41:12 +03:00
Michael Bogdanov
16afe74dc1 Fix for KT-11117: Android Kotlin DEX transformation error when I use arrayOf as an anonymous object property
#KT-11117 Fixed
2016-02-29 12:53:58 +03:00
Alexander Udalov
75f046fa81 Drop Throwable#printStackTrace, make it a JVM-specific extension 2015-12-25 20:16:18 +03:00
Mikhail Glukhikh
ea4f167091 Calls to non-@JvmStatic protected members of companion objects from subclasses are now errors (unsupported yet) 2015-11-27 15:58:38 +03:00
Yan Zhulanow
9d1af5a17e Fix tests: "infix modifier required" and "operator modifier required" errors 2015-11-27 15:51:11 +03:00
Mikhail Glukhikh
8d88109c00 Underscore names are now forbidden 2015-10-19 15:24:45 +03:00
Dmitry Petrov
7e51fb8521 Check for exposed local classes (or objects) in type signatures 2015-10-12 15:24:54 +03:00
Mikhail Glukhikh
d1ab5168ec Error messages about "var with open / custom setter initialization" changed accordingly with the new backing field syntax 2015-10-09 21:06:29 +03:00
Mikhail Glukhikh
6914d09297 Old backing field with dollar is now forbidden 2015-10-09 21:06:26 +03:00
Michael Bogdanov
7fe71d21f3 Initialize class companion object fields on accessing its java class 2015-10-09 16:25:16 +03:00
Dmitry Jemerov
7c20630272 diagnostics for deprecated syntax of function type parameter list 2015-10-06 16:20:47 +02:00
Pavel V. Talanov
37d5c4b223 Allow to import members from object by name
Wrap object members so they do not require dispatch receiver
Hack jvm backend to make it work
2015-10-06 16:31:21 +03:00
Mikhail Glukhikh
b2653ad1e9 Deprecated enum syntax removed: most compiler tests 2015-08-10 16:24:12 +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
Pavel V. Talanov
06916d98c6 default -> companion: replace all mentions of default and default object 2015-03-17 15:47:39 +03:00
Stanislav Erokhin
a33450395c Resolve parenthesized element as expression 2015-03-12 17:11:43 +03:00
Pavel V. Talanov
59f192ef90 Replace 'class object' with 'default object' in renderers and test data
Includes changes to decompiled text
Old syntax is used in builtins and project code for now
2015-03-06 19:36:54 +03:00
Denis Zharkov
654411a0b0 Refactored tests using Array constructor:
Some moved to tests with stdlib
Some changed to use arrayOfNulls
2014-12-11 16:04:03 +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
19497262b3 Don't lookup built-in classes by invalid names
#KT-5869 Fixed
2014-09-26 18:48:43 +04:00
Alexander Udalov
483232a3e5 Minor, add test for obsolete issue
#KT-5159 Obsolete
2014-09-17 21:20:57 +04:00
Alexander Udalov
81004889eb Fix initialization of object's INSTANCE$ field
Call object's constructor in <clinit> and ignore the result, but in the first
line of <init> save the current "this" to INSTANCE$

 #KT-4516 Fixed
 #KT-4543 Fixed
 #KT-5291 Fixed
 #KT-5523 Fixed
 #KT-5582 Fixed
2014-09-11 17:56:43 +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
Svetlana Isakova
7f33ad90a6 Report 'nested class accessed via instance reference' error 2014-09-01 12:32:50 +04:00
Alexander Udalov
98ffdb3e32 Minor, delete Object from some test data 2014-07-25 21:19:39 +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
Alexey Sedunov
6dfad69434 Allow super calls in object declarations 2013-11-26 17:29:59 +04:00
Mikhael Bogdanov
318214b9d7 Capturing this in constructor context
KT-4086 VerifyError creating anonymous object in constructor
 #KT-4086 Fixed
2013-10-31 16:42:53 +04:00
Mikhael Bogdanov
8ac8798266 Fix for KT-3684: IllegalAccess on a private property of the outer class
#KT-3684 Fixed
2013-06-18 11:20:44 +04:00
Evgeny Gerashchenko
b9e5704057 Updated test data and stdlib sources. 2013-02-13 18:08:37 +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