skiptools / skiptools/skip

Fuse: ForEach crashes with closed ranges at runtime

Open
#614 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
3.2k
Forks
106
Avg merge
6d 13h
Merged PRs (30d)
1

Description

This code succeeds in Skip Lite but fails at runtime in Skip Fuse. (See also https://github.com/skiptools/skip.dev/issues/12)

It seems like it might not be possible to fix this, but, in that case, it should at least fail at build time instead of at runtime…?

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            ForEach(0...2, id: \.self) { index in
                Text("hello \(index)")
            }
        }
    }
}

Logcat shows this error:

Could not cast value of type '(extension in Swift):Swift.ClosedRange<Swift.Int>.Index' (0x6f64ae4570) to 'Swift.Int' (0x6f649bd7e8).

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 provided SwiftUI ForEach reproduction using the closed range 0...2, and compare how Skip Lite and Skip Fuse handle ClosedRange indexes. The work is done when the example no longer crashes at runtime, or when unsupported usage fails at build time as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.