Skip to content

Instantly share code, notes, and snippets.

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

Implicitly opened existentials do not work in playgrounds

FB10447228

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 }
  open(value)
}

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