Add ir interpreter tests

This commit is contained in:
Ivan Kylchik
2021-05-19 16:27:03 +03:00
committed by TeamCityServer
parent cc2d7340dc
commit e28ab45c51
115 changed files with 5104 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import kotlin.*
@CompileTimeCalculation
class Temp<T : Number>(val a: T) {
fun <E : Number> plus(temp: Temp<E>): Double {
return with(temp) {
return@with this.a.toDouble() + this@Temp.a.toDouble()
}
}
}
@CompileTimeCalculation
fun <T : Number> plus(a: Temp<T>, b: Temp<T>): Double {
return with(a) w1@{
return@w1 with(b) w2@{
return@w2 this@w1.a.toDouble() + this@w2.a.toDouble()
}
}
}
const val a1 = Temp<Int>(1).<!EVALUATED: `3.0`!>plus(Temp<Double>(2.0))<!>
const val a2 = <!EVALUATED: `7.0`!>plus(Temp<Int>(3), Temp<Int>(4))<!>