From 362f8ecb69a9fd6ac2b0a75a68e453108bcea939 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Mon, 11 Jan 2021 23:18:34 +0100 Subject: [PATCH] compiler: Add test for disallowing type-unstable array-assign binops --- artiq/test/lit/inferencer/error_array_augassign.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 artiq/test/lit/inferencer/error_array_augassign.py diff --git a/artiq/test/lit/inferencer/error_array_augassign.py b/artiq/test/lit/inferencer/error_array_augassign.py new file mode 100644 index 000000000..c868e50c6 --- /dev/null +++ b/artiq/test/lit/inferencer/error_array_augassign.py @@ -0,0 +1,11 @@ +# RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t +# RUN: OutputCheck %s --file-to-check=%t + +a = array([[1, 2], [3, 4]]) +b = 0.0 + +# CHECK-L: ${LINE:+1}: error: the result of this operation has type numpy.array(elt=float, num_dims=2), which cannot be assigned to a left-hand side of type float +b /= a + +# CHECK-L: ${LINE:+1}: error: the result of this operation has type numpy.array(elt=float, num_dims=2), which cannot be assigned to a left-hand side of type numpy.array(elt=numpy.int?, num_dims=2) +a /= a