When using optionals/errors, I find myself accidentally forgetting to unwrap first, and I have to scan the compiler error a few times before I realize what the problem is. For example:
const result = m.some_field + 3;
When running zig test, I get this error:
_ = m.some_field + 3;
~^~~~~~~~~~~
That sentence is totally true. However, when you're scanning output (especially big console logs), its easy to miss the ? or the ! (single character at the front of the string, I'm usually looking at the end of the string to figure out which type it was that failed). Is there a way to get the compiler to check if the unwrapped ? thing supports field access and then print a message suggesting that that might be the problem? Or make it more obvious that this is an optional/error type? Something like:
type '?test.MyData' does not support field access, but 'test.MyData' does. Possibly need to unwrap the optional?
or even:
Optional type '?test.MyData' does not support field access.