File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -586,7 +586,7 @@ open class NSMutableDictionary : NSDictionary {
586
586
guard type ( of: self ) === NSDictionary . self || type ( of: self ) === NSMutableDictionary . self else {
587
587
NSRequiresConcreteImplementation ( )
588
588
}
589
- _storage [ ( aKey as! NSObject ) ] = _SwiftValue. store ( anObject)
589
+ _storage [ _SwiftValue . store ( aKey) ] = _SwiftValue. store ( anObject)
590
590
}
591
591
592
592
public convenience required init ( ) {
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class TestNSDictionary : XCTestCase {
32
32
( " test_mutableCopying " , test_mutableCopying) ,
33
33
( " test_writeToFile " , test_writeToFile) ,
34
34
( " test_initWithContentsOfFile " , test_initWithContentsOfFile) ,
35
+ ( " test_settingWithStringKey " , test_settingWithStringKey) ,
35
36
]
36
37
}
37
38
@@ -222,6 +223,12 @@ class TestNSDictionary : XCTestCase {
222
223
}
223
224
}
224
225
226
+ func test_settingWithStringKey( ) {
227
+ let dict = NSMutableDictionary ( )
228
+ // has crashed in the past
229
+ dict [ " stringKey " ] = " value "
230
+ }
231
+
225
232
private func createTestFile( _ path: String , _contents: Data ) -> String ? {
226
233
let tempDir = NSTemporaryDirectory ( ) + " TestFoundation_Playground_ " + NSUUID( ) . uuidString + " / "
227
234
do {
You can’t perform that action at this time.
0 commit comments