Closed Pentiva closed 1 year ago
Thank you for the contribution! I'll include it in next release.
I have had some changes with your implementation. I'll leave the note here.
ICollection
is not in System.Collections.Generic
but System.Collections
. Fixed this.GetEnumeratorSymbol
update does not cover explicit interface implementation, updated this accordingly. It will require additional effort for code generation to fall back explicit interface implementation. It is todo for now.
This stops the source generator from crashing with a
NullReferenceException
for ICollection types.GetEnumeratorSymbol
now falls back to implemented interfaces when the provided type symbol does not define one. This method was returning null when given anIReadOnlyCollection
and causing the whole generation to fail.TryGetGenericCollectionInterface
was also expanded to support all related collection interfaces.Tests for both
ICollection
andIReadOnlyCollection
were also added, but are probably overkill, as it was just the generation that was failing and might not be a necessity for ~300 extra tests.