andym
04/22/2021, 3:07 PM!!
it.
But it seems I can’t use “this” in a contract:
contract {
returns(true) implies (this != null)
}
return !this.isNullOrBlank()
Is there a way to do this?Youssef Shoaib [MOD]
04/22/2021, 3:28 PMmyCastAsNullOrBlankFun
, then your contract should be this:
contract {
returns(true) implies (this@myCastASNullOrBlankFun != null)
}
Nicolas B
04/22/2021, 3:32 PMfun String.checkNotNull(): Boolean{
return !isNullOrBlank()
}
ephemient
04/22/2021, 4:06 PMfun String.isNullOrBlank()
itself has a contract,
contract {
returns(false) implies (this@isNullOrBlank != null)
}
this
you wrote is not referring to what you think it is - it's this@contract
andym
04/22/2021, 4:50 PM!!
, or anything else — I just want a custom smart-cast to non-nullable