Kotlin / dukat

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

Generating for null-writable in combination with others, classes get mixed up #401

Open Vampire opened 3 years ago

Vampire commented 3 years ago

If you generate for null_writable alone, you get as result

[...]

external interface `T$0` {
    var chunk: Any
    var encoding: String
}

@JsName("default")
external open class NullWritable : Writable {
    open fun _write(_chunk: Any, _encoding: String, callback: (error: Error?) -> Unit)
    open fun _writev(_chunks: Array<`T$0`>, callback: (error: Error?) -> Unit)
}

If you generate in combination used at https://github.com/Vampire/setup-wsl, this is generated, [...] being the same in both cases:

[...]
import stream.internal.`T$16`
import stream.internal.Writable

external interface `T$73` {
    var chunk: Any
    var encoding: String
}

@JsName("default")
external open class NullWritable : Writable {
    override fun _write(_chunk: Any, _encoding: String, callback: (error: Error?) -> Unit)
    open fun _writev(_chunks: Array<`T$73`>, callback: (error: Error?) -> Unit)
    override fun _writev(chunks: Array<`T$16`>, callback: (error: Error?) -> Unit)
}

This does not compile as `T$16` cannot be found and thus the third function does not override anything. As a work-around I replace `T$16` by the expected `T$10`. At least the naming seems to be stable, so that the numbers do not change if dependencies do not change.