Commit Graph

848 Commits

Author SHA1 Message Date
Vasily Levchenko ec68a3a24e IR: defaults: calculate right this dispatch receiver parameter.
previously in case:
```
fun box(): String {
    val a: A = B(1)
    a.copy(1)
    a.component1()
    return "OK"
}

interface A {
    fun copy(x: Int): A
    fun component1(): Any
}

data class B(val x: Int) : A
```

in stab `B::copy$default` `B::copy` called with `A::this` that behaviour isn't correct, should be `B::this` used.
2017-03-14 18:36:18 +03:00
Alexander Udalov b08ccf07cb Remove usages of Kotlin compiler built-ins (loaded from kotlin-compiler.jar's resources) (#323)
* Do not add dependency on compiler built-ins, add missing declarations

* Drop most usages of KonanPlatform.builtIns

Instead, lookup symbols through the module that is being compiled. This
should be more correct because KonanPlatform.builtIns represents
built-ins loaded from kotlin-compiler.jar's resources

* Minor, make Context.moduleDescriptor lateinit and not null

* Do not ever load KonanBuiltIns from Kotlin compiler anymore

KonanBuiltIns.builtInsModule is now always the module that is being
compiled at the moment. An instance of KonanBuiltIns is thus nothing
more than a helper that loads classes with some predefined names from
the module that is being compiled

* Temporarily disable a part of IR validation
2017-03-14 15:48:42 +03:00
Igor Chevdar ccbf4bb963 Supported KProperty2 and KMutableProperty2 (#340)
Consider this code:
object Delegate {
    operator fun getValue(t: Any?, p: KProperty<*>): String {
        return ""
    }
}

class A {
    val String.ext by Delegate
}

then the type of <p> is KProperty2 (it has 2 receivers).
2017-03-14 08:43:30 -04:00
Svyatoslav Scherbina c9e2b5ac69 backend: fix handling unreachable return from inlined function 2017-03-14 13:32:46 +07:00
Ilya Matveev d3945bff3b tests: Add fail() function to TestUtils 2017-03-13 19:03:57 +03:00
Igor Chevdar 1cd229d8e5 Default enum class should not have primary constructor. (#335)
* Default enum class should not have primary constructor.

* Made simple delegating constructor non-primary + some refactoring.

* Make singleton object constructor primary.
2017-03-13 11:46:11 -04:00
SvyatoslavScherbina b803e95c0b backend: fix kt6590_identityEquals.kt (#333)
Customize `===` for value types to achive the same behavior as with JVM BE
2017-03-13 16:45:33 +03:00
Ilya Matveev 20ffd6d90b tests: Add test for assertion fail 2017-03-13 16:25:48 +03:00
Ilya Matveev 97b5bb527d backend: Generate assert call depending on the compiler key 2017-03-13 16:25:48 +03:00
Ilya Matveev a181b0301e Update README.md and HACKING.md 2017-03-13 15:31:46 +03:00
Ilya Matveev bc074e6d39 tests: Update external tests (1.1.2-dev-393) 2017-03-13 15:31:46 +03:00
Ilya Matveev ac56fccb15 tests: Download test data as a teamcity artifact 2017-03-13 15:31:46 +03:00
Svyatoslav Scherbina 7751e66daa backend: validate IR module after every phase if -verify_ir is enabled 2017-03-13 17:07:55 +07:00
Svyatoslav Scherbina 95935921ba backend: implement simple IR validator 2017-03-13 17:07:55 +07:00
Svyatoslav Scherbina d4fc79da43 backend: fix type operator result type in autoboxing 2017-03-13 17:07:55 +07:00
Svyatoslav Scherbina 11f2ea7e38 backend: fix IrReturn type in enum class lowering 2017-03-13 17:07:55 +07:00
Svyatoslav Scherbina d49023e172 backend: fix null type in default arguments lowering 2017-03-13 17:07:55 +07:00
Svyatoslav Scherbina a41f575f52 backend/tests: add interop_opengl_teapot 2017-03-13 11:00:33 +07:00
Svyatoslav Scherbina 304a9ebd8e build/tests: support declaring tests to be manually executed 2017-03-13 11:00:33 +07:00
Svyatoslav Scherbina 7ad36ac035 backend: implement '-linkerArg' to pass arguments to the linker 2017-03-13 11:00:33 +07:00
Igor Chevdar ed2191b4a3 Initializers lowering fix: clone init blocks. (#321)
* Initializers lowering fix: clone init blocks.

In order to let following phases to modify IR we need to clone init blocks
for each constructor before inserting it.

* Used DeepCopyIRTreeWithDescriptors.

* Shared variables lowering must be performed before local functions lowering.

Local functions lowering makes all variables non-shared, thus they must be
transformed into Ref<> before this.

* Moved all initializers into a method.

In order not to deal with copying of IR at all it is easier to create a
method 'initialize' which will be called from each constructor.

* Used right parameters for call.

* If class has primary constructor then move initializers to it.

* review fixes
2017-03-10 19:02:02 +05:00
Alexander Gorshenev a995fbcb59 This is a simple command line tool for interop.
See INTEROP.md on how to use it.
2017-03-10 17:36:58 +04:00
Svyatoslav Scherbina 62e678a37a backend/tests: add inline21 2017-03-10 18:08:47 +07:00
Svyatoslav Scherbina 404be59f62 backend/tests: add missing task for inline20 2017-03-10 18:08:47 +07:00
Svyatoslav Scherbina 24d5bd966e backend/inline: rework getting lambda function from argument 2017-03-10 18:08:47 +07:00
Ilya Matveev ec52aad146 tests: Update some tests 2017-03-10 11:37:00 +03:00
Svyatoslav Scherbina 9e15873d6c backend/testUtils: add assertTrue and assertFalse 2017-03-10 15:30:18 +07:00
Svyatoslav Scherbina 06ba63af06 backend/tests/external: Mute tests with java collection inheritance 2017-03-10 15:03:43 +07:00
Svyatoslav Scherbina 7f72c1c037 backend/tests/external: Mute tests depending on Math 2017-03-10 15:03:43 +07:00
Svyatoslav Scherbina 13bbd7af81 runtime: use exitStatus == 1 if main finished with exception
Also update the corresponding test.
2017-03-10 14:34:10 +07:00
Ilya Matveev 853a40b230 tests: Mute tests with '::class' 2017-03-09 18:01:19 +03:00
Ilya Matveev fd64de3f23 backend: Fix lowering of default arguments to local functions
Fix:
external_codegen_blackbox_functions_localFunctions/kt3978.kt
external_codegen_blackbox_closures/kt5589.kt
2017-03-09 18:01:19 +03:00
Ilya Matveev 60bcc50340 tests: Mute tests with java collection inheritance 2017-03-09 18:01:19 +03:00
Igor Chevdar f4e29562f9 Cut references to local delegated properties.
References to local delegated properties are cut - it is forbidden to call
get() or set() on them.
2017-03-09 16:41:58 +03:00
Igor Chevdar 1a5434bada Forbade caching of KProperty for local delegated properties. 2017-03-07 20:23:33 +03:00
Igor Chevdar bc0772eab1 Test on link stage. 2017-03-07 20:02:20 +03:00
Igor Chevdar 6bb32743fd Removed usage of Kotlin.BuiltIns 2017-03-07 18:35:36 +03:00
Igor Chevdar 532cab42a7 bug fix: Callable references as arguments of callable references. 2017-03-07 18:35:36 +03:00
Igor Chevdar 1a8ce13067 Added tests 2017-03-07 18:35:36 +03:00
Igor Chevdar 776f4c4b7f Implemented callable references for properties 2017-03-07 18:35:36 +03:00
Nikolay Igotti 342a166ab8 Add explicit phase dependency mechanism. (#313) 2017-03-07 16:07:51 +03:00
Vasily Levchenko 996d6d8f74 IR: vararg lowering processing delegation constructor call 2017-03-07 15:37:07 +03:00
Igor Chevdar 48b0754a7b Handle specially only constructors of the class being lowered. 2017-03-07 14:27:29 +03:00
Nikolay Igotti d49c497e02 Fix lowering of default arguments to local ctors. (#309) 2017-03-07 13:44:28 +03:00
Nikolay Igotti 526c0dc924 Speed up large file compilation. (#308) 2017-03-07 13:40:25 +03:00
Alexander Udalov 1d0ec313b5 Add Package.packageFqName serializer extension 2017-03-07 09:44:42 +03:00
Igor Chevdar c76c214763 Extracted some common code.
Sometimes it would be nice to know context during IR rewriting, this is when
IrElementTransformerVoidWithContext comes in handy.
2017-03-06 21:08:56 +03:00
Igor Chevdar 8c1c9f5660 Turned off lowering of outer class for inner class constructors.
Constructors of inner classes already have access to their outer class
through its dispatch receiver parameter.
2017-03-06 21:08:56 +03:00
Nikolay Igotti 361e94fd1a Simplify default imports. 2017-03-06 15:22:44 +03:00
Igor Chevdar 2e81c045a7 Merge fix 2017-03-06 15:07:29 +03:00