File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -983,7 +983,7 @@ extension _StringObject {
983983 #if !$Embedded
984984 return _unsafeUncheckedDowncast ( storage, to: __StringStorage. self)
985985 #else
986- return unsafeBitCast ( _nativeObject ( toNative : storage) , to : __StringStorage . self )
986+ return Builtin . castFromNativeObject ( storage)
987987 #endif
988988#else
989989#error("Unknown platform")
@@ -1022,7 +1022,7 @@ extension _StringObject {
10221022 #if !$Embedded
10231023 return _unsafeUncheckedDowncast ( storage, to: __SharedStringStorage. self)
10241024 #else
1025- return unsafeBitCast ( _nativeObject ( toNative : storage) , to : __SharedStringStorage . self )
1025+ return Builtin . castFromNativeObject ( storage)
10261026 #endif
10271027#else
10281028#error("Unknown platform")
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded
2+ // RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded -O
3+ // RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded -Osize
4+
5+ // REQUIRES: swift_in_compiler
6+ // REQUIRES: OS=macosx || OS=linux-gnu
7+ // REQUIRES: CODEGENERATOR=ARM
8+
9+ @main
10+ struct Main {
11+ static func main( ) {
12+ let n = 42
13+ let m = - 42
14+ let s = " str "
15+ let str = " Hello \( s) \( n) \( s) \( m) "
16+ print ( str)
17+
18+ print ( " hex: \( hex: 42 ) " )
19+ print ( " ptr: \( UnsafeRawPointer ( bitPattern: UInt ( 0xffff0000 ) ) !) " )
20+ }
21+ }
22+
23+ extension DefaultStringInterpolation {
24+ mutating func appendInterpolation( hex value: Int ) {
25+ appendInterpolation ( " 0x " + String( value, radix: 16 ) )
26+ }
27+
28+ mutating func appendInterpolation( _ value: UnsafeRawPointer ) {
29+ appendInterpolation ( " 0x " + String( UInt ( bitPattern: value) , radix: 16 ) )
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments