20799, "lydia-duncan", "How to make things better for the user when forwarding a nilable class?", "2022-10-07T23:28:30Z"
I opened and closed two issues today because I forgot to write
var b: shared Bar?;
forwarding b!;
instead of
forwarding var b: shared Bar?;
The error messages were not super clear, I think the only reason I figured out for myself what was going on was because:
- it didn't work for a method that wasn't an edge case
- I've screwed this up before, iirc
I think we should do one of two things:
A. Ensure that we generate a warning for when forwarding a nilable class type without the ! or
B. Just always insert the ! for the user if they forgot it. I don't think there's any scenario where it would work to call the forwarded method otherwise (but someone that is more educated on nilability might come up with a case I've missed)