ensure inlined and allocated strings are equal

This commit is contained in:
Scott Richmond 2024-12-04 19:13:25 -05:00
parent c9038fd8fb
commit c3408a56c1
2 changed files with 5 additions and 6 deletions

View File

@ -58,12 +58,8 @@ use crate::base::*;
pub fn main() { pub fn main() {
let src = " let src = "
let foo = :foo let foo = \"foo\"
let bar = 42 eq (\"foo\", \"{foo}\")
let baz = \"foo bar baz\"
let quux = (1, 2, [3, 4, #{:five 6, :seven 8}])
\"{foo} {bar} {baz}
{quux} {fuzz} TADA!\"
"; ";
let (tokens, lex_errs) = lexer().parse(src).into_output_errors(); let (tokens, lex_errs) = lexer().parse(src).into_output_errors();
if !lex_errs.is_empty() { if !lex_errs.is_empty() {

View File

@ -160,6 +160,9 @@ impl<'src> PartialEq for Value<'src> {
(Value::Boolean(x), Value::Boolean(y)) => x == y, (Value::Boolean(x), Value::Boolean(y)) => x == y,
(Value::Number(x), Value::Number(y)) => x == y, (Value::Number(x), Value::Number(y)) => x == y,
(Value::InternedString(x), Value::InternedString(y)) => x == y, (Value::InternedString(x), Value::InternedString(y)) => x == y,
(Value::AllocatedString(x), Value::AllocatedString(y)) => x == y,
(Value::InternedString(x), Value::AllocatedString(y)) => *x == **y,
(Value::AllocatedString(x), Value::InternedString(y)) => **x == *y,
(Value::Keyword(x), Value::Keyword(y)) => x == y, (Value::Keyword(x), Value::Keyword(y)) => x == y,
(Value::Tuple(x), Value::Tuple(y)) => x == y, (Value::Tuple(x), Value::Tuple(y)) => x == y,
(Value::List(x), Value::List(y)) => x == y, (Value::List(x), Value::List(y)) => x == y,