Seemingly unnecessary conditional compilation of typealias AnyObject in Policy.swift

Starting from line 113 of Policy.swift is this code snippet (with documentation omitted):

#if _runtime(_ObjC)
public typealias AnyObject = Builtin.AnyObject
#else
public typealias AnyObject = Builtin.AnyObject
#endif

It seems to me that public typealias AnyObject = Builtin.AnyObject gets compiled either way, so why is it in a conditional compilation block?

I suspect this dates from way back when we were just getting Linux support up and running, and still wanted to differentiate Builtin.AnyObject from Builtin.NativeObject (which is known not to be a tagged pointer and thus is a bit more efficient in certain scenarios). These days the compiler knows to treat AnyObject like NativeObject when using a non-ObjC runtime, so we might as well remove the #if.

1 Like

I think the duplicate typealias is still needed:

1 Like

Oh, bah, that makes sense. Guess I should have looked at the history instead of guessing!

3 Likes