Title: Refactor `PSMethodInvocationConstraints` to make it able to work with types that not available at compilation time but loaded at runtime · Issue #16809 · PowerShell/PowerShell · GitHub
Open Graph Title: Refactor `PSMethodInvocationConstraints` to make it able to work with types that not available at compilation time but loaded at runtime · Issue #16809 · PowerShell/PowerShell
X Title: Refactor `PSMethodInvocationConstraints` to make it able to work with types that not available at compilation time but loaded at runtime · Issue #16809 · PowerShell/PowerShell
Description: Use this issue to track my review comment #12412 (comment) regarding PSMethodInvocationConstraints.GenericTypeParameters. There are 2 problems with invocation of method with generic arguments today: For $a.MethodName[type-A]($arg), if [t...
Open Graph Description: Use this issue to track my review comment #12412 (comment) regarding PSMethodInvocationConstraints.GenericTypeParameters. There are 2 problems with invocation of method with generic arguments today...
X Description: Use this issue to track my review comment #12412 (comment) regarding PSMethodInvocationConstraints.GenericTypeParameters. There are 2 problems with invocation of method with generic arguments today...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/16809
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Refactor `PSMethodInvocationConstraints` to make it able to work with types that not available at compilation time but loaded at runtime","articleBody":"Use this issue to track my review comment https://github.com/PowerShell/PowerShell/pull/12412#discussion_r793031059 regarding `PSMethodInvocationConstraints.GenericTypeParameters`.\r\n\r\nThere are 2 problems with invocation of method with generic arguments today:\r\n1. For `$a.MethodName[type-A]($arg)`, if `[type-A]` cannot be resolved at all, there is no good error message on what type name cannot be resolved.\r\n2. For `$a.MethodName[type-A]($arg)`, if `[type-A]` can be resolved at run time (new assembly gets loaded or so), it won't be honored, because we only attempt to resolve the type at compilation time in compiler.\r\n\r\nIt's not a problem for `PSMethodInvocationConstraints.ParameterTypes`, because for any argument conversion, if we cannot resolve the type when constructing `PSMethodInvocationConstrains` (namely, the element in `ParameterTypes` is `null`), then we will just use the [effective argument type](https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/CoreAdapter.cs#L1427) in `FindBestMethodImpl`.\r\n\r\nThe fix would be to refactor `PSMethodInvocationConstraints.GenericTypeParameters` somewhat, to allow a compile-time unresolvable type to fall back to [TypeOps.ResolveTypeName](https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs#L2116) in `FindBestMethodImpl`. That method will take care of the type loaded at run time, as well as generating better error message when a type name really cannot be resolved.","author":{"url":"https://github.com/daxian-dbw","@type":"Person","name":"daxian-dbw"},"datePublished":"2022-01-26T23:19:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/16809/PowerShell/issues/16809"}
| 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:f5a8caa5-229d-ed0a-e7d1-d009ae30d04d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 950C:29B748:2A04C6A:398D554:6A545038 |
| html-safe-nonce | 57e3ab6189f24c5b268155bff8ad77bad0455ff8adff2de40a99720643ccb95c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTBDOjI5Qjc0ODoyQTA0QzZBOjM5OEQ1NTQ6NkE1NDUwMzgiLCJ2aXNpdG9yX2lkIjoiNzI2NDEwNTExMDM2MzcyMTc4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e2824aeaf784b0292cfb92761b50afb7b27e5000d1479e106b9bad296fa4331b |
| hovercard-subject-tag | issue:1115597876 |
| 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/16809/issue_layout |
| twitter:image | https://opengraph.githubassets.com/14fc55c0e4755b305dc6ae41f2f0694eeb9549063e77e8622b8471ba0a67179e/PowerShell/PowerShell/issues/16809 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/14fc55c0e4755b305dc6ae41f2f0694eeb9549063e77e8622b8471ba0a67179e/PowerShell/PowerShell/issues/16809 |
| og:image:alt | Use this issue to track my review comment #12412 (comment) regarding PSMethodInvocationConstraints.GenericTypeParameters. There are 2 problems with invocation of method with generic arguments today... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daxian-dbw |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width