mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix infinite loop in variable type inference (#25206)
This commit is contained in:
@@ -1197,6 +1197,12 @@ Describe "Type inference Tests" -tags "CI" {
|
||||
$res.Name | Should -Be System.String
|
||||
}
|
||||
|
||||
It 'Ignores the last assignment when a variable is reused' {
|
||||
$variableAst = { $x = New-Guid; $x = $x.Where{$_} }.Ast.FindAll({ param($a) $a -is [Language.VariableExpressionAst] }, $true) | select -Last 1
|
||||
$res = [AstTypeInference]::InferTypeOf($variableAst)
|
||||
$res.Name | Should -Be System.Guid
|
||||
}
|
||||
|
||||
$catchClauseTypes = @(
|
||||
@{ Type = 'System.ArgumentException' }
|
||||
@{ Type = 'System.ArgumentNullException' }
|
||||
|
||||
Reference in New Issue
Block a user