skiptools / skip-ui

SwiftUI for Android
https://skip.tools
GNU Lesser General Public License v3.0
128 stars 14 forks source link

Generic View extension (Label) breaks when transpiled by SKIP to Kotlin #62

Open fbartho opened 2 months ago

fbartho commented 2 months ago
public extension Label where Title == Text, Icon == Image {
    nonisolated static func someLabel() -> Self {
        return Label("Something", systemImage: "heart.filled")
    }
}
struct ContentView: View {
    var body: some View {
        Label.someLabel()
    }
}

Leads to a compilation error in Kotlin:

fun Label.Companion.someLabel(): Label<Text, Image> = Label(LocalizedStringKey(stringLiteral = "Something"), systemImage = "heart.filled")
// No type arguments expected for class 'Label'.

Apparently the generated Label<Text, Image> is incorrect code-gen for Kotlin?

aabewhite commented 2 months ago

Thank you for the report! You may be able to work around the problem until it is fixed by returning "some View"

fbartho commented 2 months ago

Thanks! Is there a preceding issue I should follow to track discussion and updates?

(I understand that might be in your private tracker)

aabewhite commented 2 months ago

Nope, this is the issue to track!