Andreas Sinz
09/27/2018, 5:24 PMSet.equals
!LeoColman
09/27/2018, 6:18 PMLeoColman
09/27/2018, 6:18 PMLeoColman
09/27/2018, 6:19 PM@ExperimentalContracts
fun foo(bar: Int) {
contract {
returns() implies (bar < 10)
}
}
LeoColman
09/27/2018, 6:19 PMLeoColman
09/27/2018, 6:19 PMkarelpeeters
09/27/2018, 6:28 PM<
comparisons, and it can warn you about that when you write implies (bar < 10)
.LeoColman
09/27/2018, 6:31 PMLeoColman
09/27/2018, 6:31 PMfun test() {
val x = Foo(11)
require(x.x > 10)
if (x.x == 3) {
//Compile error because x must be > 10
}
}
LeoColman
09/27/2018, 6:31 PMLeoColman
09/27/2018, 6:32 PMkarelpeeters
09/27/2018, 6:36 PMeven though implies takes a Boolean argument, actually only a subset of valid Kotlin expressions is accepted: namely, null-checks (,== null
), instance-checks (!= null
,is
), logic operators (!is
,&&
,||
)!
karelpeeters
09/27/2018, 6:37 PMdsavvinov
09/27/2018, 7:19 PMLeoColman
09/27/2018, 7:25 PMìf (x < 0) throw Exception()
which was unnecessary, but he would have to read the docs to knowLeoColman
09/27/2018, 7:25 PMLeoColman
09/27/2018, 7:29 PMLeoColman
09/27/2018, 7:29 PMpavel
09/27/2018, 11:38 PMpavel
09/27/2018, 11:38 PMDuring an instance initialization, the initializer blocks are executed in the same order as they appear in the class body, interleaved with the property initializers:
karelpeeters
09/28/2018, 10:18 AMNothing
parameters?christophsturm
09/28/2018, 10:23 AMAlowaniak
09/28/2018, 11:12 AMAlowaniak
09/28/2018, 11:13 AMspand
09/28/2018, 11:28 AMlistOf<Nothing>()
just fineribesg
09/28/2018, 11:36 AMdiesieben07
09/28/2018, 11:36 AMArray<Nothing>
would have to be Nothing[]
in Java, which does not really work.spand
09/28/2018, 11:37 AMAlowaniak
09/28/2018, 11:37 AMNikky
09/28/2018, 11:39 AMAny?
?