Skip to content

missing property reference error ignored if followed by unary operator #9564

Closed
@msftrncs

Description

@msftrncs

I found this by accident, left the . property reference while testing ideas.

I think it is incorrect that this code goes without any errors, and also generates no result.

Steps to reproduce

$Departments = @'
Alpha
Beta
Gamma
Zulu
'@. -split '\r'

Expected behavior

At line:6 char:4
+ '@.
+    ~
Missing property name after reference operator.
+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingPropertyName

Actual behavior


Exactly, nothing happens, no error, no result. Any unary operator seems to do this. A non-unary operator will generate two error messages, missing property, and unexpected token (for the right operand).

Environment data

PowerShell 6.2 on Windows 10 1809
Windows PowerShell 5.1 (same OS)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-By DesignThe reported behavior is by design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions