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

Declarations clash after removing string literals in params and type params #279

Closed
Schahen opened this issue May 5, 2020 · 1 comment
Closed
Labels
ir-target causes problems with IR compilation unusable-code kotlin code is generated, can be compiled but actually is unusable
Milestone

Comments

@Schahen
Copy link
Contributor

Schahen commented May 5, 2020

Following code:

interface Options<A, B> {}
interface Result<T> {}

declare function generate(options: Options<'pem', 'pem'>): Result<{ publicKey: string, privateKey: string }>;
declare function generate(options: Options<'pem', 'der'>): Result<{ publicKey: string, privateKey: Buffer }>;
declare function generate(options: Options<'der', 'pem'>): Result<{ publicKey: Buffer, privateKey: string }>;
declare function generate(options: Options<'der', 'der'>): Result<{ publicKey: Buffer, privateKey: Buffer }>;

is translated to:

external interface Options<A, B>

external interface Result<T>

external interface `T$0` {
    var publicKey: String
    var privateKey: String
}

external fun generate(options: Options<String /* 'pem' */, String /* 'pem' */>): Result<`T$0`>

external interface `T$1` {
    var publicKey: String
    var privateKey: Any 
}

external fun generate(options: Options<String /* 'pem' */, String /* 'der' */>): Result<`T$1`>

external interface `T$2` {
    var publicKey: Any 
    var privateKey: String
}

external fun generate(options: Options<String /* 'der' */, String /* 'pem' */>): Result<`T$2`>

external interface `T$3` {
    var publicKey: Any 
    var privateKey: Any 
}

external fun generate(options: Options<String /* 'der' */, String /* 'der' */>): Result<`T$3`>

Which compiles only because of @file:Suppress("CONFLICTING_OVERLOADS")
We should merge such functions and methods.

@Schahen Schahen added unusable-code kotlin code is generated, can be compiled but actually is unusable ir-target causes problems with IR compilation labels May 5, 2020
@Schahen
Copy link
Contributor Author

Schahen commented May 5, 2020

see also #278

@Schahen Schahen changed the title Declarations clash after removing string literals in type params Declarations clash after removing string literals in params and type params May 5, 2020
@Schahen Schahen added this to the 0.5.1 milestone May 29, 2020
@Schahen Schahen closed this as completed in fb5d04e Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ir-target causes problems with IR compilation unusable-code kotlin code is generated, can be compiled but actually is unusable
Projects
None yet
Development

No branches or pull requests

1 participant