Niklas Gürtler
02/15/2021, 1:57 PM@Suppress
in https://pl.kotl.in/xmmqu1Wqf ? It is unreachable but without it, I get a type mismatch error.Roukanken
02/15/2021, 2:12 PMfun <T> retry (run: () -> T) : T {
lateinit var lastError: Throwable
repeat(5) {
try {
return run()
} catch (currentError: Throwable) {
lastError = currentError
}
}
throw lastError
}
retry {
println("Hello, world!!!")
}
compiler doesn't scream at me for the lateinit, so I guess it can figure out that it will be set 😄Niklas Gürtler
02/15/2021, 2:15 PM