// ISSUE: KT-53740 // IGNORE_LIGHT_ANALYSIS // IGNORE_BACKEND: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { parallelInOutBuild( { setInProjectedTypeVariable(TargetType()) }, { consumeDifferentType(getOutProjectedTypeVariable()) } ) return "OK" } class TargetType class DifferentType fun consumeDifferentType(value: DifferentType) {} class Buildee { fun setTypeVariable(value: TV) { storage = value } fun getTypeVariable(): TV = storage private var storage: TV = TargetType() as TV } class OutBuildee(private val buildee: Buildee) { fun getOutProjectedTypeVariable(): OTV = buildee.getTypeVariable() } class InBuildee(private val buildee: Buildee) { fun setInProjectedTypeVariable(value: ITV) { buildee.setTypeVariable(value) } } fun parallelInOutBuild( inProjectedInstructions: InBuildee.(PTV) -> Unit, outProjectedInstructions: OutBuildee.(PTV) -> Unit ): Buildee { val value = TargetType() as PTV return Buildee().apply { InBuildee(this).inProjectedInstructions(value) OutBuildee(this).outProjectedInstructions(value) } }