-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Should nullability be checked with custom type overrides? #489
Comments
I'm torn about this because while I do agree that this is a footgun, it's much easier to teach this form as "this is exactly the type that will be emitted". We'd need a heuristic regarding when the user specifies Speaking of which, part of the reason we're providing type overrides is because nullability inference has edge cases that we may never be able to handle perfectly in Postgres or SQLite. I'm loathe to introduce yet more edge cases in what is intended to be a partial solution. It'd be nice if we could just make this a silencible compiler warning but we have no way to do that on stable. |
If we had const_if/const_panic we could make this a compiler error which would be robust through typedefs. |
I actually think we should do this:
This is an extension of what we already have:
After I wrote the above I realize that |
@mehcode Yeah, I think that is what I'd expect and I like your edit suggestion because it matches the stuff that's already there. |
Resolution was "yes" and implemented by @raftario, thank you :) |
I just had a runtime error surface in my application when moving to custom type overrides.
I have a nullable custom type that needs a override:
When doing the migration, I accidentally used
AS "faction: Faction"
and the code compiled, but I ended up with a runtime error.So, I'm wondering if that should have been caught by the compiler and informed me that I needed
Option
as part of my override.The text was updated successfully, but these errors were encountered: