File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ protected override void PopulateExpression(TextWriter trapFile)
43
43
44
44
public sealed override Microsoft . CodeAnalysis . Location ? ReportingLocation => base . ReportingLocation ;
45
45
46
+ private static bool IsArray ( ITypeSymbol symbol ) =>
47
+ symbol . TypeKind == Microsoft . CodeAnalysis . TypeKind . Array || symbol . IsInlineArray ( ) ;
48
+
46
49
private static ExprKind GetKind ( Context cx , ExpressionSyntax qualifier )
47
50
{
48
51
var qualifierType = cx . GetType ( qualifier ) ;
@@ -59,7 +62,7 @@ private static ExprKind GetKind(Context cx, ExpressionSyntax qualifier)
59
62
60
63
return IsDynamic ( cx , qualifier )
61
64
? ExprKind . DYNAMIC_ELEMENT_ACCESS
62
- : qualifierType . Symbol . TypeKind == Microsoft . CodeAnalysis . TypeKind . Array
65
+ : IsArray ( qualifierType . Symbol )
63
66
? ExprKind . ARRAY_ACCESS
64
67
: ExprKind . INDEXER_ACCESS ;
65
68
}
Original file line number Diff line number Diff line change @@ -52,9 +52,15 @@ public Kinds.TypeKind GetTypeKind(Context cx, bool constructUnderlyingTupleType)
52
52
{
53
53
case TypeKind . Class : return Kinds . TypeKind . CLASS ;
54
54
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
+ }
58
64
case TypeKind . Interface : return Kinds . TypeKind . INTERFACE ;
59
65
case TypeKind . Array : return Kinds . TypeKind . ARRAY ;
60
66
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) =>
524
524
public static bool IsUnboundReadOnlySpan ( this ITypeSymbol type ) =>
525
525
type . ToString ( ) == "System.ReadOnlySpan<T>" ;
526
526
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
+
527
534
/// <summary>
528
535
/// Holds if this type is of the form <code>System.ReadOnlySpan<byte></code>.
529
536
/// </summary>
You can’t perform that action at this time.
0 commit comments