// ISSUE: KT-59798 // IGNORE_LIGHT_ANALYSIS // IGNORE_BACKEND: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { build { setTypeVariable(TargetType()) getTypeVariable().let {} } return "OK" } class TargetType class Buildee { fun setTypeVariable(value: TV) { storage = value } fun getTypeVariable(): TV = storage private var storage: TV = TargetType() as TV } fun build(instructions: Buildee.() -> Unit): Buildee { return Buildee().apply(instructions) }