Skip to content

Commit 88a3b34

Browse files
Merge pull request #6702 from adrian-prantl/more-variadic-tests
Test more variadic generic features that now work in the compiler
2 parents 4c87421 + afb7653 commit 88a3b34

File tree

2 files changed

+49
-19
lines changed

2 files changed

+49
-19
lines changed

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ def test(self):
3939

4040
# f4(uvs: (a, b), (a, b))
4141
#process.Continue()
42+
# FIXME: Crashes the demangler.
4243
#self.expect("frame variable",
43-
# substrs=[])
44+
# substrs=[""])
4445

4546
# f5(ts: (a, b), (42, b))
4647
process.Continue()
@@ -51,9 +52,12 @@ def test(self):
5152
])
5253

5354
# f6(us: a, more_us: a, vs: b, b)
54-
#process.Continue()
55-
#self.expect("frame variable",
56-
# substrs=[])
55+
process.Continue()
56+
self.expect("frame variable",
57+
substrs=["Pack{(a.A)}", "us", "i = 23",
58+
"Pack{(a.A)}", "more_us", "i = 23",
59+
"Pack{(a.B, a.B)}", "vs", "d = 2.71", "d = 2.71"
60+
])
5761

5862
# f7(us: a, vs: 1, b, more_us: a, more_vs: 2, b)
5963
process.Continue()
@@ -63,5 +67,22 @@ def test(self):
6367
"Pack{(a.A)}", "more_us", "i = 23",
6468
"Pack{(Int, a.B)}", "more_vs", "= 2", "d = 2.71"
6569
])
66-
70+
71+
process.Continue()
72+
process.Continue()
73+
self.expect("target variable s",
74+
substrs=["vals", "0 = 23", "1 = 2.71"])
75+
76+
# f8(<specialized self>)
77+
#process.Continue()
78+
#self.expect("frame variable",
79+
#substrs=["t", "0 = 23", "1 = 2.71"]
80+
# )
81+
82+
# f9(s: S<repeat each T>)
83+
#process.Continue()
84+
#self.expect("frame variable",
85+
# substrs=["t", "0 = 23", "1 = 2.71"]
86+
# )
87+
6788

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

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public func f3<each T>(ts: repeat each T, more_ts: repeat each T) {
2626

2727
f3(ts: a, b, more_ts: a, b)
2828

29-
// FIXME: Crashes the compiler.
29+
// FIXME: Crashes the demangler.
3030
//public func f4<each U, each V>(uvs: repeat (each U, each V)) {
3131
// print("break here")
3232
//}
@@ -39,23 +39,32 @@ public func f5<each T, U>(ts: repeat (each T, U)) {
3939

4040
f5(ts: (a, b), (42, b))
4141

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)
42+
public func f6<each U, each V>(us: repeat each U, more_us: repeat each U, vs: repeat each V) {
43+
print("break here")
44+
}
45+
46+
f6(us: a, more_us: a, vs: b, b)
4847

4948
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) {
5049
print("break here")
5150
}
5251

5352
f7(us: a, vs: 1, b, more_us: a, more_vs: 2, b)
5453

55-
//FIXME: Crashes the compiler.
56-
//struct S<each T> {
57-
// let vals : repeat each T
58-
//}
59-
//
60-
//let variadic_struct = S<Int, String, Float>(vals: (23, "hello", 3.14))
61-
//print("break here")
54+
struct S<each T> {
55+
let vals: (repeat each T)
56+
57+
func f8() {
58+
//print("break here")
59+
}
60+
}
61+
62+
let s = S<Int, Double>(vals: (23, 2.71))
63+
print("break here")
64+
s.f8()
65+
66+
func f9<each T>(s: S<repeat each T>) {
67+
//print("break here")
68+
}
69+
70+
f9(s: s)

0 commit comments

Comments
 (0)