This patch fixes a bug with code generation not generating the required code for
string comparisons in some cases. This resulted into odd behaviour when writing
code like:
foo := () => "hello"
main := () => {
if "hello" == foo() {
println("yes!")
}
}
The existing implementation tried to compare by ptr which inevitably failed
due to the strs having different base addresses. Hence, in the above example, `yes!
would not be printed.
This now properly invokes str_eq in all string comparison cases, and ensures
that string comparisons behave as expected.
Description
This patch fixes a bug with code generation not generating the required code for string comparisons in some cases. This resulted into odd behaviour when writing code like:
The existing implementation tried to compare by
ptr
which inevitably failed due to thestr
s having different base addresses. Hence, in the above example, `yes! would not be printed.This now properly invokes
str_eq
in all string comparison cases, and ensures that string comparisons behave as expected.Commits
note_on_span!
into functionReprTy::is_scalar
implementationnon_scalar_compare
to usebuild_non_scalar_binary_compare
strings_in_matches
stdout