mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
23 lines
472 B
Swift
23 lines
472 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// https://github.com/apple/swift/issues/50410
|
|
|
|
protocol Proto {}
|
|
class Base {}
|
|
class Test : Base, Proto {}
|
|
|
|
struct A {}
|
|
struct B {}
|
|
|
|
func overloaded<T: Proto & Base>(_ f: () -> T, _ g: (T, A) -> ()) {}
|
|
func overloaded<T: Proto & Base>(_ f: () -> T, _ g: (T, B) -> ()) {}
|
|
|
|
func f() -> Test { return Test() }
|
|
|
|
func g<T: Proto & Base>(_ t: T, _ a: A) -> () {}
|
|
|
|
func test() {
|
|
overloaded(f, g as (Test, A) -> ())
|
|
overloaded(f, g)
|
|
}
|