File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ protected override void PopulateExpression(TextWriter trapFile)
4343
4444 public sealed override Microsoft . CodeAnalysis . Location ? ReportingLocation => base . ReportingLocation ;
4545
46+ private static bool IsArray ( ITypeSymbol symbol ) =>
47+ symbol . TypeKind == Microsoft . CodeAnalysis . TypeKind . Array || symbol . IsInlineArray ( ) ;
48+
4649 private static ExprKind GetKind ( Context cx , ExpressionSyntax qualifier )
4750 {
4851 var qualifierType = cx . GetType ( qualifier ) ;
@@ -59,7 +62,7 @@ private static ExprKind GetKind(Context cx, ExpressionSyntax qualifier)
5962
6063 return IsDynamic ( cx , qualifier )
6164 ? ExprKind . DYNAMIC_ELEMENT_ACCESS
62- : qualifierType . Symbol . TypeKind == Microsoft . CodeAnalysis . TypeKind . Array
65+ : IsArray ( qualifierType . Symbol )
6366 ? ExprKind . ARRAY_ACCESS
6467 : ExprKind . INDEXER_ACCESS ;
6568 }
Original file line number Diff line number Diff line change @@ -52,9 +52,15 @@ public Kinds.TypeKind GetTypeKind(Context cx, bool constructUnderlyingTupleType)
5252 {
5353 case TypeKind . Class : return Kinds . TypeKind . CLASS ;
5454 case TypeKind . Struct :
55- return ( ( INamedTypeSymbol ) Symbol ) . IsTupleType && ! constructUnderlyingTupleType
56- ? Kinds . TypeKind . TUPLE
57- : Kinds . TypeKind . STRUCT ;
55+ {
56+ if ( ( ( INamedTypeSymbol ) Symbol ) . IsTupleType && ! constructUnderlyingTupleType )
57+ {
58+ return Kinds . TypeKind . TUPLE ;
59+ }
60+ return Symbol . IsInlineArray ( )
61+ ? Kinds . TypeKind . INLINE_ARRAY
62+ : Kinds . TypeKind . STRUCT ;
63+ }
5864 case TypeKind . Interface : return Kinds . TypeKind . INTERFACE ;
5965 case TypeKind . Array : return Kinds . TypeKind . ARRAY ;
6066 case TypeKind . Enum : return Kinds . TypeKind . ENUM ;
Original file line number Diff line number Diff line change @@ -524,6 +524,13 @@ public static bool IsBoundSpan(this ITypeSymbol type) =>
524524 public static bool IsUnboundReadOnlySpan ( this ITypeSymbol type ) =>
525525 type . ToString ( ) == "System.ReadOnlySpan<T>" ;
526526
527+ public static bool IsInlineArray ( this ITypeSymbol type )
528+ {
529+ var attributes = type . GetAttributes ( ) ;
530+ var isInline = attributes . Any ( attribute => attribute . AttributeClass ? . Name == "InlineArrayAttribute" ) ;
531+ return isInline ;
532+ }
533+
527534 /// <summary>
528535 /// Holds if this type is of the form <code>System.ReadOnlySpan<byte></code>.
529536 /// </summary>
You can’t perform that action at this time.
0 commit comments