Skip to content

Cross module compilation results in DESERIALIZATION FAILURE #67823

@ghost

Description

Description

Compiling the attached minimal project crashes the compiler with a DESERIALIZATION FAILURE
"While finishing conformance for protocol conformance to 'PersistentModel' (in module 'SwiftData')"

The app project references the initializer of a model object in a framework module at the point of failure.

If the model object is moved into the app project the compilation succeeds.

App Module

struct PreviewData {
    static func load() {
        let collection = GameCollection()
    }
}

Framework Module

@Model
public final class GameCollection {
    public var name: String
    
    public init() {}
}

Steps to reproduce

Build the project in Xcode or from the command line.

Environment

swiftc --version
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.2 clang-1500.0.40.1)
Target: arm64-apple-macosx14.0

xcodebuild -version
Xcode 15.0
Build version 15A5219j

DeserializationError.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions