Title: Support `$_` type inference in magic methods · Issue #11803 · PowerShell/PowerShell · GitHub
Open Graph Title: Support `$_` type inference in magic methods · Issue #11803 · PowerShell/PowerShell
X Title: Support `$_` type inference in magic methods · Issue #11803 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement The type of $_ can be inferred for ForEach-Object/Where-Object but not in the ForEach and Where magic methods: $script = '@(0..10).ForEach{ $_.' TabExpansion2 -inputScript $script -cursorColumn $scr...
Open Graph Description: Summary of the new feature/enhancement The type of $_ can be inferred for ForEach-Object/Where-Object but not in the ForEach and Where magic methods: $script = '@(0..10).ForEach{ $_.' TabExpansion2...
X Description: Summary of the new feature/enhancement The type of $_ can be inferred for ForEach-Object/Where-Object but not in the ForEach and Where magic methods: $script = '@(0..10).ForEach{ $_.' TabEx...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11803
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support `$_` type inference in magic methods","articleBody":"# Summary of the new feature/enhancement\r\n\r\n\u003c!-- \r\nA clear and concise description of what the problem is that the new feature would solve.\r\nTry formulating it in user story style (if applicable):\r\n'As a user I want X so that Y.' with X being the being the action and Y being the value of the action.\r\n-->\r\n\r\nThe type of `$_` can be inferred for `ForEach-Object`/`Where-Object` but not in the `ForEach` and `Where` magic methods:\r\n\r\n```powershell\r\n$script = '@(0..10).ForEach{ $_.'\r\nTabExpansion2 -inputScript $script -cursorColumn $script.Length\r\n```\r\n\r\nShould return the same as \r\n\r\n```powershell\r\n$script = '@(0..10) | ForEach-Object { $_.'\r\nTabExpansion2 -inputScript $script -cursorColumn $script.Length\r\n```\r\n\r\n# Proposed technical implementation details (optional)\r\n\r\nhttps://github.com/PowerShell/PowerShell/blob/69bf7043c0c7471679265778e12053c1c40b0000/src/System.Management.Automation/engine/parser/TypeInferenceVisitor.cs#L1770-L1786\r\n\r\nThe code above is the start of `$_` type inference, a case just needs to be added for `ForEach`/`Where` similar to the others.\r\n","author":{"url":"https://github.com/SeeminglyScience","@type":"Person","name":"SeeminglyScience"},"datePublished":"2020-02-07T13:23:47Z","url":"https://github.com/PowerShell/PowerShell/issues/11803"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9ddb1fb9-5637-b3ea-d5bc-17ff00a33833 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 937A:38E576:68B898:979524:6AFD8FA6 |
| html-safe-nonce | b05c12c0c72afa45151a0924cc8bb4e41dbacbb1f03239774e0ae4884c5adab3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzdBOjM4RTU3Njo2OEI4OTg6OTc5NTI0OjZBRkQ4RkE2IiwidmlzaXRvcl9pZCI6IjI2NjQ3NDU1NTM1OTc2NjUxOTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 559e93e503e01cf92819997a10174b5e95d78382d14aef7845b355d93b016ba5 |
| hovercard-subject-tag | issue:561634962 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/11803/issue_layout |
| twitter:image | https://opengraph.githubassets.com/55daee2dac3dbe4d0b2311d53cd42836504d9287abb27d7ec1a2cb7e42849567/PowerShell/PowerShell/issues/11803 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/55daee2dac3dbe4d0b2311d53cd42836504d9287abb27d7ec1a2cb7e42849567/PowerShell/PowerShell/issues/11803 |
| og:image:alt | Summary of the new feature/enhancement The type of $_ can be inferred for ForEach-Object/Where-Object but not in the ForEach and Where magic methods: $script = '@(0..10).ForEach{ $_.' TabExpansion2... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SeeminglyScience |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width