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

Combine deconstruction assignment and declaration, and support discards #15826

Closed
wants to merge 1 commit into from

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented Dec 12, 2016

This is merging Neal's recent change in the features/wildcard branch (#15548) back into master.

@dotnet/roslyn-compiler

Customer scenario

This parsing fix addresses various ambiguities that would be backcompat issues once we allow mixing of deconstruction declarations and assignments. Those scenarios still report errors for now.
For instance, (a < b, c > d, e) = ...;. Are there 2 or 3 elements on the left?

Bugs this fixes:

Fixes #14794
Fixes #14832

Workarounds, if any

No workaround. If we let customers type such code in C#7.0, we can't change how it gets interpreted in a later version.

Risk

Low. The change is mostly limited to deconstruction code paths.

Performance impact

Low. The parsing has actually become more local (less parsing ahead) which should be a minor improvement.

Is this a regression from a previous update?

No.

Root cause analysis:

This is a ripple effect of our decision to rely on declaration expressions, rather than specialized deconstruction syntax.

How was the bug found?

Know work item (listed in work breakdown #14832)

…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
@jcouv
Copy link
Member Author

jcouv commented Dec 12, 2016

There were merge conflicts. Here's the new PR: #15842

@jaredpar jaredpar deleted the features/wildcard branch February 15, 2017 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment