[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
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
// DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||||
|
|
||||||
|
/* TESTS */
|
||||||
|
|
||||||
|
// PTV is in producing position (materialize-case)
|
||||||
|
fun testMaterialize() {
|
||||||
|
val arg: UserKlass = UserKlass()
|
||||||
|
val buildee = build {
|
||||||
|
var temp = arg
|
||||||
|
temp = materialize()
|
||||||
|
}
|
||||||
|
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
checkExactType<Buildee<UserKlass>>(buildee)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* REQUIRED DECLARATIONS */
|
||||||
|
|
||||||
|
class Buildee<CT> {
|
||||||
|
fun materialize(): CT = null!!
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <FT> build(
|
||||||
|
instructions: Buildee<FT>.() -> Unit
|
||||||
|
): Buildee<FT> {
|
||||||
|
return Buildee<FT>().apply(instructions)
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserKlass
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
// DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||||
|
|
||||||
|
// ISSUE: KT-63816
|
||||||
|
// REASON: unexpected red code in K1
|
||||||
|
|
||||||
|
/* TESTS */
|
||||||
|
|
||||||
|
// PTV is in consuming position (yield-case)
|
||||||
|
fun testYield() {
|
||||||
|
val arg: UserKlass = UserKlass()
|
||||||
|
val buildee = build {
|
||||||
|
var temp = materialize()
|
||||||
|
temp = arg
|
||||||
|
}
|
||||||
|
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
checkExactType<Buildee<UserKlass>>(buildee)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* REQUIRED DECLARATIONS */
|
||||||
|
|
||||||
|
class Buildee<CT> {
|
||||||
|
fun materialize(): CT = null!!
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <FT> build(
|
||||||
|
instructions: Buildee<FT>.() -> Unit
|
||||||
|
): Buildee<FT> {
|
||||||
|
return Buildee<FT>().apply(instructions)
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserKlass
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
// DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||||
|
|
||||||
|
// ISSUE: KT-63816
|
||||||
|
// REASON: unexpected red code in K1
|
||||||
|
|
||||||
|
/* TESTS */
|
||||||
|
|
||||||
|
// PTV is in consuming position (yield-case)
|
||||||
|
fun testYield() {
|
||||||
|
val arg: UserKlass = UserKlass()
|
||||||
|
val buildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||||
|
var temp = materialize()
|
||||||
|
temp = arg
|
||||||
|
}
|
||||||
|
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
checkExactType<Buildee<UserKlass>>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>buildee<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* REQUIRED DECLARATIONS */
|
||||||
|
|
||||||
|
class Buildee<CT> {
|
||||||
|
fun materialize(): CT = null!!
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <FT> build(
|
||||||
|
instructions: Buildee<FT>.() -> Unit
|
||||||
|
): Buildee<FT> {
|
||||||
|
return Buildee<FT>().apply(instructions)
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserKlass
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
|
/* TESTS */
|
||||||
|
|
||||||
|
// PTV is in consuming position (yield-case)
|
||||||
|
fun testYield() {
|
||||||
|
val arg: UserKlass = UserKlass()
|
||||||
|
val buildee = build {
|
||||||
|
class LocalClass {
|
||||||
|
init {
|
||||||
|
yield(arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
checkExactType<Buildee<UserKlass>>(buildee)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PTV is in producing position (materialize-case)
|
||||||
|
fun testMaterialize() {
|
||||||
|
fun consume(arg: UserKlass) {}
|
||||||
|
val buildee = build {
|
||||||
|
class LocalClass {
|
||||||
|
init {
|
||||||
|
consume(materialize())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
checkExactType<Buildee<UserKlass>>(buildee)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* REQUIRED DECLARATIONS */
|
||||||
|
|
||||||
|
class Buildee<CT> {
|
||||||
|
fun yield(arg: CT) {}
|
||||||
|
fun materialize(): CT = null!!
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <FT> build(
|
||||||
|
instructions: Buildee<FT>.() -> Unit
|
||||||
|
): Buildee<FT> {
|
||||||
|
return Buildee<FT>().apply(instructions)
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserKlass
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
|
/* TESTS */
|
||||||
|
|
||||||
|
// PTV is in consuming position (yield-case)
|
||||||
|
fun testYield() {
|
||||||
|
val arg: UserKlass = UserKlass()
|
||||||
|
val buildee = build {
|
||||||
|
yield(id(arg))
|
||||||
|
}
|
||||||
|
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
checkExactType<Buildee<UserKlass>>(buildee)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PTV is in producing position (materialize-case)
|
||||||
|
fun testMaterialize() {
|
||||||
|
fun consume(arg: UserKlass) {}
|
||||||
|
val buildee = build {
|
||||||
|
consume(id(materialize()))
|
||||||
|
}
|
||||||
|
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
checkExactType<Buildee<UserKlass>>(buildee)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* REQUIRED DECLARATIONS */
|
||||||
|
|
||||||
|
class Buildee<CT> {
|
||||||
|
fun yield(arg: CT) {}
|
||||||
|
fun materialize(): CT = null!!
|
||||||
|
}
|
||||||
|
|
||||||
|
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