cathei / LinqGen

Alloc-free and fast replacement for Linq, with code generation
MIT License
287 stars 12 forks source link

Collection fixes #7

Closed Pentiva closed 1 year ago

Pentiva commented 1 year ago

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 an IReadOnlyCollection and causing the whole generation to fail. TryGetGenericCollectionInterface was also expanded to support all related collection interfaces.

Tests for both ICollection and IReadOnlyCollection 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.

cathei commented 1 year ago

Thank you for the contribution! I'll include it in next release.

cathei commented 1 year ago

I have had some changes with your implementation. I'll leave the note here.