File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
test/Interop/Cxx/stdlib/overlay Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,12 @@ extension std.string: Equatable {
7777 }
7878
7979 public static func += ( lhs: inout std . string , rhs: std . string ) {
80- lhs. __appendUnsafe ( rhs) // ignore the returned pointer
80+ lhs. append ( rhs)
81+ }
82+
83+ @inlinable
84+ public mutating func append( _ other: std . string ) {
85+ __appendUnsafe ( other) // ignore the returned pointer
8186 }
8287
8388 public static func + ( lhs: std . string , rhs: std . string ) -> std . string {
@@ -93,7 +98,12 @@ extension std.u16string: Equatable {
9398 }
9499
95100 public static func += ( lhs: inout std . u16string , rhs: std . u16string ) {
96- lhs. __appendUnsafe ( rhs) // ignore the returned pointer
101+ lhs. append ( rhs)
102+ }
103+
104+ @inlinable
105+ public mutating func append( _ other: std . u16string ) {
106+ __appendUnsafe ( other) // ignore the returned pointer
97107 }
98108
99109 public static func + ( lhs: std . u16string , rhs: std . u16string ) -> std . u16string {
Original file line number Diff line number Diff line change @@ -85,6 +85,20 @@ StdStringOverlayTestSuite.test("std::u16string operators") {
8585 expectTrue ( s1 == " something123literal " )
8686}
8787
88+ StdStringOverlayTestSuite . test ( " std::string::append " ) {
89+ var s1 = std. string ( " 0123 " )
90+ let s2 = std. string ( " abc " )
91+ s1. append ( s2)
92+ expectEqual ( s1, std. string ( " 0123abc " ) )
93+ }
94+
95+ StdStringOverlayTestSuite . test ( " std::u16string::append " ) {
96+ var s1 = std. u16string ( " 0123 " )
97+ let s2 = std. u16string ( " abc " )
98+ s1. append ( s2)
99+ expectEqual ( s1, std. u16string ( " 0123abc " ) )
100+ }
101+
88102StdStringOverlayTestSuite . test ( " std::string as Hashable " ) {
89103 let s0 = std. string ( )
90104 let h0 = s0. hashValue
You can’t perform that action at this time.
0 commit comments