Spot the bug in the object cycle

from Automatic reference counting
Swift 6.3.3 intermediate 4 min 1 issue to find

Find why neither deinitializer runs after the local variables are cleared.

swift
final class Playlist {
    var current: Song?
    deinit { print("playlist released") }
}

final class Song {
    var playlist: Playlist?
    deinit { print("song released") }
}

var playlist: Playlist? = Playlist()
var song: Song? = Song()
playlist?.current = song
song?.playlist = playlist
playlist = nil
song = nil
Open in playground
Report an error