Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Exclude outvariable assignments within the same CommandAst when inferring variables#25224

Merged
iSazonov merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
MartinGC94:ImproveOutVarInferenceMartinGC94/PowerShell:ImproveOutVarInferenceCopy head branch name to clipboard
Mar 26, 2025
Merged

Exclude outvariable assignments within the same CommandAst when inferring variables#25224
iSazonov merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
MartinGC94:ImproveOutVarInferenceMartinGC94/PowerShell:ImproveOutVarInferenceCopy head branch name to clipboard

Conversation

@MartinGC94

Copy link
Copy Markdown
Contributor

PR Summary

This PR updates the variable type inference to ignore the assignments made within the same CommandAst as the variable that is being inferred. This fixes scenarios like: gci 2>Variable:Demo -Path ($Demo.<Tab>) where it would previously infer that $Demo was an ErrorRecord even though it wouldn't be assigned yet during the parameter binding.

PR Context

Pulled out another PR, see: #25206 (comment)

PR Checklist

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Mar 24, 2025
@iSazonov

This comment was marked as outdated.

@azure-pipelines

This comment was marked as outdated.

@iSazonov iSazonov self-assigned this Mar 24, 2025
@iSazonov

Copy link
Copy Markdown
Collaborator

/azp run

@iSazonov

This comment was marked as outdated.

@azure-pipelines

This comment was marked as outdated.

@iSazonov

Copy link
Copy Markdown
Collaborator

@MartinGC94 Please resolve merge conflicts.

@iSazonov

This comment was marked as outdated.

@azure-pipelines

This comment was marked as outdated.

@iSazonov iSazonov enabled auto-merge (squash) March 26, 2025 17:15
@iSazonov iSazonov merged commit 0c96975 into PowerShell:master Mar 26, 2025
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Mar 26, 2025

Copy link
Copy Markdown
Contributor

📣 Hey @MartinGC94, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sysoiev-Yurii pushed a commit to Sysoiev-Yurii/PowerShell that referenced this pull request May 12, 2025
SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.