dmd/compiler/test/runnable/test24371.d
Teodor Dutu 2423b93798 Fix Bugzilla Issue 24371 - String array concatenation does not respect operator precedence
Rethink lowering logic to account for parentheses and operator
associativity.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2024-02-20 20:40:45 +08:00

15 lines
378 B
D

// https://issues.dlang.org/show_bug.cgi?id=24371
void main()
{
assert("b" ~ "c" == "bc");
assert(["a"] ~ "b" == ["a", "b"]);
assert(["a"] ~ ("b" ~ "c") == ["a", "bc"]);
auto strArr = ["a"];
assert(strArr ~ ("b" ~ "c") == ["a", "bc"]);
auto str = "c";
assert(["a"] ~ ("b" ~ str) == ["a", "bc"]);
assert(strArr ~ ("b" ~ str) == ["a", "bc"]);
}