ursus
09/15/2026, 1:58 PMwhen . Is that a bug?
override fun onHandleDeeplink(result: DeeplinkResult) {
val deeplink = result.deeplink
if (deeplink !is SubscriberRootDeeplink) return
when (deeplink) {
is SubscriberRootDeeplink.SmartId -> {
...
}
...
}
}dmitriy.novozhilov
09/15/2026, 1:59 PMursus
09/15/2026, 2:00 PMdmitriy.novozhilov
09/15/2026, 2:01 PMMarat Akhin
09/15/2026, 2:01 PMdmitriy.novozhilov
09/15/2026, 2:06 PMursus
09/15/2026, 2:06 PMdmitriy.novozhilov
09/15/2026, 2:07 PMDeeplinkResult hierarchy.ursus
09/15/2026, 2:11 PMfun UserRootDeeplinkHandler.onHandleDeeplink(result: DeeplinkResult) {
val deeplink = result.deeplink
if (deeplink !is UserRootDeeplink) return
when (deeplink) {
is UserRootDeeplink.SmartId -> ...
is MultiRootDeeplink.ResolveRemotely -> ...
}
}
data class DeeplinkResult(val deeplink: Deeplink, val rawDeeplink: Url)
sealed interface Deeplink
sealed interface LoggedOutRootDeeplink : Deeplink {
data class Login(val code: OAuthCode, val deeplinkToReplay: Url?) : LoggedOutRootDeeplink
}
sealed interface UserRootDeeplink : Deeplink {
data class SmartId(val code: OAuthCode) : UserRootDeeplink
}
sealed interface OnboardingRootDeeplink : Deeplink
sealed interface MultiRootDeeplink : Deeplink {
data class ResolveRemotely(
val urlToResolve: Url
) : MultiRootDeeplink, LoggedOutRootDeeplink, UserRootDeeplink, OnboardingRootDeeplink
}
okay I normalized it a bit
the idea is to have typed deeplinks based on root they belong to so they won't mix on accident - but certain deeplinks can be applied everywhere, so such types extend all of the root interfaces they need to
and then in each handler I have to filter away cases it's not interested inursus
09/15/2026, 2:12 PMdata class ResolveRemotely2(
val urlToResolve: Url
) : MultiRootDeeplink, LoggedOutRootDeeplink, UserRootDeeplink, OnboardingRootDeeplink
then I'd expect the when in the snippet to blow up due to not being exhaustive, but it does notdmitriy.novozhilov
09/15/2026, 2:12 PMursus
09/15/2026, 2:13 PMursus
09/15/2026, 2:16 PMwhen into a function, it goes red right away (sorry for different types, it's my domain, in the snippet I generalized it for simplicity)ursus
09/15/2026, 2:17 PMdata class SmartId2(val code: OAuthCode) : UserRootDeeplink then it complains about exhaustiveness
so it's the MultiRootDeeplink that confuses itdmitriy.novozhilov
09/15/2026, 2:18 PMdmitriy.novozhilov
09/15/2026, 2:19 PMursus
09/15/2026, 2:19 PM