Support synthetic accessors for @JvmDefault members
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// !API_VERSION: 1.3
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
var storage = "fail"
|
||||
|
||||
interface Test {
|
||||
|
||||
@kotlin.annotations.JvmDefault
|
||||
private var foo: String
|
||||
get() = storage
|
||||
set(value) {
|
||||
storage = value
|
||||
}
|
||||
|
||||
@kotlin.annotations.JvmDefault
|
||||
private fun bar(): String {
|
||||
return "K"
|
||||
}
|
||||
|
||||
@kotlin.annotations.JvmDefault
|
||||
fun call(): String {
|
||||
return {
|
||||
foo = "O"
|
||||
foo + bar()
|
||||
} ()
|
||||
}
|
||||
}
|
||||
|
||||
class TestClass : Test {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return TestClass().call()
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// !API_VERSION: 1.3
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface Test {
|
||||
@kotlin.annotations.JvmDefault
|
||||
private val foo: String
|
||||
get() = "O"
|
||||
|
||||
@kotlin.annotations.JvmDefault
|
||||
private fun bar(): String {
|
||||
return "K"
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun call(test: Test): String {
|
||||
return test.foo + test.bar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestClass : Test
|
||||
|
||||
fun box(): String {
|
||||
return Test.call(TestClass())
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// !API_VERSION: 1.3
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface Test {
|
||||
@kotlin.annotations.JvmDefault
|
||||
private val foo: String
|
||||
get() = "O"
|
||||
|
||||
@kotlin.annotations.JvmDefault
|
||||
private fun bar(): String {
|
||||
return "K"
|
||||
}
|
||||
|
||||
fun call(): String {
|
||||
return { foo + bar()} ()
|
||||
}
|
||||
}
|
||||
|
||||
class TestClass : Test {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return TestClass().call()
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !API_VERSION: 1.3
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface Test {
|
||||
fun test(): String {
|
||||
return privateFun() + privateProp
|
||||
}
|
||||
|
||||
@kotlin.annotations.JvmDefault
|
||||
private fun privateFun(): String {
|
||||
return "O"
|
||||
}
|
||||
|
||||
@kotlin.annotations.JvmDefault
|
||||
private val privateProp: String
|
||||
get() = "K"
|
||||
}
|
||||
|
||||
class TestImpl: Test
|
||||
|
||||
fun box(): String {
|
||||
return TestImpl().test()
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// !API_VERSION: 1.3
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface Test {
|
||||
@kotlin.annotations.JvmDefault
|
||||
fun test(): String {
|
||||
return privateFun() + privateProp
|
||||
}
|
||||
|
||||
private fun privateFun(): String {
|
||||
return "O"
|
||||
}
|
||||
|
||||
private val privateProp: String
|
||||
get() = "K"
|
||||
}
|
||||
|
||||
class TestImpl: Test
|
||||
|
||||
fun box(): String {
|
||||
return TestImpl().test()
|
||||
}
|
||||
Reference in New Issue
Block a user