mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Use types from both sides of the pipeline chain for the type inference (#25031)
This commit is contained in:
@@ -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] @{
|
||||
|
||||
Reference in New Issue
Block a user