Skip to content

Commit 896cbad

Browse files
committed
Add a test for ObjC methods imported with counted-by
1 parent 84a4a8b commit 896cbad

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// REQUIRES: swift_feature_SafeInteropWrappers
2+
3+
// RUN: rm -rf %t
4+
// RUN: split-file %s %t
5+
// RUN: %target-swift-ide-test -plugin-path %swift-plugin-dir -I %t/Inputs -enable-experimental-feature SafeInteropWrappers -print-module -module-to-print=Method -source-filename=x | %FileCheck %s
6+
// RUN: %target-swift-frontend -plugin-path %swift-plugin-dir -I %t/Inputs -enable-experimental-feature SafeInteropWrappers %t/method.swift -dump-macro-expansions -typecheck -verify
7+
8+
// REQUIRES: objc_interop
9+
10+
// CHECK: class Foo {
11+
// CHECK: func bar(_ p: UnsafeMutableBufferPointer<Float>)
12+
13+
//--- Inputs/module.modulemap
14+
module Method {
15+
header "method.h"
16+
}
17+
18+
//--- Inputs/method.h
19+
20+
@interface Foo
21+
-(void)bar:(float *)p count:(int)len __attribute__((swift_attr("@_SwiftifyImport(.countedBy(pointer: .param(1), count: \"len\"))")));
22+
@end
23+
24+
//--- method.swift
25+
import Method
26+
27+
func test(foo: Foo, s: UnsafeMutableBufferPointer<Float>) {
28+
foo.bar(s)
29+
}

0 commit comments

Comments
 (0)