Skip Lite doesn't transpile implicitly unwrapped optionals
Open
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
import SwiftUI
struct ContentView: View {
func example(_ x: String) {
print(x)
}
func example2() {
var x: String! = nil
x = "world"
example(x)
}
var body: some View {
let _ = example2()
Text("hello")
}
}
This transpiles to:
internal class ContentView: View {
internal fun example(x: String): Unit = print(x)
internal fun example2() {
var x: String = null
x = "world"
example(x)
}
override fun body(): View {
return ComposeBuilder { composectx: ComposeContext ->
example2()
Text(LocalizedStringKey(stringLiteral = "hello")).Compose(composectx)
ComposeResult.ok
}
}
}
But that fails to compile. "Null cannot be a value of a non-null type 'String'."
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SwiftUI reproduction in this issue and compare its generated Kotlin output. Trace how an implicitly unwrapped optional is represented during transpilation, then verify that the resulting code accepts the shown nil initialization and compiles successfully.
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
- 45/100