Skip to content

Assigning to an array literal of variables (LHS) should support Deconstruct methods #7471

@SeeminglyScience

Description

@SeeminglyScience

Steps to reproduce

$tuple = [Tuple]::Create(1, 1)
$item1, $item2 = $tuple

Expected behavior

Tuple.Item1 is assigned to $item1 and Tuple.Item2 is assigned to $item2

Actual behavior

$tuple is assigned to $item1

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.0-preview.4
PSEdition                      Core
GitCommitId                    6.1.0-preview.4
OS                             Microsoft Windows 10.0.15063
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

While Tuple types aren't used frequently in PowerShell there are a few other default types that have Deconstruct methods like DictionaryEntry and KeyValuePair<,>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueIssue-Enhancementthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtimeWG-ReviewedA Working Group has reviewed this and made a recommendation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions