`.clipShape(.rect())` type inference fails with a confusing error message
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
In https://github.com/dfabulich/skipapp-showcase/tree/clipshape-rect-error-repro there's a commit https://github.com/dfabulich/skipapp-showcase/commit/282d0aabd524e6d3811e662601710ec2ebf5e1f1 that reproduces an error in Skip.
In ShapePlayground.swift, I added code like this:
HStack {
Text("clipShape")
Spacer()
Color.black
.frame(width: 100, height: 100)
.clipShape(.rect(topLeadingRadius: 10, bottomLeadingRadius: 20, bottomTrailingRadius: 30, topTrailingRadius: 40))
.border(.blue)
}
It works correctly if I set SKIP_ZERO = 1 in Showcase.xcconfig, but when I try to compile it with Skip, it fails with a confusing error message:
ShapePlayground.swift:125:134 Argument type mismatch: actual type is 'kotlin.String', but 'skip.ui.Shape' was expected.
I can workaround the issue by replacing .rect like this:
.clipShape(UnevenRoundedRectangle(topLeadingRadius: 10, bottomLeadingRadius: 20, bottomTrailingRadius: 30, topTrailingRadius: 40))
… but the error message is certainly not helping me figure out why this is breaking.
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 skipapp-showcase clipshape-rect-error-repro branch and commit 282d0aabd524e6d3811e662601710ec2ebf5e1f1, then inspect ShapePlayground.swift around the reported line. Compare compilation with and without SKIP_ZERO = 1 and with the UnevenRoundedRectangle workaround. Done means the .clipShape(.rect(...)) example compiles under Skip without the confusing kotlin.String versus skip.ui.Shape error.
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