mirror of
https://github.com/apple/swift.git
synced 2026-10-08 12:50:50 +02:00
Please do not add any more XFAIL's of this kind! If you break something under this configuration, you need to fix it before merging your PR.
67 lines
1.9 KiB
Swift
67 lines
1.9 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift -target %target-swift-5.9-abi-triple -lswiftSwiftReflectionTest %s -o %t/reflect_variadic_generic
|
|
// RUN: %target-codesign %t/reflect_variadic_generic
|
|
|
|
// RUN: %target-run %target-swift-reflection-test %t/reflect_variadic_generic | tee /dev/stderr | %FileCheck %s --dump-input=fail
|
|
|
|
// REQUIRES: reflection_test_support
|
|
// REQUIRES: executable_test
|
|
// UNSUPPORTED: use_os_stdlib
|
|
// UNSUPPORTED: asan
|
|
// XFAIL: swift_test_mode_optimize_none_with_opaque_values
|
|
|
|
import SwiftReflectionTest
|
|
|
|
struct VariadicStruct<each T> {
|
|
var values: (repeat each T)
|
|
}
|
|
|
|
class VariadicHolder<each T> {
|
|
var contents: (repeat each T)
|
|
init(_ values: repeat each T) {
|
|
contents = (repeat each values)
|
|
}
|
|
}
|
|
|
|
// Empty pack.
|
|
reflect(any: VariadicStruct< >(values: ()))
|
|
|
|
// CHECK: Reflecting an existential.
|
|
// CHECK: Type reference:
|
|
// CHECK: (bound_generic_struct reflect_variadic_generic.VariadicStruct
|
|
// CHECK-NEXT: (pack))
|
|
|
|
// One-element pack.
|
|
reflect(any: VariadicStruct<Int>(values: 5))
|
|
|
|
// CHECK: Reflecting an existential.
|
|
// CHECK: Type reference:
|
|
// CHECK: (bound_generic_struct reflect_variadic_generic.VariadicStruct
|
|
// CHECK-NEXT: (pack
|
|
// CHECK-NEXT: (struct Swift.Int)))
|
|
|
|
// Multi-element pack with mixed element types.
|
|
reflect(any: VariadicStruct<Int, String, Bool>(values: (1, "two", true)))
|
|
|
|
// CHECK: Reflecting an existential.
|
|
// CHECK: Type reference:
|
|
// CHECK: (bound_generic_struct reflect_variadic_generic.VariadicStruct
|
|
// CHECK-NEXT: (pack
|
|
// CHECK-NEXT: (struct Swift.Int)
|
|
// CHECK-NEXT: (struct Swift.String)
|
|
// CHECK-NEXT: (struct Swift.Bool)))
|
|
|
|
// Class with parameter pack.
|
|
reflect(object: VariadicHolder<Int, Double>(7, 3.14))
|
|
|
|
// CHECK: Reflecting an object.
|
|
// CHECK: Type reference:
|
|
// CHECK: (bound_generic_class reflect_variadic_generic.VariadicHolder
|
|
// CHECK-NEXT: (pack
|
|
// CHECK-NEXT: (struct Swift.Int)
|
|
// CHECK-NEXT: (struct Swift.Double)))
|
|
|
|
doneReflecting()
|
|
|
|
// CHECK: Done.
|