Adam Firen
12/13/2022, 2:20 PMshouldBe definition makes compiler to accept 1234 shouldBe "1234". The reason for it is that the compiler will figure the common type of both arguments which is Object and use it in runtime. I am looking for a way to move the type check to compile-time. Something that will fail the compilation if types don't match.Javier
12/13/2022, 2:39 PM1234.shouldBe<Int, Int>("1234")Adam Firen
12/13/2022, 2:40 PMthis parameterSam
12/13/2022, 2:41 PMinfix fun <T, U : T> @kotlin.internal.Exact T.shouldBe(expected: U?)
that would achieve what you’re asking for, but I don’t know if there could be valid scenarios it would rule out. Also it’s not possible because the annotation is internal.Javier
12/13/2022, 2:43 PMAdam Firen
12/13/2022, 2:43 PMJavier
12/13/2022, 2:44 PMEmil Kantis
12/14/2022, 10:14 AMEmil Kantis
12/14/2022, 10:15 AMshouldEqual for those cases