|
| 1 | +// REQUIRES: objc_interop |
| 2 | + |
| 3 | +// RUN: %empty-directory(%t) |
| 4 | +// RUN: split-file %s %t |
| 5 | + |
| 6 | +// RUN: %target-swift-frontend -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache -O \ |
| 7 | +// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ |
| 8 | +// RUN: %t/main.swift -o %t/deps.json -swift-version 5 -cache-compile-job -cas-path %t/cas -access-notes-path %t/extra.accessnotes |
| 9 | + |
| 10 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd |
| 11 | +// RUN: %swift_frontend_plain @%t/shim.cmd |
| 12 | + |
| 13 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json |
| 14 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid |
| 15 | + |
| 16 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd |
| 17 | + |
| 18 | +// RUN: %target-swift-frontend \ |
| 19 | +// RUN: -typecheck -cache-compile-job -cas-path %t/cas \ |
| 20 | +// RUN: -swift-version 5 -disable-implicit-swift-modules \ |
| 21 | +// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ |
| 22 | +// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \ |
| 23 | +// RUN: %t/main.swift @%t/MyApp.cmd -access-notes-path %t/extra.accessnotes -Raccess-note=all 2>&1 | %FileCheck %s |
| 24 | + |
| 25 | +//--- main.swift |
| 26 | +class Extant { |
| 27 | + func good(_: Int) {} // expected-remark * {{}} expected-note * {{}} |
| 28 | + // CHECK-DAG: main.swift:2:{{[0-9]+}}: remark: implicitly added '@objc' to this instance method, as specified by access note for Access notes containing future, unknown syntax |
| 29 | + // CHECK-DAG: note: add '@objc' explicitly to silence this warning |
| 30 | + |
| 31 | + func bad(_: Int?) {} // expected-remark * {{}} |
| 32 | + // CHECK-DAG: main.swift:6:{{[0-9]+}}: remark: ignored access note: instance method cannot be marked '@objc' by an access note because the type of the parameter cannot be represented in Objective-C; did not implicitly add '@objc' to this instance method, even though it was specified by access note for Access notes containing future, unknown syntax |
| 33 | +} |
| 34 | + |
| 35 | +//--- extra.accessnotes |
| 36 | +Reason: Access notes containing future, unknown syntax |
| 37 | +Notes: |
| 38 | +- Name: 'Extant.good(_:)' |
| 39 | + ObjC: true |
| 40 | +- Name: 'Extant.bad(_:)' |
| 41 | + ObjC: true |
0 commit comments