Skip to content

Fix static method invocation type inference - #8018

Merged
Ilya (iSazonov) merged 8 commits into
PowerShell:masterfrom
SeeminglyScience:fix-static-method-completion
Oct 23, 2018
Merged

Fix static method invocation type inference#8018
Ilya (iSazonov) merged 8 commits into
PowerShell:masterfrom
SeeminglyScience:fix-static-method-completion

Conversation

@SeeminglyScience

@SeeminglyScience Patrick Meinecke (SeeminglyScience) commented Oct 13, 2018

Copy link
Copy Markdown
Contributor

PR Summary

Added handling for PSMethod objects in TryGetTypeFromMember. This fixes type inference for static method invocations (e.g. [powershell]::Create()).

Resolves #7820

I wasn't able to find any tests for member completion so I added a few as well along with the test case for the resolved issue.

PR Checklist

@SeeminglyScience

Copy link
Copy Markdown
Contributor Author

Looking into test failures. Also will move tests to the type inference section that I missed. Moving to WIP

@SeeminglyScience Patrick Meinecke (SeeminglyScience) changed the title Fix static method invocation type inference WIP: Fix static method invocation type inference Oct 13, 2018
@SeeminglyScience Patrick Meinecke (SeeminglyScience) changed the title WIP: Fix static method invocation type inference Fix static method invocation type inference Oct 13, 2018
@SeeminglyScience

Copy link
Copy Markdown
Contributor Author

Alright it's ready. I'm fairly certain that test failure isn't related, but if I'm wrong let me know and I'll look into it.

@iSazonov

Copy link
Copy Markdown
Collaborator

Patrick Meinecke (@SeeminglyScience) Seems test failure is related to your change.

You could add a test from original Issue to TabCompletion.Tests.ps1

@SeeminglyScience

Copy link
Copy Markdown
Contributor Author

Oh okay, I originally read the failure message backwards. It looks like the change catches an additional property that was previously missed. I'll change that test to include the missed property and a add test for the original example as well.

@iSazonov
Ilya (iSazonov) merged commit 57bf508 into PowerShell:master Oct 23, 2018
@iSazonov

Copy link
Copy Markdown
Collaborator

Patrick Meinecke (@SeeminglyScience) Thanks for your contribution!

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
Fixes type inference for static method invocations (e.g. [powershell]::Create()).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type inference of static method invocations isn't working

3 participants