| class A | |
| class C { | |
| typealias TA = A | |
| fun test(): TA = TA() | |
| } | |
| enum class Problem { | |
| CONNECTION, AUTHENTICATION, UNKNOWN | |
| } | |
| sealed interface Status { | |
| data object Loading: Status | |
| data class Error(val problem: Problem, val isCritical: Boolean): Status | |
| data class Ok(val info: List<String>): Status | |
| } | |
| fun render(status: Status): String = when (status) { | |
| Status.Loading -> "loading" | |
| is Status.Ok if status.info.isEmpty() -> "no data" | |
| is Status.Ok -> status.info.joinToString() | |
| is Status.Error if status.problem == Problem.CONNECTION -> "problems with connection" | |
| is Status.Error if status.problem == Problem.AUTHENTICATION -> "could not be authenticated" | |
| else -> "unknown problem" | |
| } |