Swift compiler crash in Xcode 15 beta 3 (15A5195k)

Somehow the Swift compiler is unable to this code:

@Observable class ServiceBrowser: NSObject {
   typealias ResolveServiceCompletionBlock = (Bool, Error?) -> Void

   fileprivate var resolveServiceCompletionHandler: ResolveServiceCompletionBlock? = nil
}

Here's the crash:

4 . While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/luc/Work/Repositories/app-shared/App/Shared/Connectivity/ServiceBrowser.swift")

5 . While silgen init accessor SIL function "@$s7App14ServiceBrowserC07resolveB17CompletionHandler33_5B15C352D9CC926D1F8A0ECAC5970199LLySb_s5Error_pSgtcSgvi". for init for resolveServiceCompletionHandler (at /Users/luc/Work/Repositories/ap-shared/App/Shared/Connectivity/ServiceBrowser.swift:86:21)

6 . While emitting reabstraction thunk in SIL function "@$sSbs5Error_pSgIegyg_ytIegd_TR".

Replies

Here's a project to demonstrate the issue:

import SwiftUI
import Observation

struct ContentView: View {
    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundStyle(.tint)
            Text("Hello, world!")
        }
        .padding()
    }
}


typealias ResolveServiceCompletionBlock = (Bool, Error?) -> Void

@Observable class ServiceBrowser: NSObject {
    fileprivate var resolveServiceCompletionHandler: ResolveServiceCompletionBlock? = nil
}

It seems like the issue is with the Observation protocol as removing @Observable works.

Apple folks: FB12567650

  • Thanks for filing FB12567650.

Add a Comment

So adding @ObservationIgnored seems to work around the issue.