Skip to content

Commit 8f58ad6

Browse files
Xazax-hunj-hui
authored and
Gabor Horvath
committed
Update test/Interop/Cxx/foreign-reference/extensions.swift
Co-authored-by: John Hui <[email protected]>
1 parent 7bdd496 commit 8f58ad6

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
1-
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -enable-experimental-cxx-interop -Xfrontend -disable-availability-checking -Onone)
1+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -Onone) | %FileCheck %s
22
// REQUIRES: executable_test
33

4+
// Metadata for foreign reference types is not supported on Windows.
5+
// UNSUPPORTED: OS=windows-msvc
6+
47
import ReferenceCounted
58

69
protocol MyProto {
10+
static func g()
711
func foo() -> Self
12+
func bar(_ x: Self)
13+
func baz()
814
}
915

10-
extension NS.LocalCount {
11-
static func g() {}
16+
extension NS.LocalCount: MyProto {
17+
static func g() {
18+
print("Static method g called")
19+
}
1220

13-
public func f() {
21+
public func foo() -> Self {
1422
Self.g()
23+
return self
24+
}
25+
26+
public func bar(_ x: Self) {
1527
}
1628
}
1729

18-
extension NS.LocalCount: MyProto {
19-
public func foo() -> Self {
20-
return self
30+
extension MyProto {
31+
func baz() {
32+
Self.g()
33+
}
34+
}
35+
36+
extension NS.LocalCount {
37+
public func f() {
38+
Self.g()
2139
}
2240
}
2341

42+
2443
let x = NS.LocalCount.create()
2544
x.f()
45+
// CHECK: Static method g called
2646
let _ = x.foo()
47+
// CHECK-NEXT: Static method g called
48+
let _ = x.baz()
49+
// CHECK-NEXT: Static method g called
50+
x.bar(x)

0 commit comments

Comments
 (0)