| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Sorry, something went wrong.
There was a problem hiding this comment.
Replacement callback detection incorrectly assigns Match to eagerly invoked scriptblocks and misses array-literal callbacks, producing incorrect or missing type inference for $_.
2 open issuesAdds type inference for $_ inside -replace scriptblocks, enabling PowerShell’s inference engine to recognize it as System.Text.RegularExpressions.Match.
Changes:
| File | Description |
|---|---|
| test/powershell/engine/Api/TypeInference.Tests.ps1 | Tests $_ type inference inside a replacement callback. |
| src/System.Management.Automation/engine/parser/TypeInferenceVisitor.cs | Adds replacement-context detection and Match inference. |
Review effort: Balanced
Sorry, something went wrong.
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
This PR adds type inference for $_ when used inside a scriptblock for the -replace operator.
For example when it's used like this: "123" -replace '2', {[int]$_.Value + 2}
PR Context
Yesterday I found out that you could use a scriptblock for -replace but there was no type inference for $_ in this particular case, so I decided to add it.
PR Checklist