-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Work Breakdown for "Proposed changes for deconstruction, declaration expressions, and discards" #14832
Comments
Discussed this with @gafter . We have test coverage for the areas this would hit. Expected fallout cost on the IDE side should be minimal. We may need additional logic to detect new error conditions (for example, warning when renaming something to '_'). We may also want new features (for example, a feature that suggests using a wildcard when a pattern variable is unused). We may also want something provided from the semantic/symbol model to identify if '_' is a wildcard. That will likely make a bunch of things easier (for example, disallow 'rename' on a wildcard, etc. etc.). |
Now that the wildcard is settled for vnext, I'd like to know about the final decision toward using wildcard and default case in switch. Restating from #8818 discussion,
Whereas with Per #11438 (comment)
So it will be allowed to use wildcard with a default case in a single switch statement? |
@alrz I don't understand your question. A |
See also #14862 |
This issue should be rolled into https:/dotnet/roslyn/blob/features/wildcard/docs/features/wildcards.work.md |
…ds. (#15548) * Combine deconstruction assignment and declaration, and support discards. - Combine deconstruction assignment and declaration, and support discards. - Add wildcards.work.md to track outstanding work. - Bind each type syntax once in a deconstruction. - Because tuples may contain declarations, adjust lambda disambiguation and adjust parsing of argument lists. - Diagnose tuple element names on the left of a deconstruction. - Add relational operators to disambiguating tokens in 7.5.4.2 * Disallow deconstruction declarations except at the statement level. This is now a semantic restriction (until we decide to remove it). * Revise logic to detect `var` in a declaration expression. Plus other changes per code review. * Add a test that GetTypeInfo on a discard expression doesn't crash. * Small changes per code review. * Add (skipped) test for var invocation in parens. * Rename "Discarded" to "Discard" * Changes recommended via code review. * Minor changes to the handling of declaration expressions per code review. * Addressing blocking feedback while Neal is OOF Fixes #14794 Fixes #14832
I'll close this umbrella issue. The only open item is already tracked by an individual issue:
|
This is a breakdown of the work needed to implement the changes described in #14794 ("Proposed changes for deconstruction, declaration expressions, and wildcards")
Language design loose ends
_
) with wildcards. (1 LDM meeting or less)Syntax and parser changes
Semantic analysis changes
foreach
statement (which is now an ExpressionSyntax)Scoping changes
There are a number of changes related to the scoping of
_
as an identifier._
and find nothing, we treat it as a target-typed wildcard rather than an error. (< 1 day)SemanticModel
_
, we treat it as a wildcard._
lambda parameters, but they introduce nothing into scope. (< 2 days) Permit discards in lambda parameters #16255_
. (< 2 days)_
that need to be specified and implemented. (< 4 days)(_,_)=>1
, I propose we not implement that in the first iteration of changes. It is a separable and compatible change that can be done in the next iteration.Lowering changes
Semantic Model changes
The behavior for the semantic model needs to be decided in a design meeting among compiler folks and IDE people.
_
.var (x, (y, _))
) should give the type of the consumed tuple value.(y, _)
invar (x, (y, _))
.IDE impact (per @CyrusNajmabadi)
IDE impact for existing features is fairly superficial. The IDE tests are mostly behavioral, and virtually all of them of them remain correct in their current form. Most of the changes will just "work right" once the
SemanticModel
has been adjusted to implement behavior for the new features. (< 2 days)The rename refactoring will have to be modified to prevent you from renaming something to
_
unless it has no references.There will be some opportunities for new features. For example, fixing a "pattern/out/deconstruction variable declared but not used" warning would be a small refactor that changes it to use a wildcard (i.e. rename it to
_
). That is a new feature, optional, and not required as part of this work.Other items to follow-up on:
IDiscardedSymbol
toIDiscardSymbol
Overall estimate
This assumes work done by area owners
Language design wrapup < 1 day
Syntax changes < 3 days
Scope changes < 4 days
Semantics changes < 4 days
Lowering changes < 4 days
IDE changes < 2 days
If the work herein is shared among area owners (e.g. scope work done or assisted by @AlekseyTs, deconstruction lowering done or assisted by @jcouv) this work can be largely completed over the duration of one sprint; it is less than one half of the team's work for the duration of a sprint, with a few smaller issues trailing into the following sprint.
The text was updated successfully, but these errors were encountered: