Skip to content

A malformed type literal passed to the -is or -as operator is quietly ignored at the prompt #11428

@mklement0

Description

@mklement0

Note that the problem only surfaces at the interactive prompt, whether or not PSReadLine is loaded.

In a script / script block, an error occurs, as expected.

This is a regression from v6.2.3 / WinPS.

Steps to reproduce

Submit at the prompt:

'foo' -is [string 
'foo' -as [string 

Expected behavior

A statement-terminating error with message:

Missing ] at end of attribute or type literal.

Actual behavior

Both commands fail quietly, and $? even contains $true.

Environment data

PowerShell Core 7.0.0-rc.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Languageparser, language semantics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions