added check for to_string in is_struct_with_default_print

The function wasn't checking if the struct had the method `to_string` which made it segfault when trying to override the default to_string on a struct
This commit is contained in:
Ellipse12
2024-11-23 11:07:34 -07:00
committed by Christoffer Lerno
parent 9b94c1dda9
commit a58d782704

View File

@@ -28,7 +28,8 @@ macro bool is_struct_with_default_print($Type)
{
return $Type.kindof == STRUCT
&&& !$defined($Type.to_format)
&&& !$defined($Type.to_new_string);
&&& !$defined($Type.to_new_string)
&&& !$defined($Type.to_string);
}
<*
@@ -529,4 +530,4 @@ fn usz! Formatter.print(&self, String str)
}
foreach (c : str) self.out(c)!;
return self.idx;
}
}