Skip to content

Test Plan for "Inline Arrays" feature #67826

@AlekseyTs

Description

@AlekseyTs

Championed proposal: dotnet/csharplang#7431
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-12.0/inline-arrays.md
Feature branch: https://github.com/dotnet/roslyn/tree/features/InlineArrays

Compiler

  • language version
  • runtime support required *_RuntimeSupport
  • update compiler test plan
  • as local
  • as parameter including ref, in, out
  • as return type
  • as field or property
    • in class, struct
    • as ref, ref readonly field
  • in array
  • in span
  • as type argument
  • inline array type
    • non-generic, generic
    • multiple attributes InlineArrayType_04_MultipleAttributes
    • Length <= 0 InlineArrayType_*_WrongLength
    • no fields InlineArrayType_09_NoFields
    • multiple fields (including from event, property, primary constructor) InlineArrayType_08_MoreThanOneField
    • static fields InlineArrayType_*StaticField*
    • ref field InlineArrayType_*_RefField
    • class, interface, delegate, enum
    • nested struct InlineArrayType_31_Nested, InlineArrayType_*_Generic
    • ref struct
    • retargeting InlineArrayType_18_Retargeting
    • [StructLayout(...)]
    • with explicit indexer
    • [Required] attribute on element field
  • inline array element type
    • inline array
    • ref struct (error)
    • pointer InlineArrayType_30_UnsupportedElementType
  • conversions Conversion_*
    • implicit conversion to Span<T> for writable variables only
    • implicit conversion to ReadOnlySpan<T> for variables only
    • no conversion for values Conversion_Value_*
    • standard conversion (participates in user-defined conversion) Conversion_Standard_*
  • element access: inlineArray[index]
    • arg type:
      • implicitly convertible to int
      • dynamic ElementAccess_Dynamic_Variable_01
      • System.Index
    • index < 0, index >= Length with constants and non-constants, int and System.Index ElementAccess_Bounds_*
    • ref, in, out index (error) RefOutInIndex
    • element access of writable variable ElementAccess_Variable_*
      • int and System.Index
      • as value, ref, ref readonly
      • ref safety
    • element access of readonly variable (including readonly context) ElementAccess_*ReadOnlyContext_*
      • int and System.Index
      • as value, ref, ref readonly
      • ref safety
    • element access of value ElementAccess_Value_*
      • int and System.Index
      • as value, ref, ref readonly
      • ref safety
    • within async methods ElementAccess_Await_*
    • in object initializer ElementAccess_ObjectInitializer_*
    • explicit indexer ignored *_IndexerIsIgnored_*
  • slice: inlineArray[range]
    • start < 0, end >= Length with constants and non-constants Slice_Bounds_*
    • slice of writable variable Slice_Variable_*
      • element access as value, ref, ref readonly
      • ref safety
    • slice of readonly variable (including readonly context) Slice_ReadOnlyContext_*
      • element access as value, ref, ref readonly
      • ref safety
    • slice of value (error)
    • within async methods Slice_Await_*
    • omit slice call if range is a constant and start is 0
    • explicit Slice() method ignored *_SliceMethodIsIgnored_*
  • indexer: prefer int over Index over Range Access_ArgumentType_*
  • as foreach collection Foreach_*
    • writable variables, readonly variables, values
    • foreach ... ref, foreach ... ref readonly
    • await foreach
    • in async method Foreach_InAsync_*
  • conditional access *_ConditionalAccess_*
    • inlineArray?[i] where i is int, Index, Range
    • type?InlineArray[i] where type is class, struct, i is int, Index, Range
  • list pattern is [..] (error) ListPattern
  • collection literals Support inline arrays with collection literals #68927
    • as collection literal target type
    • as collection literal spread element
  • in expression tree (error)
    • element access ElementAccess_ExpressionTree_01
    • conversion Conversion_ExpressionTree_01
  • definite assignment DefiniteAssignment_*
    • unassigned vs. new()
    • 1 element vs. > 1 element
    • = default;
    • definite assignment errors for element access
    • definite assignment errors for slice
    • definite assignment errors for implicit conversions to spans
    • definite assignment errors within inline array type
  • nullable analysis NullableAnalysis_*
  • missing types and methods MissingHelper_*
    • Span<T>, ReadOnlySpan<T>
    • System.Index, System.Range
    • MemoryMarshal.*, Unsafe.*
  • PrivateImplementationDetails methods created as needed PrivateImplementationDetails_*
    • InlineArrayAsSpan(), ...AsReadOnlySpan()
    • InlineArrayElementRef(), ...RefReadOnly()
  • attribute cycles CycleThroughAttributes_*
  • Test element access with an int variable as an index
  • Test with types and members synthesizing fields

Public API

IDE

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions