Skip to content

Fuse: ForEach crashes with closed ranges at runtime #614

@dfabulich

Description

@dfabulich

This code succeeds in Skip Lite but fails at runtime in Skip Fuse. (See also skiptools/skip.dev#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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions