Rob Elliot
03/24/2022, 10:44 AMchristophsturm
03/24/2022, 10:51 AMval x: ExpectedType = expression ? that will fail at compile timeRob Elliot
03/24/2022, 10:53 AMexpression returns a subtype of ExpectedType that will pass. So in order to prove the compile time return type is ExpectedType, not a subtype of ExpectedType, I need to use shouldNotCompile with every single subtype of ExpectedType.
Which is a bit of a pain.Rob Elliot
03/24/2022, 11:02 AMio.kotest.matchers.reflection.shouldHaveReturnType - might give me what I need.Rob Elliot
03/24/2022, 11:09 AMimport io.kotest.matchers.reflection.shouldHaveReturnType
import kotlin.reflect.jvm.reflect
{ expression }.reflect().shouldNotBeNull().shouldHaveReturnType<ExpectedType>()