然而,一旦将这些检测提取到单独的函数中,所有智能转换都立即消失了:
为了改善在此类场景中的行为,Kotlin 1.3 引入了称为 契约 的实验性机制。
关键词contract,视频中说法如下:create contracts and say that your function matches your the argument to a function match certain conditions and that basically is guaranteeing you a certain level of code correctness in your actual code