Description
Description
I'm using name2 pattern at first. But then I thought I should refactor to use name1 pattern. But it will give me a strange compiler error.
Is this an expected unsupported feature like swiftlang/swift-testing#202 or a bug here.
struct DemoKitTests {
@Test(
arguments: [
(type: Int.self, nominalName: "Int"),
(type: String.self, nominalName: "String"),
]
)
func name1(type: Any.Type, nominalName: String) {
#expect(API.name(type) == nominalName)
}
@Test
func name2() {
#expect(API.name(Int.self) == "Int")
#expect(API.name(String.self) == "String")
}
}
Expected behavior
Compile and test successfully.
Actual behavior
Compile error on language mode v5. (On v6 it is Any is not conform to Sendable)
xx.swift:17:4 Static method '__function(named:in:xcTestCompatibleSelector:displayName:traits:arguments:sourceLocation:parameters:testFunction:)' requires the types 'Any' and '(any Any.Type, String)' be equivalent
Steps to reproduce
See description field.
Or use the following demokit package
swift-testing version/commit hash
Xcode 16.0.0
Swift & OS version (output of swift --version ; uname -a
)
Swift 6 compiler with Swift 5 language mode