Could we use contracts to help compiler realize `x...
# kotest
e
Could we use contracts to help compiler realize
x
is not null in this case? Perhaps a specific
shouldNotBeNull
matcher required?
Copy code
var x: String? = "hello"
x shouldNotBe null
x!!.substring(2) shouldBe "he" // !! should not be necessary, since previous assertion checks that it is not null
m
I think there is a
x.shouldNotBeNull()
in place that does what you are searching for 🙂
e
Ahh.. of course.. for some reason I looked for it with a space after
x
, so it would only find infix versions.. 🤦‍♂️