You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm unsure how feasible this is but it would be helpful if the helper isn't emitted if the struct is never boxed (and never gets a constrained call on Equals/GetHashCode either).
I understand the difficulty of tracking whether a struct is 'boxed', as generics (and (T)(object)value casts etc) significantly complicate the analysis. Though with struct types forcing specialization it should not be impossible to get some certainty?
The text was updated successfully, but these errors were encountered:
Do you have an example where the struct is not boxed but we still generate the helper? We do not generate the helper unless the compiler thinks it could be boxed.
Bar is there even though not boxed, but there are easy ways to get it as boxed. For example: call Array.GetValue. Or cast to non-generic IEnumerable and enumerate. Etc. The compiler doesn't track what exact object instance the interface methods get called on and these foundational interfaces are pretty much guaranteed to get called somewhere.
I'm unsure how feasible this is but it would be helpful if the helper isn't emitted if the struct is never boxed (and never gets a constrained call on Equals/GetHashCode either).
I understand the difficulty of tracking whether a struct is 'boxed', as generics (and
(T)(object)value
casts etc) significantly complicate the analysis. Though with struct types forcing specialization it should not be impossible to get some certainty?The text was updated successfully, but these errors were encountered: