mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In strict concurrency mode some calls could reference a declaration that is wrapped in one or more function conversion expressions to apply concurrency related attributes or erase them (such as `@Sendable` or `@MainActor`). This shouldn't impact constness checking and the checker should look through such conversions. Resolves: rdar://148168219
34 lines
747 B
Swift
34 lines
747 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 6
|
|
|
|
// REQUIRES: VENDOR=apple
|
|
// REQUIRES: concurrency
|
|
|
|
import OSLogTestHelper
|
|
|
|
class Log {
|
|
@_semantics("oslog.requires_constant_arguments")
|
|
func debug(_: OSLogMessage) {}
|
|
}
|
|
|
|
@_semantics("constant_evaluable")
|
|
@_transparent
|
|
public func __outputFormatter(_ key: String, fallback: OSLogMessage) -> OSLogMessage {
|
|
fallback
|
|
}
|
|
|
|
@MainActor
|
|
@_semantics("constant_evaluable")
|
|
@_transparent
|
|
public func __isolatedOutputFormatter(_ key: String, fallback: OSLogMessage) -> OSLogMessage {
|
|
fallback
|
|
}
|
|
|
|
func test(log: Log) {
|
|
log.debug(__outputFormatter("1", fallback: "msg")) // Ok
|
|
}
|
|
|
|
@MainActor
|
|
func isolatedTest(log: Log) {
|
|
log.debug(__isolatedOutputFormatter("1", fallback: "msg")) // Ok
|
|
}
|