[stdlib] String: Fix more potential UB, and rework access patterns

This commit is contained in:
Karoy Lorentey
2023-02-13 22:14:30 -08:00
parent 86467bbe63
commit cf1b9d9404
4 changed files with 67 additions and 38 deletions

View File

@@ -123,7 +123,7 @@ extension _StringGuts {
// Whether this string has breadcrumbs
internal var hasBreadcrumbs: Bool {
return hasSharedStorage
|| (hasNativeStorage && _object.nativeStorage.hasBreadcrumbs)
|| (hasNativeStorage && _object.withNativeStorage { $0.hasBreadcrumbs })
}
}