Skip to content

Commit a44b09b

Browse files
committed
stdlib: Fix handling of standard library types in _typeByName.
Mangling for the Swift module is 's', not 'Ss'.
1 parent bc36b2a commit a44b09b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

stdlib/public/core/Misc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func _typeByName(name: String) -> Any.Type? {
104104
// actually a class.
105105
var name = "C"
106106
if components[0] == "Swift" {
107-
name += "Ss"
107+
name += "s"
108108
} else {
109109
name += String(components[0].characters.count) + components[0]
110110
}

test/1_stdlib/Runtime.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ Runtime.test("typeByName") {
318318
expectTrue(_typeByName("a.SomeSubclass") == SomeSubclass.self)
319319
// name lookup will be via protocol conformance table
320320
expectTrue(_typeByName("a.SomeConformingClass") == SomeConformingClass.self)
321+
// FIXME: NonObjectiveCBase is slated to die, but I can't think of another
322+
// nongeneric public class in the stdlib...
323+
expectTrue(_typeByName("Swift.NonObjectiveCBase") == NonObjectiveCBase.self)
321324
}
322325

323326
Runtime.test("demangleName") {

0 commit comments

Comments
 (0)