File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t/src)
2+ // RUN: %empty-directory(%t/sdk)
3+ // RUN: split-file %s %t/src
4+
5+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %t/src/main.swift \
6+ // RUN: -import-objc-header %t/src/Test.h \
7+ // RUN: -swift-version 5 \
8+ // RUN: -disable-availability-checking \
9+ // RUN: -strict-concurrency=complete \
10+ // RUN: -module-name main -I %t -verify
11+
12+ // REQUIRES: objc_interop
13+ // REQUIRES: concurrency
14+
15+ //--- Test.h
16+ #define SWIFT_SENDABLE __attribute__( ( __swift_attr__ ( " @Sendable " ) ) )
17+
18+ #pragma clang assume_nonnull begin
19+
20+ @import Foundation;
21+
22+ @interface Test: NSObject
23+ - ( SWIFT_SENDABLE id) sendableReturnValue1 ;
24+ - ( id SWIFT_SENDABLE) sendableReturnValue2 ;
25+ - ( id) sendableReturnValue3 SWIFT_SENDABLE;
26+ @end
27+
28+ #pragma clang assume_nonnull end
29+
30+ //--- main.swift
31+ func test( test: Test ) {
32+ let result1 = test. sendableReturnValue1 ( )
33+ let result2 = test. sendableReturnValue2 ( )
34+ let result3 = test. sendableReturnValue2 ( )
35+
36+ Task . detached {
37+ _ = result1 // Ok
38+ _ = result2 // Ok
39+ _ = result3 // Ok
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments