[tests] BI (1P&1TV/1TIO): add additional test data for contexts of source-sink feeds
single builder parameter single postponed type variable single origin of type information relevant issues: KT-63816
This commit is contained in:
committed by
Space Team
parent
0f65ba4843
commit
80462efe7e
+29
@@ -0,0 +1,29 @@
|
||||
fun box(): String {
|
||||
testMaterialize()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
/* TESTS */
|
||||
|
||||
// PTV is in producing position (materialize-case)
|
||||
fun testMaterialize() {
|
||||
val arg: UserKlass = UserKlass()
|
||||
build {
|
||||
var temp = arg
|
||||
temp = materialize()
|
||||
}
|
||||
}
|
||||
|
||||
/* REQUIRED DECLARATIONS */
|
||||
|
||||
class Buildee<CT> {
|
||||
fun materialize(): CT = UserKlass() as CT
|
||||
}
|
||||
|
||||
fun <FT> build(
|
||||
instructions: Buildee<FT>.() -> Unit
|
||||
): Buildee<FT> {
|
||||
return Buildee<FT>().apply(instructions)
|
||||
}
|
||||
|
||||
class UserKlass
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// IGNORE_BACKEND_K1: ANY
|
||||
// ISSUE: KT-63816
|
||||
// REASON: unexpected red code in K1 (see corresponding diagnostic test)
|
||||
|
||||
fun box(): String {
|
||||
testYield()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
/* TESTS */
|
||||
|
||||
// PTV is in consuming position (yield-case)
|
||||
fun testYield() {
|
||||
val arg: UserKlass = UserKlass()
|
||||
build {
|
||||
var temp = materialize()
|
||||
temp = arg
|
||||
}
|
||||
}
|
||||
|
||||
/* REQUIRED DECLARATIONS */
|
||||
|
||||
class Buildee<CT> {
|
||||
fun materialize(): CT = UserKlass() as CT
|
||||
}
|
||||
|
||||
fun <FT> build(
|
||||
instructions: Buildee<FT>.() -> Unit
|
||||
): Buildee<FT> {
|
||||
return Buildee<FT>().apply(instructions)
|
||||
}
|
||||
|
||||
class UserKlass
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
fun box(): String {
|
||||
testYield()
|
||||
testMaterialize()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
/* TESTS */
|
||||
|
||||
// PTV is in consuming position (yield-case)
|
||||
fun testYield() {
|
||||
val arg: UserKlass = UserKlass()
|
||||
build {
|
||||
class LocalClass {
|
||||
init {
|
||||
yield(arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PTV is in producing position (materialize-case)
|
||||
fun testMaterialize() {
|
||||
fun consume(arg: UserKlass) {}
|
||||
build {
|
||||
class LocalClass {
|
||||
init {
|
||||
consume(materialize())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* REQUIRED DECLARATIONS */
|
||||
|
||||
class Buildee<CT> {
|
||||
fun yield(arg: CT) {}
|
||||
fun materialize(): CT = UserKlass() as CT
|
||||
}
|
||||
|
||||
fun <FT> build(
|
||||
instructions: Buildee<FT>.() -> Unit
|
||||
): Buildee<FT> {
|
||||
return Buildee<FT>().apply(instructions)
|
||||
}
|
||||
|
||||
class UserKlass
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
fun box(): String {
|
||||
testYield()
|
||||
testMaterialize()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
/* TESTS */
|
||||
|
||||
// PTV is in consuming position (yield-case)
|
||||
fun testYield() {
|
||||
val arg: UserKlass = UserKlass()
|
||||
build {
|
||||
yield(id(arg))
|
||||
}
|
||||
}
|
||||
|
||||
// PTV is in producing position (materialize-case)
|
||||
fun testMaterialize() {
|
||||
fun consume(arg: UserKlass) {}
|
||||
build {
|
||||
consume(id(materialize()))
|
||||
}
|
||||
}
|
||||
|
||||
/* REQUIRED DECLARATIONS */
|
||||
|
||||
class Buildee<CT> {
|
||||
fun yield(arg: CT) {}
|
||||
fun materialize(): CT = UserKlass() as CT
|
||||
}
|
||||
|
||||
fun <FT> build(
|
||||
instructions: Buildee<FT>.() -> Unit
|
||||
): Buildee<FT> {
|
||||
return Buildee<FT>().apply(instructions)
|
||||
}
|
||||
|
||||
class UserKlass
|
||||
|
||||
fun <T> id(arg: T): T = arg
|
||||
Reference in New Issue
Block a user