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 {
77
77
}
78
78
79
79
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
81
86
}
82
87
83
88
public static func + ( lhs: std . string , rhs: std . string ) -> std . string {
@@ -93,7 +98,12 @@ extension std.u16string: Equatable {
93
98
}
94
99
95
100
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
97
107
}
98
108
99
109
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") {
85
85
expectTrue ( s1 == " something123literal " )
86
86
}
87
87
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
+
88
102
StdStringOverlayTestSuite . test ( " std::string as Hashable " ) {
89
103
let s0 = std. string ( )
90
104
let h0 = s0. hashValue
You can’t perform that action at this time.
0 commit comments