Skip to content

Commit 07aae0c

Browse files
committed
Add minimal SILGen and Serialization tests for variadic generics
1 parent 70dec2b commit 07aae0c

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

test/SILGen/pack_expansion_type.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-emit-silgen %s -enable-experimental-feature VariadicGenerics | %FileCheck %s
2+
3+
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type16variadicFunction1t1ux_q_txQp_txxQp_q_q_Qptq_Rhzr0_lF : $@convention(thin) <T..., U... where ((T, U)...) : Any> (@in_guaranteed T..., @in_guaranteed U...) -> @out (T, U)... {
4+
// CHECK: bb0(%0 : $*(T, U)..., %1 : $*T..., %2 : $*U...):
5+
public func variadicFunction<T..., U...>(t: T..., u: U...) -> ((T, U)...) {}
6+
7+
public struct VariadicType<T...> {
8+
// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type12VariadicTypeV14variadicMethod1t1ux_qd__txQp_txxQp_qd__qd__Qptqd__RhzlF : $@convention(method) <T...><U... where ((T, U)...) : Any> (@in_guaranteed T..., @in_guaranteed U..., VariadicType<T>) -> @out (T, U)... {
9+
// CHECK: bb0(%0 : $*(T, U)..., %1 : $*T..., %2 : $*U..., %3 : $VariadicType<T>):
10+
public func variadicMethod<U...>(t: T..., u: U...) -> ((T, U)...) {}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public func variadicFunction<T..., U...>(t: T..., u: U...) -> ((T, U)...) {
2+
// FIXME: return ((t, u)...)
3+
fatalError()
4+
}
5+
6+
public struct VariadicType<T...> {
7+
public func variadicMethod<U...>(t: T..., u: U...) -> ((T, U)...) {
8+
// FIXME: return ((t, u)...)
9+
fatalError()
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend %S/Inputs/pack_expansion_type_other.swift -emit-module -emit-module-path %t/pack_expansion_type_other.swiftmodule -enable-experimental-feature VariadicGenerics
3+
4+
import pack_expansion_type_other
5+
6+
variadicFunction(t: 1, 2, u: "hi", "bye")
7+
8+
VariadicType<Int, String>.variadicMethod(t: 1, 2, u: "hi", "bye")

0 commit comments

Comments
 (0)