Commits

Maciej Fijalkowski committed f65667e

one more test

Comments (0)

Files changed (2)

pypy/rpython/rbytearray.py

 
 class __extend__(pairtype(AbstractByteArrayRepr, AbstractByteArrayRepr)):
     def rtype_add((r_b1, r_b2), hop):
-        xxx
+        if hop.s_result.is_constant():
+            return hop.inputconst(r_b1, hop.s_result.const)
+        v_b1, v_b2 = hop.inputargs(r_b1, r_b2)
+        return hop.gendirectcall(r_b1.ll.ll_strconcat, v_b1, v_b2)
 
 class __extend__(pairtype(AbstractByteArrayRepr, AbstractStringRepr)):
     def rtype_add((r_b1, r_s2), hop):

pypy/rpython/test/test_rbytearray.py

 
         ll_res = self.interpret(f2, [llstr("def")])
         assert hlbytearray(ll_res) == "defa"
+
+        def f3(x):
+            return bytearray(hlstr(x)) + bytearray("a")
+
+        ll_res = self.interpret(f3, [llstr("def")])
+        assert hlbytearray(ll_res) == "defa"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.