- Support untyped second argument for operator overloading.

- Distinct versions of builtin types ignore @operator overloads #2204.
- @operator macro using untyped parameter causes compiler segfault #2200.
- Add comparison with `==` for ZString types.
This commit is contained in:
Christoffer Lerno
2025-06-13 17:12:39 +02:00
parent 82491a6f85
commit e0237096d6
8 changed files with 201 additions and 59 deletions

View File

@@ -577,6 +577,19 @@ fn usz? String.rindex_of(self, String substr)
return NOT_FOUND?;
}
fn bool ZString.eq(self, ZString other) @operator(==)
{
char* a = self;
char* b = other;
if (a == b) return true;
for (;; a++, b++)
{
char c = *a;
if (c != *b) return false;
if (!c) return true;
}
}
fn String ZString.str_view(self)
{
return (String)(self[:self.len()]);