JIT session error: Symbols not found

Cross post from JIT session error: Symbols not found · Issue #71506 · apple/swift · GitHub

None replied so I am assuming I did something wrong and it's not really a bug. What am I doing wrong? (pasting the same content as the GH issue)

I would expect the following to code raise a compiler error because of the following rule.

A designated initializer must call a designated initializer from its immediate superclass.

The designated initializer of B calls a convenience initializer of A.

Currently when I do swift main.swift, I get JIT session error: Symbols not found and a bunch of "stuff" (I think they are called symbols, I am not sure on the terminology).

Reproduction

class A {
    let a: Int
    init(a: Int) {
        self.a = a
    }
    convenience init() {
        self.init(a: 0)
    }
}

class B: A {
    let b: Int
    init(a: Int, b: Int) {
        self.b = b
        super.init()
    }
}

Environment

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0

I believe you need to call the designated initializer. You can find more information on the rules for designated initializers here

class A {
    let a: Int
    init(a: Int) {
        self.a = a
    }
    convenience init() {
        self.init(a: 0)
    }
}

class B: A {
    let b: Int
    init(a: Int, b: Int) {
        self.b = b
        super.init(a: a)
    }
}

Thanks for replying, yes I did understand that part (I even copy pasted a rule from the same page you linked :slight_smile: ), perhaps my explanation was lacking. What I mean is, I was expecting a compiler error and I assumed this to be a bug (the GH issue), but no one replied so I assumed (again) that I was doing something wrong / beginner mistakes which is why I wanted confirmation from a larger audience.

1 Like

Sorry I should of read more closely - Yeah I was also confused by the lack of a proper complier error when running your sample.

1 Like

Hi Alc,

I'm currently experiencing the very same problem with a Swif script using SwiftUI which I haven't touched in two years and which I'm trying to make fit for the current version of Swift. Compiling the script and running the executable just works fine (beside a nasty problem with my application delegate which doesn't want to trigger changes to the delegate class's published properties in the onChange method).

I think the Swift team may have introduced a regression from what I have found in this post … :frowning:

https://forums.developer.apple.com/forums/thread/710274

Cheers, Mati

1 Like