Use types from both sides of the pipeline chain for the type inference (#25031)

This commit is contained in:
MartinGC94
2025-02-18 05:44:28 +00:00
committed by GitHub
parent d95d96ac85
commit fd85f6c35a
2 changed files with 9 additions and 1 deletions
@@ -442,6 +442,14 @@ Describe "Type inference Tests" -tags "CI" {
}
}
It 'Infers typeof pipeline chain' {
$ast = {New-TimeSpan && New-Guid}.Ast
$typeNames = [AstTypeInference]::InferTypeof($ast, [TypeInferenceRuntimePermissions]::AllowSafeEval)
$typeNames.Count | Should -Be 2
$typeNames[0] | Should -Be 'System.TimeSpan'
$typeNames[1] | Should -Be 'System.Guid'
}
It "Infers typeof pscustomobject" {
$res = [AstTypeInference]::InferTypeOf( { [pscustomobject] @{