Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
553 stars 44 forks source link

Type parameters are not handled correctly when unaliasing #358

Closed trilis closed 4 years ago

trilis commented 4 years ago
type ErrorHook<O, E> = (error: E, options: O) => void
type AfterHook<O, R> = (result: R, options: O) => void
type AnyHook<O, R, E> =
    | ErrorHook<O, E>
    | AfterHook<O, R>

export interface HookCollection {
    remove(name: string, hook: AnyHook<any, any, any>): void
}

generates:

typealias ErrorHook<O, E> = (error: E, options: O) -> Unit

typealias AfterHook<O, R> = (result: R, options: O) -> Unit

external interface HookCollection {
    fun remove(name: String, hook: ErrorHook<Any, Any>)
    fun remove(name: String, hook: AfterHook<Any, Any>)
}

which results in CONFLICTING_OVERLOADS fail, because ErrorHook and AfterHook should be the same after unaliasing.

Source: https://youtrack.jetbrains.com/issue/KT-40711#focus=Comments-27-4330455.0-0