Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
552 stars 42 forks source link

Unused generated interfaces are not removed for meta types #298

Open Schahen opened 4 years ago

Schahen commented 4 years ago

following code:

declare function ping(): {a: string} | {b: number}

will be converted to:

external interface `T$0` {
    var a: String
}

external interface `T$1` {
    var b: Number
}

external fun ping(): dynamic /* `T$0` | `T$1` */                              

So in some cases dukat preserves generated interfaces for types that actually later on are erased. Ideally we won't have any reference for interfaces that are not used directly.

Strictly speaking the same should happen to tuples as well and ironically does not happen only because in a specific lowering tuple are missed. I'm going to introduce a regression of a sort returning this behaviour for tuples as well - and then fix in the framework of this issue.