How does Swift determine `AnyClass` equality?

I've been playing around, trying to understand the internals of the Swift runtime, and I am curious to understand how it determines the equality of AnyClass variables. I see that AnyClass is a type alias for AnyObject.Type, so perhaps this would apply to all metatypes.

Really, I'm just looking for the section of code in the Swift runtime that would handle the equality check on line 3 in the following code:

let foo: AnyClass = someFuncReturningAnyClass()
let bar: AnyClass = someOtherFuncReturningAnyClass()
let equal = foo == equal

It's this operator, which works on all types:

1 Like

Nice! Thank you very much!