[Test] KT-66152 Add tests for generic static function
This commit is contained in:
committed by
Space Team
parent
8200cf404c
commit
83d0e1f447
Vendored
+86
@@ -0,0 +1,86 @@
|
||||
class A : Java1, KotlinInterface {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
return <this>.foo(t = 1)
|
||||
}
|
||||
|
||||
fun test2(): Int {
|
||||
return <this>.bar<Int>()
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
return <this>.foo<String>(t = "")
|
||||
}
|
||||
|
||||
fun test4() {
|
||||
return <this>.foo(t = 1.5)
|
||||
}
|
||||
|
||||
fun test5() {
|
||||
return <this>.foo(t = 1.5, t2 = 8)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class B : Java1, Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
return foo(t = 1)
|
||||
}
|
||||
|
||||
fun test2(): Int {
|
||||
return bar<@FlexibleNullability Int?>() /*!! Int */
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
return foo<@FlexibleNullability String?>(t = "")
|
||||
}
|
||||
|
||||
fun test4() {
|
||||
return foo(t = 1.5)
|
||||
}
|
||||
|
||||
fun test5() {
|
||||
return foo(t = 1.5, t2 = 8)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface KotlinInterface {
|
||||
fun <T : Any?> bar(): T {
|
||||
return CHECK_NOT_NULL<Nothing>(arg0 = null)
|
||||
}
|
||||
|
||||
fun foo(t: Number) {
|
||||
}
|
||||
|
||||
fun foo(t: Number, t2: Int = 7) {
|
||||
}
|
||||
|
||||
fun <T : Any?> foo(t: T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test(a: A, b: B) {
|
||||
a.test1()
|
||||
a.test2() /*~> Unit */
|
||||
a.test3()
|
||||
a.test4()
|
||||
a.test5()
|
||||
b.test1()
|
||||
b.test2() /*~> Unit */
|
||||
b.test3()
|
||||
b.test4()
|
||||
b.test5()
|
||||
}
|
||||
Reference in New Issue
Block a user