Skip to content

Commit a37e107

Browse files
committed
Add more tests for variadic generic functions
1 parent cc22d39 commit a37e107

File tree

2 files changed

+85
-5
lines changed

2 files changed

+85
-5
lines changed

lldb/test/API/lang/swift/variadic_generics/TestSwiftVariadicGenerics.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,50 @@ class TestSwiftVariadicGenerics(TestBase):
1111
def test(self):
1212
self.build()
1313

14-
target, _, _, _ = lldbutil.run_to_source_breakpoint(
14+
target, process, _, _ = lldbutil.run_to_source_breakpoint(
1515
self, "break here", lldb.SBFileSpec('a.swift'))
1616

17+
# f1(args: a, b)
1718
self.expect("frame variable",
1819
substrs=["Pack{(a.A, a.B)}", "args", "i = 23", "d = 2.71"])
1920

21+
# f2(us: a, vs: b)
22+
process.Continue()
23+
self.expect("frame variable",
24+
substrs=["Pack{(a.A)}", "us", "i = 23",
25+
"Pack{(a.B)}", "vs", "d = 2.71"])
26+
27+
# f3(ts: a, b, more_ts: a, b)
28+
process.Continue()
29+
self.expect("frame variable",
30+
substrs=["Pack{(a.A, a.B)}", "ts", "i = 23", # FIXME! "d = 2.71",
31+
"Pack{(a.A, a.B)}", "more_ts", "i = 23", "d = 2.71"])
32+
33+
# f4(uvs: (a, b), (a, b))
34+
#process.Continue()
35+
#self.expect("frame variable",
36+
# substrs=[])
37+
38+
# f5(ts: (a, b), (42, b))
39+
process.Continue()
40+
self.expect("frame variable",
41+
substrs=[# FIXME: "Pack{(a.A, a.B), (Int, a,B)}",
42+
"ts", "i = 23", "d = 2.71"
43+
# FIXME: "42", "d = 2.71"
44+
])
45+
46+
# f6(us: a, more_us: a, vs: b, b)
47+
#process.Continue()
48+
#self.expect("frame variable",
49+
# substrs=[])
50+
51+
# f7(us: a, vs: 1, b, more_us: a, more_vs: 2, b)
52+
process.Continue()
53+
self.expect("frame variable",
54+
substrs=["Pack{(a.A)}", "us", # FIXME: "i = 23"
55+
"Pack{(Int, a.B)}", "vs", "= 1", "d = 2.71",
56+
"Pack{(a.A)}", "more_us", #FIXME: "i = 23"
57+
"Pack{(Int, a.B)}", "more_vs", "= 2", "d = 2.71"
58+
])
59+
60+

lldb/test/API/lang/swift/variadic_generics/a.swift

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,49 @@ public struct B {
55
var d: Double
66
}
77

8-
public func variadic_function<each T>(args: repeat each T) {
8+
let a = A(i: 23)
9+
let b = B(d: 2.71)
10+
11+
public func f1<each T>(args: repeat each T) {
12+
print("break here")
13+
}
14+
15+
f1(args: a, b)
16+
17+
public func f2<each U, each V>(us: repeat each U, vs: repeat each V) {
18+
print("break here")
19+
}
20+
21+
f2(us: a, vs: b)
22+
23+
public func f3<each T>(ts: repeat each T, more_ts: repeat each T) {
924
print("break here")
1025
}
26+
27+
f3(ts: a, b, more_ts: a, b)
1128

12-
let a = A(i: 23)
13-
let b = B(d: 2.71)
14-
variadic_function(args: a, b)
29+
// FIXME: Crashes the compiler.
30+
//public func f4<each U, each V>(uvs: repeat (each U, each V)) {
31+
// print("break here")
32+
//}
33+
//
34+
//f4(uvs: (a, b), (a, b))
35+
36+
public func f5<each T, U>(ts: repeat (each T, U)) {
37+
print("break here")
38+
}
39+
40+
f5(ts: (a, b), (42, b))
41+
42+
// FIXME: Crashes the compiler.
43+
//public func f6<each U, each V>(us: repeat each U, more_us: repeat each U, vs: repeat each V) {
44+
// print("break here")
45+
//}
46+
//
47+
//f6(us: a, more_us: a, vs: b, b)
48+
49+
public func f7<each U, each V>(us: repeat each U, vs: repeat each V, more_us: repeat each U, more_vs: repeat each V) {
50+
print("break here")
51+
}
52+
53+
f7(us: a, vs: 1, b, more_us: a, more_vs: 2, b)

0 commit comments

Comments
 (0)