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 {
88
88
///
89
89
/// - Parameters:
90
90
/// - 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
92
95
let type = Swift . type ( of: value)
93
96
self . init ( describing: type)
94
97
}
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
+ }
95
107
}
96
108
97
109
// MARK: - Name
Original file line number Diff line number Diff line change @@ -122,6 +122,11 @@ struct TypeInfoTests {
122
122
#expect( !TypeInfo( describing: String . self) . isSwiftEnumeration)
123
123
#expect( TypeInfo ( describing: SomeEnum . self) . isSwiftEnumeration)
124
124
}
125
+
126
+ @Test func typeOfMoveOnlyValueIsInferred( ) {
127
+ let value = MoveOnlyType ( )
128
+ #expect( TypeInfo ( describingTypeOf: value) . unqualifiedName == " MoveOnlyType " )
129
+ }
125
130
}
126
131
127
132
// MARK: - Fixtures
@@ -131,3 +136,5 @@ extension String {
131
136
}
132
137
133
138
private enum SomeEnum { }
139
+
140
+ private struct MoveOnlyType : ~ Copyable { }
You can’t perform that action at this time.
0 commit comments