mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Updated like the PR #2375
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user