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:
committed by
GitHub
parent
155618c7dd
commit
7567c96bc9
@@ -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"
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user