Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracted type aliases name clash #331

Closed
Schahen opened this issue Jul 16, 2020 · 0 comments
Closed

Extracted type aliases name clash #331

Schahen opened this issue Jul 16, 2020 · 0 comments
Labels
compilation-failure kotlin code is generated but this code fails to be compiled
Milestone

Comments

@Schahen
Copy link
Contributor

Schahen commented Jul 16, 2020

Consider following code:

declare interface ICompiler {
}

declare namespace ICompiler {
    type Handler = () => void;
}

declare class Compiler implements ICompiler {
    ping(): Compiler.Handler;
}

declare namespace Compiler {
    type Handler = ICompiler.Handler;
}

Since we are merging namespaces and interfaces, we have to extract type aliases, and while we do so, we end up with following code:

typealias Handler = () -> Unit

typealias Handler = ICompiler.Handler

external interface ICompiler

external open class Compiler : ICompiler {
    open fun ping(): Compiler.Handler
}

The compilation of such code will cause lot of error: unresolved reference: Handler errors because of the name clash.
Current proposal is to rename one of aliases if such clash occurs.

@Schahen Schahen added the compilation-failure kotlin code is generated but this code fails to be compiled label Jul 16, 2020
@Schahen Schahen added this to the 0.5.7 milestone Jul 16, 2020
Schahen added a commit that referenced this issue Jul 16, 2020
see #331
This actually does a bit more - previously references to the extracted
typed aliases've been lost
@Schahen Schahen closed this as completed Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation-failure kotlin code is generated but this code fails to be compiled
Projects
None yet
Development

No branches or pull requests

1 participant