-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove MaybeNull from Output/Input.Create to avoid spurious warnings #6600
Conversation
Let me check if the user can promote |
Looks like the compiler rejects an attempt to pass null into Output.Create both before and after the change, so this is a no-op in that sense. |
Hmm, how so? |
It's valid for compilation but does generate a warning. I believe this warning stays before and after the PR. |
And
|
Are you missing |
Ah, right, so that's the same as
right? This gives me no warnings. |
Okay. Next question - why did we have |
#3399 introduced it. Any ideas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best hypothesis I have is that the intention was to use AllowNull
in those cases instead of MaybeNull
. MaybeNull
seems to be intended for return types, so our usage doesn't look valid. I don't quite understand when AllowNull
would be needed - I'd appreciate an explanation if you have it, but otherwise the change LGTM.
Btw, I'd still change-log this fix as the consequence is externally visible. |
OK I dug into the
IN current version of Pulumi we would expect the user to fix this to:
However, if we wanted to accept the original program, and say generate an output that resolves to null although it promises to be Output with a non-nullable string, we could use AllowNull attribute. The AllowNull needs to propagate deeper into the SDK, here is a demonstration of how that might look like: |
Now, I have some FP/F# bias so in my book that sounds like a bad idea to add AllowNull. I would vote for default behavior here. If necessary the user can defeat the null checker outside of the SDK - in the user code. |
…ulumi/pulumi#6600) * Remove MaybeNull attr from read-only params on Input/Output constructors * Update changelog
Addresses #6295