compiler: add support for concatenating bytes values (#714).

This commit is contained in:
whitequark 2017-06-09 06:00:57 +00:00
parent 7b2da5294f
commit 778e7dc2ab
2 changed files with 7 additions and 1 deletions

View File

@ -396,7 +396,8 @@ class Inferencer(algorithm.Visitor):
self._unify(left.type, right.type,
left.loc, right.loc)
return left.type, left.type, right.type
elif builtins.is_str(left.type) or builtins.is_str(right.type):
elif (builtins.is_str(left.type) or builtins.is_str(right.type) or
builtins.is_bytes(left.type) or builtins.is_bytes(right.type)):
self._unify(left.type, right.type,
left.loc, right.loc)
return left.type, left.type, right.type

View File

@ -0,0 +1,5 @@
# RUN: %python -m artiq.compiler.testbench.jit %s
# RUN: %python %s
assert b"xy" == b"xy"
assert (b"x" + b"y") == b"xy"