JS test: added inline tests
This commit is contained in:
committed by
Zalim Bashorov
parent
987708680f
commit
3f2d4b31be
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copy of JVM-backend test
|
||||
* Found at: compiler/testData/codegen/boxInline/trait/trait.1.kt
|
||||
*/
|
||||
|
||||
package foo
|
||||
|
||||
import test.*
|
||||
|
||||
// CHECK_CONTAINS_NO_CALLS: testFinalInline
|
||||
// CHECK_CONTAINS_NO_CALLS: testFinalInline2
|
||||
// CHECK_CONTAINS_NO_CALLS: testClassObject
|
||||
|
||||
fun testFinalInline(): String {
|
||||
return Z().finalInline({"final"})
|
||||
}
|
||||
|
||||
fun testFinalInline2(instance: InlineTrait): String {
|
||||
return instance.finalInline({"final2"})
|
||||
}
|
||||
|
||||
fun testClassObject(): String {
|
||||
return InlineTrait.finalInline({"classobject"})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (testFinalInline() != "final") return "test1: ${testFinalInline()}"
|
||||
if (testFinalInline2(Z()) != "final2") return "test2: ${testFinalInline2(Z())}"
|
||||
if (testClassObject() != "classobject") return "test3: ${testClassObject()}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copy of JVM-backend test
|
||||
* Found at: compiler/testData/codegen/boxInline/trait/trait.2.kt
|
||||
*/
|
||||
|
||||
package test
|
||||
|
||||
trait InlineTrait {
|
||||
|
||||
inline final fun finalInline(s: () -> String): String {
|
||||
return s()
|
||||
}
|
||||
|
||||
class object {
|
||||
inline final fun finalInline(s: () -> String): String {
|
||||
return s()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Z: InlineTrait {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user