File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Sources/Testing/Parameterization Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -88,10 +88,22 @@ public struct TypeInfo: Sendable {
8888 ///
8989 /// - Parameters:
9090 /// - value: The value whose type this instance should describe.
91- init ( describingTypeOf value: borrowing some ~ Copyable) {
91+ init ( describingTypeOf value: some Any ) {
92+ #if !hasFeature(Embedded)
93+ let value = value as Any
94+ #endif
9295 let type = Swift . type ( of: value)
9396 self . init ( describing: type)
9497 }
98+
99+ /// Initialize an instance of this type describing the type of the specified
100+ /// value.
101+ ///
102+ /// - Parameters:
103+ /// - value: The value whose type this instance should describe.
104+ init < T> ( describingTypeOf value: borrowing T ) where T: ~ Copyable {
105+ self . init ( describing: T . self)
106+ }
95107}
96108
97109// MARK: - Name
Original file line number Diff line number Diff line change @@ -122,6 +122,11 @@ struct TypeInfoTests {
122122 #expect( !TypeInfo( describing: String . self) . isSwiftEnumeration)
123123 #expect( TypeInfo ( describing: SomeEnum . self) . isSwiftEnumeration)
124124 }
125+
126+ @Test func typeOfMoveOnlyValueIsInferred( ) {
127+ let value = MoveOnlyType ( )
128+ #expect( TypeInfo ( describingTypeOf: value) . unqualifiedName == " MoveOnlyType " )
129+ }
125130}
126131
127132// MARK: - Fixtures
@@ -131,3 +136,5 @@ extension String {
131136}
132137
133138private enum SomeEnum { }
139+
140+ private struct MoveOnlyType : ~ Copyable { }
You can’t perform that action at this time.
0 commit comments