Updated like the PR #2375

This commit is contained in:
Christoffer Lerno
2025-08-06 11:28:36 +02:00
parent 9c770f360e
commit 29bae1fbd6
2 changed files with 9 additions and 4 deletions

View File

@@ -147,11 +147,13 @@ fn usz? Formatter.out_str(&self, any arg) @private
return self.out_substr("void"); return self.out_substr("void");
case FAULT: case FAULT:
fault f = *(fault*)arg.ptr; fault f = *(fault*)arg.ptr;
return self.out_substr(f ? f.nameof : "(nofault)"); return self.out_substr(f ? f.nameof : "(empty-fault)");
case INTERFACE: case INTERFACE:
any a = *(any*)arg;
return a ? self.out_str(a) : self.out_substr("(empty-interface)");
case ANY: case ANY:
any a = *(any*)arg; any a = *(any*)arg;
return a ? self.out_str(a) : self.out_substr("(null)"); return a ? self.out_str(a) : self.out_substr("(empty-any)");
case OPTIONAL: case OPTIONAL:
unreachable(); unreachable();
case SIGNED_INT: case SIGNED_INT:

View File

@@ -20,10 +20,13 @@ fn void various_cornercases() @test
test::eq(string::tformat("%s", z), "[100]"); test::eq(string::tformat("%s", z), "[100]");
fault p; fault o = DERP; fault p; fault o = DERP;
test::eq(string::tformat("%s|%s", p, o), "(nofault)|format_test::DERP"); test::eq(string::tformat("%s|%s", p, o), "(empty-fault)|format_test::DERP");
Decl y; Decl y;
test::eq(string::tformat("%s", y), "(null)"); test::eq(string::tformat("%s", y), "(empty-interface)");
any xx;
test::eq(string::tformat("%s", xx), "(empty-any)");
int* x; int* x;
test::eq(string::tformat("%s", x), "0x0"); test::eq(string::tformat("%s", x), "0x0");