Skip to content

Commit 70ec916

Browse files
committed
[Swiftify] Remove XFAIL from UnexpectedPointerType.swift test
Now that the DiagnosticsVerifier supports verifying diagnostics in macro expansions it's time to enable this test case.
1 parent 687449b commit 70ec916

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed
Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
// REQUIRES: swift_swift_parser
2-
3-
// XFAIL: *
4-
5-
// RUN: not %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s
6-
// RUN: %target-typecheck-verify-swift %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
7-
1+
//--- test.swift
82
@_SwiftifyImport(.countedBy(pointer: .param(1), count: "len"))
93
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: String) {
104
}
5+
// expected-note@-3 2{{in expansion of macro '_SwiftifyImport' on global function 'myFunc' here}}
116

12-
// CHECK: @_alwaysEmitIntoClient @_disfavoredOverload
13-
// CHECK-NEXT: func myFunc(_ ptr: UnsafeBufferPointer<CInt>) {
14-
// CHECK-NEXT: myFunc(ptr.baseAddress!, String(exactly: ptr.count)!)
15-
// CHECK-NEXT: }
7+
// expected-error@@__swiftmacro_4main6myFunc15_SwiftifyImportfMp_.swift:4:15{{no exact matches in call to initializer}}
8+
// expected-error@@__swiftmacro_4main6myFunc15_SwiftifyImportfMp_.swift:4:48{{cannot force unwrap value of non-optional type 'String'}}
169

17-
// expected-error@_SwiftifyImport:2{{no exact matches in call to initializer}}
10+
// REQUIRES: swift_swift_parser
11+
// RUN: %empty-directory(%t)
12+
// RUN: split-file %s %t
13+
// RUN: %target-swift-frontend %t/test.swift -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions -verify 2> %t/dump.txt
14+
// RUN: diff %t/myFunc.expected %t/dump.txt
15+
16+
//--- myFunc.expected
17+
@__swiftmacro_4main6myFunc15_SwiftifyImportfMp_.swift
18+
------------------------------
19+
/// This is an auto-generated wrapper for safer interop
20+
@_alwaysEmitIntoClient @_disfavoredOverload
21+
func myFunc(_ ptr: UnsafeBufferPointer<CInt>) {
22+
let len = String(exactly: unsafe ptr.count)!
23+
return unsafe myFunc(ptr.baseAddress!, len)
24+
}
25+
------------------------------

0 commit comments

Comments
 (0)