Replies: 1 comment 8 replies
-
This behaves exactly as intended, which is why primary constructor members are not defined as |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was making a few tests here with the new
required
modifier and noticed what I believe to be an incorrect emission of the CS9035 warning.The first warning works as I expect as I'm not providing
Value
on line1.The second warning however looks wrong to me. I'm passing
Value
and using the same name to initialize my propertyThe docs don't seem to talk explicitly about
required
, but they mention this:It would be even better if this was allowed though:
However that just fails spectacularly with a completely unrelated compilation error:
I do understand I can just opt-out of the primary constructor, but that also strips away the automatically generated tuple deconstructor, which I do want.
To get the behavior I want, I'm forced to drop the primary constructor and add my own deconstruct logic.
Beta Was this translation helpful? Give feedback.
All reactions