diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index bec72ef52b..4b671f2486 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -1091,15 +1091,15 @@ static inline std::string extract_dim_value(ASR::expr_t* dim) { static inline std::string type_encode_dims(size_t n_dims, ASR::dimension_t* m_dims ) { - std::string dims_str = ""; + std::string dims_str = "["; for( size_t i = 0; i < n_dims; i++ ) { ASR::dimension_t dim = m_dims[i]; - dims_str += "["; - // dims_str += extract_dim_value(dim.m_start); - // dims_str += ","; dims_str += extract_dim_value(dim.m_length); - dims_str += "]"; + if (i + 1 < n_dims) { + dims_str += ","; + } } + dims_str += "]"; return dims_str; } diff --git a/tests/reference/asr-arrays_05-ec8fbd5.json b/tests/reference/asr-arrays_05-ec8fbd5.json index 695a74d7a7..a4302b38e0 100644 --- a/tests/reference/asr-arrays_05-ec8fbd5.json +++ b/tests/reference/asr-arrays_05-ec8fbd5.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_05-ec8fbd5.stderr", - "stderr_hash": "b92b252106c95d1851599993abbedd755f2b3231f5b551b3af33b67e", + "stderr_hash": "4e5d42a186b8d82b484ec66ccc5a3b90da7e4be8a32bac26ea906198", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_05-ec8fbd5.stderr b/tests/reference/asr-arrays_05-ec8fbd5.stderr index 453518d819..165aee29a8 100644 --- a/tests/reference/asr-arrays_05-ec8fbd5.stderr +++ b/tests/reference/asr-arrays_05-ec8fbd5.stderr @@ -2,4 +2,4 @@ semantic error: Type mismatch in annotation-assignment, the types must be compat --> tests/errors/arrays_05.py:6:5 | 6 | x: i16[5, 4] = empty([5, 3], dtype=int16) - | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5][4]' and 'i16[5][3]') + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5,4]' and 'i16[5,3]') diff --git a/tests/reference/asr-arrays_06-fbb09a3.json b/tests/reference/asr-arrays_06-fbb09a3.json index c286109174..863eeebf1e 100644 --- a/tests/reference/asr-arrays_06-fbb09a3.json +++ b/tests/reference/asr-arrays_06-fbb09a3.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_06-fbb09a3.stderr", - "stderr_hash": "0cd2825fa152a45c868b7f54832a95d0f457be296143f28ce1909870", + "stderr_hash": "1fa3f5061a72f03c0678806c0460b9ec5caf01cbbd2f07a606f1057e", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_06-fbb09a3.stderr b/tests/reference/asr-arrays_06-fbb09a3.stderr index e3cc3fea78..9bbcde8ee8 100644 --- a/tests/reference/asr-arrays_06-fbb09a3.stderr +++ b/tests/reference/asr-arrays_06-fbb09a3.stderr @@ -2,4 +2,4 @@ semantic error: Type mismatch in annotation-assignment, the types must be compat --> tests/errors/arrays_06.py:6:5 | 6 | x: i16[5, 4] = empty([5, 4], dtype=int32) - | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5][4]' and 'i32[5][4]') + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5,4]' and 'i32[5,4]') diff --git a/tests/reference/asr-arrays_07-de430fd.json b/tests/reference/asr-arrays_07-de430fd.json index 6218500661..19a44750cc 100644 --- a/tests/reference/asr-arrays_07-de430fd.json +++ b/tests/reference/asr-arrays_07-de430fd.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_07-de430fd.stderr", - "stderr_hash": "ea9cadd25ae52d3ff115925e4f8e6feb278ad009410d64c940cf64ff", + "stderr_hash": "7fadea44b4ad8f383e0cadbd27a53eb3ab75f0edef98d27639527723", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_07-de430fd.stderr b/tests/reference/asr-arrays_07-de430fd.stderr index e4846db907..7624d1fe92 100644 --- a/tests/reference/asr-arrays_07-de430fd.stderr +++ b/tests/reference/asr-arrays_07-de430fd.stderr @@ -2,4 +2,4 @@ semantic error: Type mismatch in annotation-assignment, the types must be compat --> tests/errors/arrays_07.py:6:5 | 6 | x: f32[5, 4] = empty([5, 4], dtype=complex64) - | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('f32[5][4]' and 'c32[5][4]') + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('f32[5,4]' and 'c32[5,4]') diff --git a/tests/reference/asr-arrays_08-ba317a3.json b/tests/reference/asr-arrays_08-ba317a3.json index 5adc25d3f3..56982fe195 100644 --- a/tests/reference/asr-arrays_08-ba317a3.json +++ b/tests/reference/asr-arrays_08-ba317a3.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_08-ba317a3.stderr", - "stderr_hash": "a6fc0e1c661fab5e3ee0a034abb85d765a1dce515483a2a6191b2aa7", + "stderr_hash": "bedb87b219b7c49a18cced170e4ffcac780d242f70c3ae8bbfb27a26", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_08-ba317a3.stderr b/tests/reference/asr-arrays_08-ba317a3.stderr index 17d804e01d..e8f8eb441e 100644 --- a/tests/reference/asr-arrays_08-ba317a3.stderr +++ b/tests/reference/asr-arrays_08-ba317a3.stderr @@ -2,4 +2,4 @@ semantic error: Type mismatch in annotation-assignment, the types must be compat --> tests/errors/arrays_08.py:9:5 | 9 | x: i64[p, q, r] = empty([q, p, r], dtype=int64) - | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i64[100][120][200]' and 'i64[120][100][200]') + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i64[100,120,200]' and 'i64[120,100,200]')