Add basic support for multi-platform projects to the compiler (#1254)

Add compiler pass removing `expect` declarations

Thus support multi-platform projects in the compiler.

Also 

* Add some trivial checks to ensure that `expect` declarations
are not generated to bitcode.
* Add minor improvement to exported symbol name clash detection.
* Don't create LLVM declarations for Obj-C-interop fake functions.
This commit is contained in:
SvyatoslavScherbina
2018-01-25 12:55:06 +03:00
committed by GitHub
parent 155618c7dd
commit 7567c96bc9
10 changed files with 87 additions and 9 deletions
+5
View File
@@ -1918,6 +1918,11 @@ task memory_escape2(type: RunKonanTest) {
source = "runtime/memory/escape2.kt"
}
task mpp1(type: RunStandaloneKonanTest) {
source = "codegen/mpp/mpp1.kt"
flags = ['-tr', '-Xmulti-platform']
}
task unit1(type: RunKonanTest) {
goldValue = "First\nkotlin.Unit\n"
source = "codegen/basics/unit1.kt"
+31
View File
@@ -0,0 +1,31 @@
package codegen.mpp.mpp1
import kotlin.test.*
fun box() {
assertEquals(A().B().fourtyTwo(), 42)
assertEquals(seventeen(), 17)
}
expect class A {
constructor()
inner class B {
fun fourtyTwo(): Int
constructor()
}
}
actual class A {
actual inner class B actual constructor() {
actual fun fourtyTwo() = 42
}
}
actual fun seventeen() = 17
expect fun seventeen(): Int
@Test fun runTest() {
box()
}