skiptools / skiptools/skip-ui

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

Open
#62 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
330
Forks
76
Avg merge
3h 6m
Merged PRs (30d)
1

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Swift extension and the generated Kotlin declaration shown in the issue, then inspect the SKIP translation path for generic Swift view types. The work is done when this example transpiles to Kotlin without invalid type arguments and the resulting Kotlin compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, swift
Domain
compilers, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.