KT-5214 Annotation to provide platform name to avoid signature conflict
#KT-5214 Fixed
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
[platformName("bar")]
|
||||
fun foo() = "foo"
|
||||
|
||||
fun box(): String {
|
||||
val f = (::foo)()
|
||||
if (f != "foo") return "Fail: $f"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
fun <T> List<T>.foo() = "foo"
|
||||
|
||||
[platformName("fooInt")]
|
||||
fun List<Int>.foo() = "fooInt"
|
||||
|
||||
fun box(): String {
|
||||
val strings = listOf("", "").foo()
|
||||
if (strings != "foo") return "Fail: $strings"
|
||||
|
||||
val ints = listOf(1, 2).foo()
|
||||
if (ints != "fooInt") return "Fail: $ints"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
[platformName("bar")]
|
||||
fun foo() = "foo"
|
||||
|
||||
fun box(): String {
|
||||
val f = foo()
|
||||
if (f != "foo") return "Fail: $f"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
var v: Int = 1
|
||||
[platformName("vget")]
|
||||
get
|
||||
[platformName("vset")]
|
||||
set
|
||||
|
||||
fun box(): String {
|
||||
v += 1
|
||||
if (v != 2) return "Fail: $v"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user