mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The closure passed in to diagnoseOrDefer() outlives the ConformanceChecker instance, so instead of capturing 'this', pull out the 'DC' instance variable directly.
17 lines
471 B
Swift
17 lines
471 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// This triggers a conformance check with SuppressDiagnostics=true.
|
|
let x = S().f {}
|
|
|
|
protocol P {
|
|
associatedtype A
|
|
|
|
func f(_: A) -> Int // expected-note {{expected sendability to match requirement here}}
|
|
}
|
|
|
|
struct S : P {
|
|
typealias A = () -> ()
|
|
func f(_: @Sendable () -> ()) -> Int { return 0 }
|
|
// expected-warning@-1 {{sendability of function types in instance method 'f' does not match requirement in protocol 'P'}}
|
|
}
|