|
3 | 3 | // RUN: %FileCheck %s < %t/interface.swift
|
4 | 4 |
|
5 | 5 | // Make sure we trigger typechecking and SIL diagnostics
|
6 |
| -// RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -I %S/Inputs -enable-experimental-feature SafeInteropWrappers -enable-experimental-feature Lifetimes -cxx-interoperability-mode=default -strict-memory-safety -warnings-as-errors -Xcc -std=c++20 %s |
| 6 | +// RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -I %S/Inputs -enable-experimental-feature SafeInteropWrappers -enable-experimental-feature Lifetimes -cxx-interoperability-mode=default -strict-memory-safety -warnings-as-errors -verify -Xcc -std=c++20 %s |
7 | 7 |
|
8 | 8 | // REQUIRES: swift_feature_SafeInteropWrappers
|
9 | 9 | // REQUIRES: swift_feature_Lifetimes
|
@@ -34,15 +34,10 @@ import CxxStdlib
|
34 | 34 | // CHECK-NEXT: }
|
35 | 35 | // CHECK: struct SpanWithoutTypeAlias {
|
36 | 36 | // CHECK-NEXT: init()
|
37 |
| -// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop |
38 |
| -// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) |
39 |
| -// CHECK-NEXT: @_lifetime(borrow self) |
40 |
| -// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public mutating func bar() -> Span<CInt> |
41 | 37 | // CHECK-NEXT: mutating func bar() -> std.{{.*}}span<__cxxConst<CInt>, _C{{.*}}_{{.*}}>
|
42 |
| -// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop |
43 |
| -// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) |
44 |
| -// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public mutating func foo(_ s: Span<CInt>) |
45 | 38 | // CHECK-NEXT: mutating func foo(_ s: std.{{.*}}span<__cxxConst<CInt>, _C{{.*}}_{{.*}}>)
|
| 39 | +// CHECK-NEXT: mutating func otherTemplatedType(_ copy: ConstSpanOfInt, _: S<CInt>) |
| 40 | +// CHECK-NEXT: mutating func otherTemplatedType2(_ copy: ConstSpanOfInt, _: UnsafeMutablePointer<S<CInt>>!) |
46 | 41 | // CHECK-NEXT: }
|
47 | 42 |
|
48 | 43 | // CHECK: /// This is an auto-generated wrapper for safer interop
|
@@ -150,7 +145,7 @@ func callMethodWithSafeWrapper(_ x: inout X, s: Span<CInt>) {
|
150 | 145 | }
|
151 | 146 |
|
152 | 147 | func callFooBar(_ x: inout SpanWithoutTypeAlias, _ s: ConstSpanOfInt) {
|
153 |
| - let _: Span<CInt> = x.bar() |
| 148 | + let _: Span<CInt> = x.bar() // expected-error {{cannot convert value of type}} |
154 | 149 | unsafe x.foo(s)
|
155 | 150 | }
|
156 | 151 |
|
@@ -242,3 +237,11 @@ func callMixedFuncWithSafeWrapper7(_ p: UnsafeBufferPointer<CInt>) {
|
242 | 237 | func callMutableKeyword(_ span: inout MutableSpan<CInt>) {
|
243 | 238 | mutableKeyword(&span)
|
244 | 239 | }
|
| 240 | + |
| 241 | +func callSpanWithoutTypeAlias(_ span: Span<CInt>) { |
| 242 | + spanWithoutTypeAlias(span) // expected-error {{cannot convert value of type}} |
| 243 | +} |
| 244 | + |
| 245 | +func callMutableSpanWithoutTypeAlias(_ span: consuming MutableSpan<CInt>) { |
| 246 | + mutableSpanWithoutTypeAlias(&span) // expected-error {{cannot convert value of type}} |
| 247 | +} |
0 commit comments