Post

Replies

Boosts

Views

Activity

LLDB RPC Server Crash Playground File XCode 16.0
When running the code below in a playground file, it crashes with an LLDB RPC Server crash. The crash log is attached. If I put the code into a project, it runs fine. lldb-rpc-server-2024-10-04-110747.txt import Foundation @objc protocol Speaker { func speak() @objc optional func tellJoke() } class Deb: Speaker { func speak() { print("Hello, I'm Deb!") } func tellJoke() { print("What did Sushi A say to Sushi B?") } } class Bryan: Speaker { func speak() { print("Yo, I'm Bryan!") } func tellJoke() { print("What is the object oriented way to become wealthy?") } func writeTutorial() { print("I'm on it!") } } class Animal {} class Dog: Animal, Speaker { func speak() { print("Woof!") } } var speaker: Speaker = Bryan() if speaker is Bryan { print("Hi, I'm a Bryan") } speaker.speak() //speaker.writeTutorial() //won't compile (speaker as! Bryan).writeTutorial() speaker = Deb() speaker.speak() speaker.tellJoke?() speaker = Dog() speaker.tellJoke?() //return nil protocol MtgSimulatorDelegate { func mtgSimulatorDidStart(sim: MtgSimulator, a: Speaker, b: Speaker) func mtgSimulatorDidEnd(sim: MtgSimulator, a: Speaker, b: Speaker) } class LoggingMtgSimulator: MtgSimulatorDelegate { func mtgSimulatorDidStart(sim: MtgSimulator, a: any Speaker, b: any Speaker) { print("Meeting started") } func mtgSimulatorDidEnd(sim: MtgSimulator, a: any Speaker, b: any Speaker) { print("Meeting ended") } } class MtgSimulator: MtgSimulatorDelegate { func mtgSimulatorDidStart(sim: MtgSimulator, a: any Speaker, b: any Speaker) { print("the meeting started") } func mtgSimulatorDidEnd(sim: MtgSimulator, a: any Speaker, b: any Speaker) { print("the meeting ended") } let a: Speaker let b: Speaker var delegate1: MtgSimulatorDelegate? var delegate2: MtgSimulatorDelegate? init(a: Speaker, b: Speaker) { self.a = a self.b = b delegate1 = self } func simulate() { print("Off to meeting....") delegate1?.mtgSimulatorDidStart(sim: self, a: a, b: b) delegate2?.mtgSimulatorDidStart(sim: self, a: a, b: b) a.speak() b.speak() print("Leaving meeting...") delegate1?.mtgSimulatorDidEnd(sim: self, a: a, b: b) delegate2?.mtgSimulatorDidEnd(sim: self, a: a, b: b) a.tellJoke?() b.tellJoke?() } }//MtgSimulator let sim = MtgSimulator(a: Deb(), b: Bryan()) sim.delegate2 = LoggingMtgSimulator() sim.simulate()
2
0
302
Oct ’24