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

Resolve mangled names automatically #48

Open
Alex009 opened this issue May 28, 2022 · 0 comments
Open

Resolve mangled names automatically #48

Alex009 opened this issue May 28, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Alex009
Copy link
Member

Alex009 commented May 28, 2022

Kotlin/Native use mangling of conflicted names. For example with code:

interface A {
    fun test(value: Int)
}

interface B {
    fun test(value: String)
}

we got after compilation:

protocol A {
    func test(value: Int)
}

protocol B {
    func test(value_: String)
}

same will be with same classnames some.package.A, some.other.package.A will be A and A_.

now generated Swift code can't detect what name will be mangled. but we can use @KSwiftOverrideName annotation to give new name manually.

maybe we can resolve mangling automatically?

this code:

echo "import shared\n:type lookup shared" | \
	xcrun --sdk macosx swift -F../shared/build/cocoapods/framework/ | \
	tail -n+2 >| ./Sources/Shared/Shared.swift

generates swift api for compiled kotlin framework. and maybe we can find new name of kotlin definition using this generated swift code and swift-ast

@Alex009 Alex009 added the enhancement New feature or request label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant