-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
This list is no longer maintained. Remaining work items and issues are tracked as issues with label "Tuples".
This is the TODO list for the development of the deconstruction language feature for C# 7.
Known issues and scenarios
-
Spec deconstructions (talk to Mads about "deconstruction conversion" in the current implementation)
-
Discard support Support discards in deconstructions, out var and patterns #12619
-
Deconstruction-declarations in expression context Allow parsing deconstruction-declaration as expression #15049
-
Deconstructions with mix of assignment and declaration Allow mixed deconstructions, with both assignments and declarations #15050
-
Adding Deconstruct on some BCL types (issue was abandoned)
-
Update spec (here's the branch to work on)
-
Deconstruction-assignment
- -(2.1) Support Edit-and-Continue Add support for edit-and-continue for tuples #12436
- Refine data flow analysis to simulate final evaluation and order
- Don't prematurely resolve lazy diagnostics Deconstruction: Don't prematurely resolve lazy diagnostics #13828
- Optimize common cases
- Verify whether this IL is correct
- Test ideas:
- ref returning methods on the left. Check sideeffects.
- Foo()[Bar()] on the left, where all Foo, Bar and the indexer have sideeffects - print something
- check IL in simple/common cases
-
(.... ) = async Expr(); - define Deconstruct in VB
- Consider making AssignmentInfo a struct
- Verify correct handling of dynamic
- Optimize case were RHS is a local
- Have a field with the common references used in tests (SystemCoreRef, ValueTupleRef, ...)
- Warnings on out-of-position names
- Update evaluation order to reflect LDM decision Correct the evaluation order of conversions in deconstructions #12400
- Update return type to be a tuple, instead of void. Deconstruction-assignment should return a tuple type #12635
- Including tuple literal (there should be no conversions before the tuple elements are evaluated)
- Improve error message in NullRight test
- Refer to more specific location in error messages
- Factor code that is common to out vars after merging together.
- Return type (void)
- Optimize the case where LHS variable is simple ref value
- tuple/ValueTuple deconstruction
- Does
(previous, current, next) = (current, next, null)fail due to no type on right-hand-side in which to look upDeconstruct? (no, tuples don't need Deconstruct)
- Does
- Nesting case
- Finding
Deconstructfrom base or from extension method.- Re-visit the resolution for Deconstruct, using the resolution logic from "out vars".
- Verify Deconstruct is an instance method.
- System.Tuple deconstruction
- Move binding code to separate file.
- Should deconstruction-assignment the same syntax model as deconstruction-declaration? (currently is uses a VariableDeclaration with a tuple type as the type). (answer: I don't think so)
- Consider using a BadExpression in binding (answer: I don't think so as it makes the diagnostics worse)
-
Deconstruction-declaration
- -(RC) Put OmittedType instead of null in
VariableDeclaration.Type(make it non-optional again). Put OmittedType instead of null in VariableDeclaration.Type (make it non-optional again) #12588 - -(2.1) Support other contexts: From, Let
- Improve parsing fault tolerance and diagnostics as Cyrus suggested. For example, if you type
var (int x, string y = null) = M(); - Reporting error if you try to use deconstruct syntax in unsupported contexts (like
using). - Review Fixing crash with ValueTuple alias when VT is missing (#12032), more tests. #12534 with Aleksey
- Test ideas:
- Implicit anonymous function parameter list, e.g.
(x, (y, z)) => ... - out var, e.g.
M(out var (x, y)) - Test region analysis API. (Neal)
- Test with dynamic and verify attribute is properly emitted. (Chuck, Verify the behavior of dynamic in deconstructions #12398)
- Test symbols in
(Type1 x, Type2 x) = foo; - Add test for sequence points
-
(int x, int y) = x;// flow analysis - Declaring a ref-returning method called
varshould give an error.
- Implicit anonymous function parameter list, e.g.
- Support typeless tuple literals in deconstruction declarations Support typeless tuple literals in deconstruction declarations #12410
- -(RC) Add validation to factory methods (only allow creating valid combinations with reasonable-looking children)
- -(RC) Add validation logic or erasure to WithXYZ methods
- Consider simplifying tree walking in new local symbol. (answer: N/A)
- Support local declaration, for, foreach
- Circularity problem (including nested case)
- Formatting issue and coloring in IDE with
var (x, y) = ...syntax.
- -(RC) Put OmittedType instead of null in
-
Write spec
-
Resolve filed issues
LDM
-
D-assignment return type: could we make use of the return-type of Deconstruct method?
-
D-declaration with typeless tuple literals. (answer: let's make it work. LDM 7/13)
(string x, byte y, var z) = (null, 1, 2); // what is the type on the RHS? (string x, byte y) temp = (null, 1); // the type on the right is (string, byte)
-
What is the return type of a deconstruction-assignment expression? Void or some tuple? (answer: currently void, but if we have time let's do smart tuple return. LDM 7/13)
- Treat Deconstruct as a kind of conversion in more scenarios?
(object z5, long z6) = KVP.Create("hello", 42); // You can do this (deconstruction) (object z8, long z9) z7 = KVP.Create("hello", 42); // You cannot do this...
-
I assume no compound assignment
(x, y) += M();(answer: not at this point. LDM 7/13) -
Wildcard? (answer: yes, should probably be star. LDM 7/13)
-
Should anonymous types have a Deconstruct? (answer: no, low value. LDM 7/13)
-
Should names matter in deconstruction? (answer: yes, let's warn tuple literal
var (x, y) = (a: 1, x: 2);) -
Confirm that
var (x, y) = ...should be an error ifvartype exists. (answer: correct) -
Confirm that
var (x, y) = ...is a deconstruction even when a ref-returning "var" method exists. (answer: correct) -
FYI the Deconstruct method is now resolved like an invocation with out vars. (confirmed, yes)
- This has implications on bad Deconstruct shadowing another good one (see
BadDeconstructShadowsBaseDeconstruct). (confirmed, that's ok) - Can dynamic be desconstructed? (answer: no)
- This has implications on bad Deconstruct shadowing another good one (see
-
What contexts are deconstruction-declarations allowed in? (answer: LDM confirmed the prioritization above)
- P0: local declaration, for statement, foreach,
- P1: let clause, from clause,
- later: lambda, method declaration, using, outvar, join clause, query continuation clause, join into clause, catch.
-
Is
(int x, var (y, z)) = M();allowed? (answer: yes) -
I assume no mix of assignment and declaration
int x; (x, int y) = M();(answer: confirmed in 5/25 LDM) -
I assume deconstruction-assignment should work even if System.ValueTuple is not present. (answer: that is no longer the case, ValueTuple is required)
-
Switching to tuple-returning-Deconstruct? (answer: no)
-
What is the evaluation order for nested deconstruction-assignment? (answer: all LHS side-effects, all RHS, all conversions, all assignments)
-
Finalize syntax for deconstruction-declaration. (answer:
var (x, y) = M();and(int x, int y) = M();)- Reserving ‘var’, or maybe give up on ‘var (x, y) = M();’ syntax that is ambiguous with method invocation. (answer: no need)
- Considering ‘@’ to simplify parsing of deconstructions. (answer: no need)
-
Do the names matter?
int x, y; (a: x, b: y) = M();(answer: for now this should be error)
Interaction with other language features:
General concerns:
- Error handling/recovery
- Errors in parsing
- Error handling for semantic errors (e.g. ambiguous lookup, inaccessible lookup, wrong kind of thing found, instance vs static thing found, wrong type for the context, value vs variable)
- Missing types (mscorlib or others)
- Public interface of compiler APIs, backcompat scenarios
- backward and forward compatibility (i.e. interoperation with previous and future compilers, each in both directions)
- VB/F# interop, Mono issues
- BCL and other customer impact
- Determinism
- Loading from metadata (source vs. loaded from metadata)
- Atomicity
- Edit-and-continue
- Completeness of the specification as a guide for testing (e.g. is the spec complete enough to suggest what the compiler should do in each scenario?)
- XML docs and other external documentation
- Performance
- Reflection
- Review proposed changes to public API
- Debugging
- Leverage feature in Roslyn codebase (dogfood)
Types and members:
- Access modifiers (public, protected, internal, protected internal, private), static modifier
- Parameter modifiers (ref, out, params)
- Attributes (including security attribute)
- Generics (type arguments, constraints, variance)
- default value
- partial classes
- literals
- enum (implicit vs. explicit underlying type)
- expression trees
- Iterators
- Initializers (object, collection, dictionary)
- array (single- or multi-dimensional, jagged, initilalizer)
- Expression-bodied methods/properties/...
- Extension methods
- Partial method
- Named and optional parameters
- String interpolation
- Properties (read-write, read-only, write-only, auto-property, expression-bodied)
- Interfaces (implicit vs. explicit interface member implementation)
- delegates
- Multi-declaration
Code:
- Operators (see Eric's list)
- Operator overloading
- Lvalues: the synthesized fields are mutable
- Ref / out parameters
- Compound operators (+=, /=, etc ..)
- Assignment exprs
- lambdas (capture of parameters or locals, target typing)
- execution order
- Target typing (var, lambdas, integrals)
- Type inference
- Conversions
- Implicit (identity, implicit numeric, implicit enumeration, implicit nullable, null litaral, implicit reference, boxing, implicit dynamic, implicit constant, user-defined implicit conversion, anonymous function, method group)
- Explicit (numeric, enumeration, nullable, reference, unboxing, dynamic, user-defined)
- Anonymous functions
- nullable (wrapping, unwrapping)
- OHI
- inheritance (virtual, override, abstract, new)
- overload resolution
- Anonymous types
- Unsafe code
- LINQ
- constructors, properties, indexers, events, operators, and destructors.
- Async
Misc:
- reserved keywords (sometimes contextual)
- pre-processing directives
- COM interop
Interaction with Debugger:
- typing in immediate/watch window (that also covers hovering over a variable)
- displaying locals (that also covers autos)
Interaction with IDE:
- Colorization
- Type ahead
- Intellisense (squiggles, dot completion)
- Renaming
- Interaction with incomplete code scenarios (e.g. while typing)
- More complete list: Discussion: IDE Test Plan for New Language Features #8389
References
Metadata
Metadata
Assignees
Labels
Type
Projects
Status