Skip to content

Instantly share code, notes, and snippets.

Last active Jun 24, 2022
What would you like to do?

Implicitly opened existentials do not work in playgrounds


Running the following code in Swift playgrounds (in Xcode):

func open<A: Equatable>(_ a: A) {}

func existentialFun(_ value: Any) {
  guard let value = value as? any Equatable
  else { return }

Produces the following error:

error: type 'any Equatable' cannot conform to 'Equatable’

But does compile in a regular Swift project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment