From 778e7dc2ab5629104aeefaacef74b0df8c7ddf05 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 9 Jun 2017 06:00:57 +0000 Subject: [PATCH] compiler: add support for concatenating bytes values (#714). --- artiq/compiler/transforms/inferencer.py | 3 ++- artiq/test/lit/integration/bytes.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 artiq/test/lit/integration/bytes.py diff --git a/artiq/compiler/transforms/inferencer.py b/artiq/compiler/transforms/inferencer.py index 194c3832d..9a3cbd0ed 100644 --- a/artiq/compiler/transforms/inferencer.py +++ b/artiq/compiler/transforms/inferencer.py @@ -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 diff --git a/artiq/test/lit/integration/bytes.py b/artiq/test/lit/integration/bytes.py new file mode 100644 index 000000000..da68591e2 --- /dev/null +++ b/artiq/test/lit/integration/bytes.py @@ -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"