[tests] Add test data for KT-53422

This commit is contained in:
Stanislav Ruban
2023-11-30 22:04:40 +01:00
committed by Space Team
parent 96e12584a1
commit 982e8133ba
6 changed files with 215 additions and 0 deletions
@@ -0,0 +1,35 @@
// ISSUE: KT-53422
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND: ANY
// REASON: red code (see corresponding diagnostic test)
fun box(): String {
buildFromValue(
innerBuild { setInnerTypeVariable(TargetType()) },
{ it.placeholderExtensionInvokeOnInnerBuildee() }
)
return "OK"
}
class TargetType
class InnerBuildee<ITV> {
fun setInnerTypeVariable(value: ITV) { storage = value }
private var storage: ITV = TargetType() as ITV
}
fun <EITV> InnerBuildee<EITV>.placeholderExtensionInvokeOnInnerBuildee() {}
class Buildee<TV>
fun <IPTV> innerBuild(instructions: InnerBuildee<IPTV>.() -> Unit): InnerBuildee<IPTV> {
return InnerBuildee<IPTV>().apply(instructions)
}
fun <PTV> buildFromValue(value: PTV, instructions: Buildee<PTV>.(PTV) -> Unit): Buildee<PTV> {
return Buildee<PTV>().apply { instructions(value) }
}