Skip to content

Commit f9631e1

Browse files
authored
Merge pull request #75768 from kubamracek/embedded-string-switch
[embedded] Add StringSwitch.swift to the embedded stdlib
2 parents f4d6eda + 5f83c58 commit f9631e1

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

stdlib/public/core/BridgeStorage.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ internal struct _BridgeStorage<NativeClass: AnyObject> {
178178
@inlinable
179179
@inline(__always)
180180
internal init(native: Native) {
181+
#if !$Embedded
181182
_internalInvariant(_usesNativeSwiftReferenceCounting(NativeClass.self))
183+
#endif
182184
rawValue = native
183185
}
184186

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ split_embedded_sources(
179179
EMBEDDED StringRangeReplaceableCollection.swift
180180
EMBEDDED StringStorage.swift
181181
EMBEDDED StringStorageBridge.swift
182-
NORMAL StringSwitch.swift
182+
EMBEDDED StringSwitch.swift
183183
EMBEDDED StringTesting.swift
184184
EMBEDDED StringUnicodeScalarView.swift
185185
EMBEDDED StringUTF16View.swift

test/embedded/string-switch.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -wmo -Xlinker %swift_obj_root/lib/swift/embedded/%target-cpu-apple-macos/libswiftUnicodeDataTables.a) | %FileCheck %s
2+
3+
// REQUIRES: swift_in_compiler
4+
// REQUIRES: executable_test
5+
// REQUIRES: optimized_stdlib
6+
// REQUIRES: OS=macosx
7+
8+
enum MyEnum: String {
9+
case foo
10+
case bar
11+
}
12+
13+
var e = MyEnum.foo
14+
print(e.rawValue)
15+
e = MyEnum.bar
16+
print(e.rawValue)
17+
// CHECK: foo
18+
// CHECK: bar

0 commit comments

Comments
 (0)