From c4a1bd69557f00aa29afceebf6caad91396f8c05 Mon Sep 17 00:00:00 2001 From: gluax Date: Thu, 20 May 2021 12:50:49 -0400 Subject: [PATCH] merge and print strings like strings, rather than arrays --- compiler/src/value/value.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/compiler/src/value/value.rs b/compiler/src/value/value.rs index 1bb94ed34b..645fb5555f 100644 --- a/compiler/src/value/value.rs +++ b/compiler/src/value/value.rs @@ -99,14 +99,22 @@ impl<'a, F: PrimeField, G: GroupType> fmt::Display for ConstrainedValue<'a, F // Data type wrappers ConstrainedValue::Array(ref array) => { - write!(f, "[")?; - for (i, e) in array.iter().enumerate() { - write!(f, "{}", e)?; - if i < array.len() - 1 { - write!(f, ", ")?; + if matches!(array[0], ConstrainedValue::Char(_)) { + for character in array { + write!(f, "{}", character)?; } + + Ok(()) + } else { + write!(f, "[")?; + for (i, e) in array.iter().enumerate() { + write!(f, "{}", e)?; + if i < array.len() - 1 { + write!(f, ", ")?; + } + } + write!(f, "]") } - write!(f, "]") } ConstrainedValue::Tuple(ref tuple) => { let values = tuple.iter().map(|x| x.to_string()).collect::>().join(", ");