Complex generic constraints can't be overridden with `SKIP DECLARE`
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
Regarding https://github.com/skiptools/skip-ui/pull/210 I was unable to get this declaration to transpile:
// SKIP DECLARE: public fun <K: PreferenceKey<V>, V: Any> View.onPreferenceChange(key: KClass<K>, perform: (V) -> Unit): View
public func onPreferenceChange<K>(
_ key: K.Type = K.self,
perform action: @escaping (
K.Value
) -> Void
) -> some View where K : PreferenceKey, K.Value : Equatable {
The transpiler kept objecting to the K.Value : Equatable clause of the where. That would be fine if the SKIP DECLARE comment would allow me to use an alternate declaration, but Skip refused to transpile this code even with SKIP DECLARE.
IMO, SKIP DECLARE should make the transpiler stop complaining about the declaration.
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
Reproduce the declaration shown in the issue and start by tracing the transpiler's handling of the SKIP DECLARE annotation. The change is complete when this declaration is accepted without errors and the alternate declaration is used instead of validating the unsupported generic constraint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100