Files
swift-mirror/test/Constraints/openExistential.swift
Joe Groff eb40d4303b Sema: Add a stdlib-internal _openExistential helper.
Leverage the "special type-checking semantics" hack to pass an opened existential down to an arbitrary subexpression. Please don't use this.
2017-03-10 13:41:00 -08:00

14 lines
369 B
Swift

// RUN: %target-swift-frontend -typecheck -verify %s
protocol P { }
func foo<T: P>(_: T) {}
func bar<T: P>(_: T.Type) {}
func open(existential: P, mutExistential: inout P) {
_openExistential(existential, do: foo)
_openExistential(type(of: existential), do: bar)
_openExistential(mutExistential, do: foo)
_openExistential(type(of: mutExistential), do: bar)
}