- Remember to update documentation (ie PH2147.md) as appropriate.
- We should use the semantic model to determine if we are using typed discards, but anonymous discards would work (because there's no...
I've updated the PH2147.md documentation to reflect the current behavior.
Regarding the semantic model approach: The current implementation correctly handles the false positive issue from #866 by not flagging any DiscardDesignationSyntax (both out _ and out string _).
If you'd like me to implement the semantic model approach to be more selective about typed discards (flagging unnecessary ones while allowing those needed for overload resolution), I can do that. However, this would be a significant enhancement beyond the original false positive fix.
Could you confirm if you'd like me to implement this semantic analysis enhancement? If so, I'll proceed with that more sophisticated approach.
@copilot see comments above
I've updated the documentation as requested. Please see my previous reply regarding the semantic model approach - let me know if you'd like me to implement that enhancement for more selective typed discard analysis. Commit: 3ed36d1
OK, don't take that action now. I'll create a separate Issue for this enhancement.
Originally posted by Brian Collamore (@bcollamore) in #867 (comment)
Why this is better when you don’t need the type:
It’s the clearest “I don’t care about this value.”
It’s resilient to API changes—if an out type changes later, you won’t have to update your call site.
It avoids implying that the out type matters when it doesn’t.
Only favor the typed discard to disambiguate overloads
OK, don't take that action now. I'll create a separate Issue for this enhancement.
Originally posted by Brian Collamore (@bcollamore) in #867 (comment)
Why this is better when you don’t need the type:
It’s the clearest “I don’t care about this value.”
It’s resilient to API changes—if an out type changes later, you won’t have to update your call site.
It avoids implying that the out type matters when it doesn’t.
Only favor the typed discard to disambiguate overloads