import kotlin.* @CompileTimeCalculation class Temp(val a: T) { fun plus(temp: Temp): Double { return with(temp) { return@with this.a.toDouble() + this@Temp.a.toDouble() } } } @CompileTimeCalculation fun plus(a: Temp, b: Temp): Double { return with(a) w1@{ return@w1 with(b) w2@{ return@w2 this@w1.a.toDouble() + this@w2.a.toDouble() } } } const val a1 = Temp(1).plus(Temp(2.0)) const val a2 = plus(Temp(3), Temp(4))