Skip to content

Type inference of static method invocations isn't working #7820

@SeeminglyScience

Description

@SeeminglyScience

Steps to reproduce

$script = '[powershell]::Create().'
$results = TabExpansion2 -inputScript $script -cursorColumn $script.Length
$results.CompletionMatches[0]

Expected behavior

Returns completion results for an instance member of the PowerShell class.

CompletionText ListItemText ResultType ToolTip
-------------- ------------ ---------- -------
Commands       Commands       Property System.Management.Automation.PSCommand Commands { get; set; }

Actual behavior

Nothing is returned.


Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.17134
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional Info

The AddMembersByInferredTypesClrType method adds static members as PSMethod objects but TryGetTypeFromMember expects CLR methods as MethodCacheEntry objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions