Test plan for "Infer tuple names" aka "tuple projection initializers" (7.1) #18606
Closed
42 of 72 tasks
Labels
Milestone
Test plan for "Infer tuple names" aka "tuple projection initializers"
This is a checklist for testing the implementation of dotnet/csharplang#415. I (@gafter) will check items off as I see they are tested.
Items that are checked off but marked with the name of a test have been updated by Julien.
There should be a positive test for each of the "golden" C# scenarios in dotnet/csharplang#370:
(int, int) t = (x, y); // (int x, int y) on the right
(TupleCreationWithInferredNames
)(int a, int b) t = (x, y); // (int x, int y) on the right
(TupleCreationWithInferredNames
)var t = (x, y); // (int x, int y)
var t = (x, x); // (int, int)
var t = (n: x, x); // (int n, int x)
var t = (x, 5); // (int x, int)
var t = (x, x, y); // (int, int, int y)
There should be a positive test for corresponding "golden" VB scenarios: (
TupleCreationWithInferredNames
,TupleCreationWithInferredNames2
)Dim t As (Integer, Integer) = (x, y) ' (x As Integer, y As Integer) on the right
Dim t As (a As Integer, b As Integer) = (x, y) ' (x As Integer, y As Integer) on the right
Dim t = (x, y) ' (x As Integer, y As Integer)
Dim t = (x, x) ' (Integer, Integer)
Dim t = (n := x, x) ' (n As Integer, x As Integer)
Dim t = (x, 5) ' (x As Integer, Integer)
Dim t = (x, x, y) ' (Integer, Integer, y As Integer)
Test language version:
MissingMemberAccessWithVB15
)TupleCreationWithInferredNames
,TupleCreationWithInferredNames2
)master
. (LanguageVersion_MapSpecifiedToEffectiveVersion
)LanguageVersion_MapSpecifiedToEffectiveVersion
)Tests specific to this feature:
Test to ensure correct (per spec) behavior when an inferred name would be of the form
Item1
(both in the correct and incorrect position) (tested onItem4
andRest
inTupleCreationWithInferredNamesWithCSharp7
)Item10
(both in the correct and incorrect position)GetHashCode
,Equals
,ReferenceEquals
Test to ensure no name inferred for a user-defined operator invocation
Test to ensure a name is inferred even if a user-defined conversion is applied after the expression
Test the interaction of "common type" with inferred names.
Test each of the syntactic constructs that cause a name to be inferred:
Identifer
(local, parameter, field, property, event, enumeration constant)expr.Identifier
includingthis.Identifier
andbase.Identifier
expr?.Identifier
value
in a property setter@_
as a plain identifier@_
as a designatorTest that other syntactic constructs to not cause a name to be inferred:
expr.M()
(except in VB)( Identifier )
checked ( Identifier )
andunchecked ( Identifier )
default(Type)
_
discard expression in deconstruction._
discard designator in deconstructionTest that inferred names can come from the left-hand-side of a deconstruction
var (x, y) = (1, 2)
(var x, var y) = (1, 2)
(int x, int y) = (1, 2)
ValueTupleReturnWithInferredNamesWithCSharp7_1
)(x, y) = (1, 2)
(ValueTupleReturnIsEmittedIfUsed
,ValueTupleReturnWithInferredNamesWithCSharp7_1
)Where names are inferred, test the behavior of APIs
GetDeclaredSymbol
on the argument expression (probably should not declare the tuple element name)GetTypeInfo
GetSpeculativeTypeInfo
const
declared member or local) should infer the name.IDE tests (see also the IDE test plan); each for both languages
TestTupleWithInferredNames
)x.y
ory
in a tuple literal, is it replaced byy: GeneratedMethod()
to preserve the inferred element name?TupleWithInferredName_InferredNameBecomesExplicit
)(temp, 2)
to(temp: expression, 2)
? (ExplicitTupleNameAdded
in C# and VB)Miscellaneous
The text was updated successfully, but these errors were encountered: