Files
swift-mirror/test/Constraints/issue-77924.swift
Hamish Knight 9fe4abc6fd [CS] Simplify Solution::resolveInterfaceType
Rather than attempting to re-implement `simplifyType`,
tweak `Solution::simplifyType` such that it can
map the resulting type out of context, and can
turn type variables into their opened generic
parameters.
2024-12-31 18:39:19 +00:00

13 lines
494 B
Swift

// RUN: %target-typecheck-verify-swift
// https://github.com/swiftlang/swift/issues/77924
func foo<T>(_ x: (T) -> Void) {
(a: 0, b: x).b(0) // expected-error {{cannot convert value of type 'Int' to expected argument type 'T'}}
}
func bar<T>(_ x: T) {} // expected-note {{generic parameters are always considered '@escaping'}}
func baz(_ fn: () -> Void) {
(a: 0, b: bar).b(fn) // expected-error {{converting non-escaping parameter 'fn' to generic parameter 'T' may allow it to escape}}
}