An odd error: "Escaping closure captures mutating 'self'"

Removing the explicit type makes it compile:

func test(_ callback: () -> Void) { // Compiles, no need for it to be @escaping
    let x = callback
    x()
}

Is this a compiler bug?

1 Like