Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Plan for "Params Collections" feature #71137

Open
51 of 55 tasks
AlekseyTs opened this issue Dec 6, 2023 · 0 comments
Open
51 of 55 tasks

Test Plan for "Params Collections" feature #71137

AlekseyTs opened this issue Dec 6, 2023 · 0 comments

Comments

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Dec 6, 2023

Championed proposal: dotnet/csharplang#7700
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/params-collections.md
Feature branch: https://github.com/dotnet/roslyn/tree/features/ParamsCollections

  • LangVersion (LanguageVersion_01_Declaration, LanguageVersion_02_CallSite)
  • Public API changes are approved
  • Open ParamCollectionAttribute API proposal for BCL - [API Proposal]: ParamCollectionAttribute runtime#99285
  • [Blocked]Add a test against an official definition of ParamCollectionAttribute once we can test against an SDK with it.
  • Cloned all param array specific IDE unit-tests that I could find (Clone some IDE tests for params collections #72228) opened three issues.
  • Test new betterness rules when two candidates applicable in expanded form and same arguments used in params collection:
    • (assume T implicitly convertible to TBase)
    • ReadOnlySpan<T> vs Span<TBase> (ROS is better)
    • Span/ReadOnlySpan<T> vs TBase[] (Span/ROS is better)
    • Span/ReadOnlySpan<T> vs IEnumerable<TBase> (Span/ROS is better)
    • T[] vs IEnumerable<T> (Neither is better)
    • ICollection<T> vs IEnumerable<TBase> (ICollection<T> is better if covariant conversion exists to IEnumerable<TBase>, otherwise neither is better)
    • ICollection<T> vs IEnumerable<T> (ICollection<T> is better)
  • Test usage of all "collection type kinds"
    • Span<T>
    • ReadOnlySpan<T>
    • Create method
    • Collection initializer.
      • Require constructor and Add on the type itself (ImplementsIEnumerableT_04_MissingConstructor, ImplementsIEnumerableT_07_MissingAdd)
    • List interface
  • Test usage in attribute (invalid) (Span_InAttribute, CreateMethod_02_InAttribute)
  • Test accessibility of constructor+Add (require at least as 'params' method) (ImplementsIEnumerableT_05_InaccessibleConstructor, ImplementsIEnumerableT_08_InaccessibleAdd)
  • Test extension Add does not satisfy requirement (ImplementsIEnumerableT_21_AddIsNotAnExtension)
  • Test when expected members are Obsolete (incl. collection type itself) (incl. suppression thru obsolete context)
  • Test accessibility of Create method (require at least as 'params' method)
  • Test dynamic (error when no static resolution and may be applicable in expanded form) (DynamicInvocation_)
  • Test lambda parameter with params modifier (attribute not emitted) (WRN_ParamsArrayInLambdaOnly_01)
  • Test local function parameter with params modifier (attribute not emitted) (ParamCollectionInLocalFunctionOnly)
  • Test better params collection type (BetterConversionFromExpression_)
  • Test better element type (BetterNess_01_ElementType)
  • Test different sets of arguments as params arguments (ambiguous) (BetterOverload_02_NotSameCollectionElements)
  • Ref safety (ParameterRefSafetyScope_)
  • params is inherited by override but override is not implicitly scoped (ParameterRefSafetyScope_13_Mismatch)
  • Cannot use params collection in expression tree (ExpressionTree)
  • Test cycles through expected members, e.g. CollectionType(params CollectionType t). (Cycle_).
  • Collection type has required member (error at params declaration site) (CollectionWithRequiredMember_)
  • Type inference (GenericInference) (e.g. void M<T>(params IEnumerable<T> e))
  • Nullable analysis (NullableAnalysis_)
  • Disallowed modifier combinations (ref/in/out) (scoped is permitted for ref structs)
  • params difference between overloads (NoOverloadingOnParams_)
  • Consuming from metadata, including when metadata has attribute combinations not possible in source (MetadataImport_)
  • Evaluation order of invocations
  • Well-known members for using etc. which have params collections
  • constructor/Add has optional unsafe parameters (overload resolution not affected)
  • NoPIA (ParamArrayAttribute is transferred when embedding a related API, ParamCollectionAttribute is not)
  • heads up to F# re: interop
  • test that VB can consume params collections APIs in normal form
  • add to compiler test plan

Manual IDE Test Pass

  • params classification (shows up as blue)
  • params completion void M(p$$), void M($$ IEnumerable<int> e)
  • hovering over a parameter declaration
  • hitting enter at reasonable points within the construct indent properly
  • params modifier of params collection parameter is carried through when generating an override or interface implementation, similar to params array
  • analyzer (nice to have) user has M(new List<int> { ... }) but could do M(...)
  • fixer (nice to have) from void M(params int[] i) which forwards to M((IEnumerable<int>)i) then change to M(params IEnumerable<int> i) and potentially remove void M(params int[] i)
  • analyzer (nice to have) consider changing from void M(Span<int> s) to void M(params Span<int> s)
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 6, 2023
@AlekseyTs AlekseyTs added New Feature - ParamsCollections and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 6, 2023
@jaredpar jaredpar added this to the .NET 9 milestone Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants