Is there a limitation with using expect/actual for default function implementations in sealed interfaces? I get:
Copy code
// commonMain
expect sealed interface Foo {
fun toUri(): Uri
}
// androidMain
actual sealed interface Foo {
actual fun toUri(): Uri { // error: Actual function 'toUri' has no corresponding expected declaration
TODO()
}
}
c
Csaba Szugyiczki
05/19/2025, 11:55 AM
I think you just do not need the actual keyword before the
toUri
function, since your
Foo
sealed interface is what is marked with
expect
m
Mark
05/19/2025, 11:57 AM
Then it complains that:
Declaration must be marked with 'actual'
Mark
05/19/2025, 12:02 PM
Seems to work fine if I just use a sealed class instead