[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
+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