Someone with some Kotlin generic experience: Why a...
# announcements
j
Someone with some Kotlin generic experience: Why am I unable to to do this:
Copy code
fun <T> T.validateAndParse(json: String) : Any? where T: FromJsonString<*>, T: JsonSchema {
    TODO()
}

val fromJson : FromJsonString<*>? = type.companionObjectInstance as? FromJsonString<*>
if (fromJson is JsonSchema) {
    // The compiler can't find `validateAndParse` even though the type should be a union of FromJsonString<*> & JsonSchema
    fromJson.validateAndParse(context.call.receiveText())
}
Is there a workaround I can use to call
validateAndParse
?