Skip to content

Commit b4f736a

Browse files
authored
Mark Bundle(_dsoHandle:) call in macro expansion with unsafe (#1462)
* Mark `Bundle(_dsoHandle:)` call in macro expansion with `unsafe` * Add `unsafe` to expected macro expansion of bundle macro tests
1 parent 5cf1d36 commit b4f736a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/FoundationMacros/BundleMacro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct BundleMacro: SwiftSyntaxMacros.ExpressionMacro, Sendable {
2525
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
2626
return Bundle(for: __BundleLookupHelper.self)
2727
#else
28-
return Bundle(_dsoHandle: #dsohandle) ?? .main
28+
return unsafe Bundle(_dsoHandle: #dsohandle) ?? .main
2929
#endif
3030
}()
3131
"""

Tests/FoundationMacrosTests/BundleMacroTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private struct BundleMacroTests {
3131
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
3232
return Bundle(for: __BundleLookupHelper.self)
3333
#else
34-
return Bundle(_dsoHandle: #dsohandle) ?? .main
34+
return unsafe Bundle(_dsoHandle: #dsohandle) ?? .main
3535
#endif
3636
}()
3737
"""
@@ -53,7 +53,7 @@ private struct BundleMacroTests {
5353
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
5454
return Bundle(for: __BundleLookupHelper.self)
5555
#else
56-
return Bundle(_dsoHandle: #dsohandle) ?? .main
56+
return unsafe Bundle(_dsoHandle: #dsohandle) ?? .main
5757
#endif
5858
}()
5959
"""

0 commit comments

Comments
 (0)