Skip to content

Commit

Permalink
fix: generate correct nullability for external array elements (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyMakkison authored Sep 4, 2023
1 parent 44b5df9 commit 7bf8104
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ ITypeSymbol enumeratedType

private static ITypeSymbol? GetEnumeratedType(WellKnownTypes types, ITypeSymbol type)
{
// if type is array return element type
// otherwise using the IEnumerable element type can erase the null annotation for external types
if (type.IsArrayType())
return ((IArrayTypeSymbol)type).ElementType;

if (type.ImplementsGeneric(types.Get(typeof(IEnumerable<>)), out var enumerableIntf))
return enumerableIntf.TypeArguments[0];

Expand Down

0 comments on commit 7bf8104

Please sign in to comment.